Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
696ffac0
Commit
696ffac0
authored
Oct 11, 2017
by
Filipa Lacerda
Committed by
Phil Hughes
Oct 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable eslint in star and remove from main.js
parent
a6b33275
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-1
app/assets/javascripts/star.js
app/assets/javascripts/star.js
+21
-19
No files found.
app/assets/javascripts/main.js
View file @
696ffac0
...
...
@@ -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 @
696ffac0
/* 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