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
Jérome Perrin
gitlab-ce
Commits
c82691b7
Commit
c82691b7
authored
Dec 18, 2015
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds starring and unstarring text to star button, also adds partial new styles
parent
70eff78d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+4
-1
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/views/projects/buttons/_star.html.haml
app/views/projects/buttons/_star.html.haml
+17
-2
No files found.
app/assets/stylesheets/pages/projects.scss
View file @
c82691b7
...
@@ -115,7 +115,6 @@
...
@@ -115,7 +115,6 @@
margin-left
:
4px
;
margin-left
:
4px
;
.arrow
{
.arrow
{
&
:before
{
&
:before
{
content
:
''
;
content
:
''
;
display
:
inline-block
;
display
:
inline-block
;
...
@@ -165,6 +164,10 @@
...
@@ -165,6 +164,10 @@
background-image
:
none
;
background-image
:
none
;
white-space
:
nowrap
;
white-space
:
nowrap
;
margin
:
0
11px
0px
4px
;
margin
:
0
11px
0px
4px
;
&
:hover
{
background
:
#FFF
;
}
}
}
}
}
}
}
...
...
app/controllers/projects_controller.rb
View file @
c82691b7
...
@@ -171,7 +171,7 @@ class ProjectsController < ApplicationController
...
@@ -171,7 +171,7 @@ class ProjectsController < ApplicationController
@project
.
reload
@project
.
reload
render
json:
{
render
json:
{
html:
view_to_html_string
(
"projects/buttons/_star"
)
star_count:
@project
.
star_count
}
}
end
end
...
...
app/views/projects/buttons/_star.html.haml
View file @
c82691b7
-
if
current_user
-
if
current_user
=
link_to
toggle_star_namespace_project_path
(
@project
.
namespace
,
@project
),
class:
'btn star-btn toggle-star has_tooltip'
,
method: :post
,
remote:
true
,
title:
"Star project"
do
=
link_to
toggle_star_namespace_project_path
(
@project
.
namespace
,
@project
),
class:
'btn star-btn toggle-star has_tooltip'
,
method: :post
,
remote:
true
,
title:
"Star project"
do
=
icon
(
'star fw'
)
=
icon
(
'star fw'
)
Star
-
if
current_user
.
starred?
(
@project
)
%span
.starred
Unstar
-
else
%span
Star
%div
.count-with-arrow
%div
.count-with-arrow
%span
.arrow
%span
.arrow
%span
.count
%span
.count
...
@@ -9,7 +12,19 @@
...
@@ -9,7 +12,19 @@
:javascript
:javascript
$
(
'
.project-home-panel .toggle-star
'
).
on
(
'
ajax:success
'
,
function
(
e
,
data
,
status
,
xhr
)
{
$
(
'
.project-home-panel .toggle-star
'
).
on
(
'
ajax:success
'
,
function
(
e
,
data
,
status
,
xhr
)
{
$
(
this
).
replaceWith
(
data
.
html
);
var
$this
=
$
(
this
);
var
$starSpan
=
$this
.
find
(
'
span
'
);
$this
.
parent
()
.
find
(
'
span.count
'
)
.
text
(
data
.
star_count
);
if
(
$starSpan
.
hasClass
(
'
starred
'
)){
$starSpan
.
removeClass
(
'
starred
'
);
$starSpan
.
text
(
'
Star
'
);
}
else
{
$starSpan
.
addClass
(
'
starred
'
);
$starSpan
.
text
(
'
Unstar
'
);
}
})
})
.
on
(
'
ajax:error
'
,
function
(
e
,
xhr
,
status
,
error
)
{
.
on
(
'
ajax:error
'
,
function
(
e
,
xhr
,
status
,
error
)
{
new
Flash
(
'
Star toggle failed. Try again later.
'
,
'
alert
'
);
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