BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
57d331d7
Commit
57d331d7
authored
Oct 11, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '38869-start' into 'master'
Enable eslint in star and remove from main.js See merge request gitlab-org/gitlab-ce!14795
parents
a6b33275
696ffac0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
main.js
app/assets/javascripts/main.js
+0
-1
star.js
app/assets/javascripts/star.js
+21
-19
No files found.
app/assets/javascripts/main.js
View file @
57d331d7
...
...
@@ -116,7 +116,6 @@ import './right_sidebar';
import
'./search'
;
import
'./search_autocomplete'
;
import
'./smart_interval'
;
import
'./star'
;
import
'./subscription'
;
import
'./subscription_select'
;
import
initBreadcrumbs
from
'./breadcrumb'
;
...
...
app/assets/javascripts/star.js
View file @
57d331d7
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-unused-vars, one-var, no-var, one-var-declaration-per-line, prefer-arrow-callback, no-new, max-len */
import
Flash
from
'./flash'
;
import
{
__
,
s__
}
from
'./locale'
;
export
default
class
Star
{
constructor
()
{
$
(
'.project-home-panel .toggle-star'
).
on
(
'ajax:success'
,
function
(
e
,
data
,
status
,
xhr
)
{
var
$starIcon
,
$starSpan
,
$this
,
toggleStar
;
$this
=
$
(
this
);
$starSpan
=
$this
.
find
(
'span'
);
$starIcon
=
$this
.
find
(
'i'
);
toggleStar
=
function
(
isStarred
)
{
$this
.
parent
().
find
(
'.star-count'
).
text
(
data
.
star_count
);
if
(
isStarred
)
{
$starSpan
.
removeClass
(
'starred'
).
text
(
s__
(
'StarProject|Star'
));
$starIcon
.
removeClass
(
'fa-star'
).
addClass
(
'fa-star-o'
);
}
else
{
$starSpan
.
addClass
(
'starred'
).
text
(
__
(
'Unstar'
));
$starIcon
.
removeClass
(
'fa-star-o'
).
addClass
(
'fa-star'
);
$
(
'.project-home-panel .toggle-star'
)
.
on
(
'ajax:success'
,
function
handleSuccess
(
e
,
data
)
{
const
$this
=
$
(
this
);
const
$starSpan
=
$this
.
find
(
'span'
);
const
$starIcon
=
$this
.
find
(
'i'
);
function
toggleStar
(
isStarred
)
{
$this
.
parent
().
find
(
'.star-count'
).
text
(
data
.
star_count
);
if
(
isStarred
)
{
$starSpan
.
removeClass
(
'starred'
).
text
(
s__
(
'StarProject|Star'
));
$starIcon
.
removeClass
(
'fa-star'
).
addClass
(
'fa-star-o'
);
}
else
{
$starSpan
.
addClass
(
'starred'
).
text
(
__
(
'Unstar'
));
$starIcon
.
removeClass
(
'fa-star-o'
).
addClass
(
'fa-star'
);
}
}
};
toggleStar
(
$starSpan
.
hasClass
(
'starred'
));
}).
on
(
'ajax:error'
,
function
(
e
,
xhr
,
status
,
error
)
{
new
Flash
(
'Star toggle failed. Try again later.'
,
'alert'
);
});
toggleStar
(
$starSpan
.
hasClass
(
'starred'
));
})
.
on
(
'ajax:error'
,
()
=>
{
Flash
(
'Star toggle failed. Try again later.'
,
'alert'
);
});
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment