summaryrefslogtreecommitdiff
path: root/app/views/projects/commit/_change.html.haml
blob: 3c5f291b1571c62032a671d583f79e8cff5e02b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
- case type.to_s
- when 'revert'
  - label = s_('ChangeTypeAction|Revert')
  - branch_label = s_('ChangeTypeActionLabel|Revert in branch')
  - revert_merge_request = _('Revert this merge request')
  - revert_commit = _('Revert this commit')
  - description = s_('ChangeTypeAction|This will create a new commit in order to revert the existing changes.')
  - title = commit.merged_merge_request(current_user) ? revert_merge_request : revert_commit

  - if defined?(pajamas)
    .js-revert-commit-modal{ data: { title: title,
      endpoint: revert_namespace_project_commit_path(commit, namespace_id: @project.namespace.full_path, project_id: @project),
      branch: @project.default_branch,
      push_code: can?(current_user, :push_code, @project).to_s,
      branch_collaboration: @project.branch_allows_collaboration?(current_user, selected_branch).to_s,
      existing_branch: ERB::Util.html_escape(selected_branch),
      branches_endpoint: project_branches_path(@project) } }
  - else
    = render "projects/commit/commit_modal", title: title, type: type, commit: commit, branch_label: branch_label, description: description, label: label

- when 'cherry-pick'
  - label = s_('ChangeTypeAction|Cherry-pick')
  - branch_label = s_('ChangeTypeActionLabel|Pick into branch')
  - title = commit.merged_merge_request(current_user) ? _('Cherry-pick this merge request') : _('Cherry-pick this commit')

  - if defined?(pajamas)
    .js-cherry-pick-commit-modal{ data: { title: title,
      endpoint: cherry_pick_namespace_project_commit_path(commit, namespace_id: @project.namespace.full_path, project_id: @project),
      branch: @project.default_branch,
      push_code: can?(current_user, :push_code, @project).to_s,
      branch_collaboration: @project.branch_allows_collaboration?(current_user, selected_branch).to_s,
      existing_branch: ERB::Util.html_escape(selected_branch),
      branches_endpoint: project_branches_path(@project) } }
  - else
    = render "projects/commit/commit_modal", title: title, type: type, commit: commit, branch_label: branch_label, description: description, label: label