Refactor of buttons _dropdown partial

Remove block + interpolation to simplify the calls to link helpers
This commit is contained in:
Mark Fletcher 2018-01-16 08:44:23 +00:00
parent 4b99bee096
commit 1704dc9720

View file

@ -10,37 +10,28 @@
- if can_create_issue - if can_create_issue
%li %li
= link_to new_project_issue_path(@project) do = link_to _('New issue'), new_project_issue_path(@project)
#{ _('New issue') }
- if merge_project - if merge_project
%li %li
= link_to project_new_merge_request_path(merge_project) do = link_to _('New merge request'), project_new_merge_request_path(merge_project)
#{ _('New merge request') }
- if can_create_snippet - if can_create_snippet
%li %li
= link_to new_project_snippet_path(@project) do = link_to _('New snippet'), new_project_snippet_path(@project)
#{ _('New snippet') }
- if can_create_issue || merge_project || can_create_snippet - if can_create_issue || merge_project || can_create_snippet
%li.divider %li.divider
- if can?(current_user, :push_code, @project) - if can?(current_user, :push_code, @project)
%li %li
= link_to project_new_blob_path(@project, @project.default_branch || 'master') do = link_to _('New file'), project_new_blob_path(@project, @project.default_branch || 'master')
#{ _('New file') }
- unless @project.empty_repo? - unless @project.empty_repo?
%li %li
= link_to new_project_branch_path(@project) do = link_to _('New branch'), new_project_branch_path(@project)
#{ _('New branch') }
%li %li
= link_to new_project_tag_path(@project) do = link_to _('New tag'), new_project_tag_path(@project)
#{ _('New tag') }
- elsif current_user && current_user.already_forked?(@project) - elsif current_user && current_user.already_forked?(@project)
%li %li
= link_to project_new_blob_path(@project, @project.default_branch || 'master') do = link_to _('New file'), project_new_blob_path(@project, @project.default_branch || 'master')
#{ _('New file') }
- elsif can?(current_user, :fork_project, @project) - elsif can?(current_user, :fork_project, @project)
%li %li
- continue_params = { to: project_new_blob_path(@project, @project.default_branch || 'master'), - continue_params = { to: project_new_blob_path(@project, @project.default_branch || 'master'),
@ -48,5 +39,4 @@
notice_now: edit_in_new_fork_notice_now } notice_now: edit_in_new_fork_notice_now }
- fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id, - fork_path = project_forks_path(@project, namespace_key: current_user.namespace.id,
continue: continue_params) continue: continue_params)
= link_to fork_path, method: :post do = link_to _('New file'), fork_path, method: :post
#{ _('New file') }