Factor fork button view.
This commit is contained in:
parent
fda61a047f
commit
b5c0bdd7c9
2 changed files with 10 additions and 8 deletions
|
@ -156,6 +156,14 @@ module ProjectsHelper
|
|||
end
|
||||
end
|
||||
|
||||
def link_to_toggle_fork
|
||||
out = content_tag(:i, '', class: 'icon-code-fork')
|
||||
out << ' Fork'
|
||||
out << content_tag(:span, class: 'count') do
|
||||
@project.forks_count.to_s
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_project_nav_tabs(project, current_user)
|
||||
|
|
|
@ -18,16 +18,10 @@
|
|||
- if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace
|
||||
- if current_user.already_forked?(@project)
|
||||
= link_to project_path(current_user.fork_of(@project)), title: 'Got to my fork' do
|
||||
%i.icon-code-fork
|
||||
Fork
|
||||
%span.count
|
||||
= @project.forks_count
|
||||
= link_to_toggle_fork
|
||||
- else
|
||||
= link_to fork_project_path(@project), title: "Fork project", method: "POST" do
|
||||
%i.icon-code-fork
|
||||
Fork
|
||||
%span.count
|
||||
= @project.forks_count
|
||||
= link_to_toggle_fork
|
||||
|
||||
.star-buttons
|
||||
%span.star.js-toggler-container{class: @show_star ? 'on' : ''}
|
||||
|
|
Loading…
Reference in a new issue