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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
52293ccd
Commit
52293ccd
authored
Dec 23, 2015
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring javascript to put starring functionality in a function
parent
8bbcbe78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
19 deletions
+24
-19
app/views/projects/buttons/_star.html.haml
app/views/projects/buttons/_star.html.haml
+24
-19
No files found.
app/views/projects/buttons/_star.html.haml
View file @
52293ccd
...
...
@@ -16,26 +16,31 @@
var
$this
=
$
(
this
);
var
$starSpan
=
$this
.
find
(
'
span
'
);
var
$starIcon
=
$this
.
find
(
'
i
'
);
$this
.
parent
()
.
find
(
'
span.count
'
)
.
text
(
data
.
star_count
);
if
(
$starSpan
.
hasClass
(
'
starred
'
)){
$starSpan
.
removeClass
(
'
starred
'
)
.
text
(
'
Star
'
);
$starIcon
.
removeClass
(
'
fa-star
'
)
.
addClass
(
'
fa-star-o
'
);
}
else
{
$starSpan
.
addClass
(
'
starred
'
)
.
text
(
'
Unstar
'
);
$starIcon
.
removeClass
(
'
fa-star-o
'
)
.
addClass
(
'
fa-star
'
);
}
var
toggleStar
=
function
(
isStarred
)
{
$this
.
parent
()
.
find
(
'
span.count
'
)
.
text
(
data
.
star_count
);
if
(
isStarred
){
$starSpan
.
removeClass
(
'
starred
'
)
.
text
(
'
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
'
);
...
...
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