BigW Consortium Gitlab

_form.html.haml 6.33 KB
Newer Older
1 2
= form_errors(issuable)

3
.form-group
4
  = f.label :title, class: 'control-label'
5
  .col-sm-10
6
    = f.text_field :title, maxlength: 255, autofocus: true, autocomplete: 'off',
7
        class: 'form-control pad', required: true
8 9

    - if issuable.is_a?(MergeRequest)
10
      %p.help-block
11
        .js-wip-explanation
12
          %a.js-toggle-wip{href: "", tabindex: -1}
13 14 15
            Remove the
            %code WIP:
            prefix from the title
16
          to allow this
17 18
          %strong Work In Progress
          merge request to be merged when it's ready.
19
        .js-no-wip-explanation
20
          %a.js-toggle-wip{href: "", tabindex: -1}
21 22
            Start the title with
            %code WIP:
23
          to prevent a
24 25
          %strong Work In Progress
          merge request from being merged before it's ready.
26
.form-group.detail-page-description
27 28
  = f.label :description, 'Description', class: 'control-label'
  .col-sm-10
29

30
    = render layout: 'projects/md_preview', locals: { preview_class: "md-preview", referenced_users: true } do
31
      = render 'projects/zen', f: f, attr: :description,
32 33
                               classes: 'note-textarea',
                               placeholder: "Write a comment or drag your files here..."
34
      = render 'projects/notes/hints'
35 36
      .clearfix
      .error-alert
37 38 39 40 41 42 43 44 45

- if issuable.is_a?(Issue) && !issuable.project.private?
  .form-group
    .col-sm-offset-2.col-sm-10
      .checkbox
        = f.label :confidential do
          = f.check_box :confidential
          This issue is confidential and should only be visible to team members

46
- if can?(current_user, :"admin_#{issuable.to_ability_name}", issuable.project)
47
  %hr
48 49
  .form-group
    .issue-assignee
50
      = f.label :assignee_id, "Assignee", class: 'control-label'
51
      .col-sm-10
Phil Hughes committed
52 53 54 55 56
        .issuable-form-select-holder
          = users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]",
              placeholder: 'Select assignee', class: 'custom-form-control', null_user: true,
              selected: issuable.assignee_id, project: @target_project || @project,
              first_user: true, current_user: true, include_blank: true)
57 58 59 60
         
        = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
  .form-group
    .issue-milestone
61
      = f.label :milestone_id, "Milestone", class: 'control-label'
62 63
      .col-sm-10
        - if milestone_options(issuable).present?
Phil Hughes committed
64 65 66
          .issuable-form-select-holder
            = f.select(:milestone_id, milestone_options(issuable),
              { include_blank: true }, { class: 'select2', data: { placeholder: 'Select milestone' } })
67 68 69 70 71 72 73
        - else
          .prepend-top-10
          %span.light No open milestones available.
         
        - if can? current_user, :admin_milestone, issuable.project
          = link_to 'Create new milestone', new_namespace_project_milestone_path(issuable.project.namespace, issuable.project), target: :blank
  .form-group
74
    - has_labels = issuable.project.labels.any?
75
    = f.label :label_ids, "Labels", class: 'control-label'
76 77
    .col-sm-10{ class: ('issuable-form-padding-top' if !has_labels) }
      - if has_labels
78 79 80
        .issuable-form-select-holder
          = f.collection_select :label_ids, issuable.project.labels.all, :id, :name,
            { selected: issuable.label_ids }, multiple: true, class: 'select2', data: { placeholder: "Select labels" }
81
      - else
82
        %span.light No labels yet.
83
       
84 85
      - if can? current_user, :admin_label, issuable.project
        = link_to 'Create new label', new_namespace_project_label_path(issuable.project.namespace, issuable.project), target: :blank
Dmitriy Zaporozhets committed
86

87
- if issuable.can_move?(current_user)
88
  %hr
89 90 91
  .form-group
    = label_tag :move_to_project_id, 'Move', class: 'control-label'
    .col-sm-10
92 93 94 95
      .issuable-form-select-holder
        - projects = project_options(issuable, current_user, ability: :admin_issue)
        = select_tag(:move_to_project_id, projects, include_blank: true,
                     class: 'select2', data: { placeholder: 'Select project' })
96
       
97
      %span{ data: { toggle: 'tooltip', placement: 'auto top' }, style: 'cursor: default',
98
      title: 'Moving an issue will copy the discussion to a different project and close it here. All participants will be notified of the new location.' }
99
        = icon('question-circle')
100

101 102
- if issuable.is_a?(MergeRequest)
  %hr
103 104 105 106
  - if @merge_request.new_record?
    .form-group
      = f.label :source_branch, class: 'control-label'
      .col-sm-10
107 108
        .issuable-form-select-holder
          = f.select(:source_branch, [@merge_request.source_branch], { }, { class: 'source_branch select2 span2', disabled: true })
109
  .form-group
110
    = f.label :target_branch, class: 'control-label'
111
    .col-sm-10
112 113
      .issuable-form-select-holder
        = f.select(:target_branch, @merge_request.target_branches, { include_blank: true }, { class: 'target_branch select2 span2', disabled: @merge_request.new_record?, data: {placeholder: "Select branch"} })
114
      - if @merge_request.new_record?
115
         
116
        = link_to 'Change branches', mr_change_branches_path(@merge_request)
117

118
- is_footer = !(issuable.is_a?(MergeRequest) && issuable.new_record?)
119
.row-content-block{class: (is_footer ? "footer-block" : "middle-block")}
120
  - if issuable.new_record?
121
    = f.submit "Submit #{issuable.class.model_name.human.downcase}", class: 'btn btn-create'
122 123
  - else
    = f.submit 'Save changes', class: 'btn btn-save'
124 125 126 127 128 129 130

  - if !issuable.persisted? && !issuable.project.empty_repo? && (guide_url = contribution_guide_path(issuable.project))
    .inline.prepend-left-10
      Please review the
      %strong #{link_to 'contribution guidelines', guide_url}
      for this project.

131
  - if issuable.new_record?
Alfredo Sumaran committed
132
    = link_to 'Cancel', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable.class]), class: 'btn btn-cancel'
133
  - else
134 135
    .pull-right
      - if current_user.can?(:"destroy_#{issuable.to_ability_name}", @project)
136 137
        = link_to 'Delete', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable]), data: { confirm: "#{issuable.class.name.titleize} will be removed! Are you sure?" },
                                                                                                  method: :delete, class: 'btn btn-danger btn-grouped'
138
      = link_to 'Cancel', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable]), class: 'btn btn-grouped btn-cancel'