gitlab-org--gitlab-foss/app/views/projects/buttons/_fork.html.haml

16 lines
1.3 KiB
Text

- unless @project.empty_repo?
- if current_user && can?(current_user, :fork_project, @project)
.count-badge.btn-group
- if current_user.already_forked?(@project) && current_user.manageable_namespaces.size < 2
= link_to namespace_project_path(current_user, current_user.fork_of(@project)), title: s_('ProjectOverview|Go to your fork'), class: 'gl-button btn btn-default btn-sm has-tooltip fork-btn' do
= sprite_icon('fork', css_class: 'icon')
%span= s_('ProjectOverview|Fork')
- else
- can_create_fork = current_user.can?(:create_fork)
- disabled_fork_tooltip = s_('ProjectOverview|You have reached your project limit')
%span.btn-group.has-tooltip{ title: (disabled_fork_tooltip unless can_create_fork) }
= link_to new_project_fork_path(@project), class: "gl-button btn btn-default btn-sm fork-btn #{' disabled' unless can_create_fork }", 'aria-label' => (disabled_fork_tooltip unless can_create_fork) do
= sprite_icon('fork', css_class: 'icon')
%span= s_('ProjectOverview|Fork')
= link_to project_forks_path(@project), title: n_(s_('ProjectOverview|Forks'), s_('ProjectOverview|Forks'), @project.forks_count), class: 'gl-button btn btn-default btn-sm count has-tooltip' do
= @project.forks_count