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
Boxiang Sun
gitlab-ce
Commits
15914676
Commit
15914676
authored
Jul 17, 2014
by
Ciro Santilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Helper instead of template.
parent
0a6e978d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
25 deletions
+25
-25
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+22
-0
app/views/projects/_home_panel.html.haml
app/views/projects/_home_panel.html.haml
+3
-12
app/views/projects/_link_to_toggle_star.html.haml
app/views/projects/_link_to_toggle_star.html.haml
+0
-13
No files found.
app/helpers/projects_helper.rb
View file @
15914676
...
...
@@ -122,6 +122,28 @@ module ProjectsHelper
options_for_select
(
values
,
current_tracker
)
end
def
link_to_toggle_star
(
title
,
starred
,
signed_in
)
cls
=
'btn'
cls
+=
' disabled'
unless
signed_in
content_tag
'span'
,
class:
starred
?
'turn-on'
:
'turn-off'
do
link_to
toggle_star_project_path
(
@project
),
title:
title
,
class:
cls
,
method: :post
,
remote:
true
,
data:
{
type:
'json'
}
do
content_tag
(
'span'
,
class:
'toggle'
)
do
content_tag
(
'i'
,
' '
,
class:
'icon-star'
)
<<
if
starred
'Unstar'
else
'Star'
end
end
<<
content_tag
(
'span'
,
class:
'count'
)
do
@project
.
star_count
.
to_s
end
end
end
end
private
def
get_project_nav_tabs
(
project
,
current_user
)
...
...
app/views/projects/_home_panel.html.haml
View file @
15914676
...
...
@@ -36,16 +36,7 @@
%span
.light.prepend-left-20
=
repository_size
%span
.star.js-toggler-container
{
class:
@show_star
?
'on'
:
''
}
-
if
current_user
=
render
'link_to_toggle_star'
,
title:
'Star this project.'
,
starred:
false
,
signed_in:
true
=
render
'link_to_toggle_star'
,
title:
'Unstar this project.'
,
starred:
true
,
signed_in:
true
=
link_to_toggle_star
(
'Star this project.'
,
false
,
true
)
=
link_to_toggle_star
(
'Unstar this project.'
,
true
,
true
)
-
else
=
render
'link_to_toggle_star'
,
title:
'You must sign in to star a project.'
,
starred:
false
,
signed_in:
false
=
link_to_toggle_star
(
'You must sign in to star a project.'
,
false
,
false
)
app/views/projects/_link_to_toggle_star.html.haml
deleted
100644 → 0
View file @
0a6e978d
-
cls
=
'btn'
-
cls
+=
' disabled'
unless
signed_in
%span
{
class:
starred
?
'turn-on'
:
'turn-off'
}
=
link_to
toggle_star_project_path
(
@project
),
title:
title
,
class:
cls
,
method: :post
,
remote:
true
,
data:
{
type:
'json'
}
do
%span
.toggle
<>
%i
.icon-star
-
if
starred
Unstar
-
else
Star
%span
.count
<>
=
@project
.
star_count
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