_form.html.haml 4.58 KB
Newer Older
1 2
- if issuable.errors.any?
  .row
3
    .col-sm-offset-2.col-sm-10
4 5 6 7
      .alert.alert-danger
        - issuable.errors.full_messages.each do |msg|
          %span= msg
          %br
8 9 10 11
.form-group
  = f.label :title, class: 'control-label' do
    %strong= 'Title *'
  .col-sm-10
12
    = f.text_field :title, maxlength: 255, autofocus: true, autocomplete: 'off',
13
        class: 'form-control pad js-gfm-input js-quick-submit', required: true
14 15

    - if issuable.is_a?(MergeRequest)
16
      %p.help-block
17
        - if issuable.work_in_progress?
18
          Remove the <code>WIP</code> prefix from the title to allow this
19
          <strong>Work In Progress</strong> merge request to be merged when it's ready.
20
        - else
21
          Start the title with <code>[WIP]</code> or <code>WIP:</code> to prevent a
22
          <strong>Work In Progress</strong> merge request from being merged before it's ready.
23
.form-group.issuable-description
24 25
  = f.label :description, 'Description', class: 'control-label'
  .col-sm-10
26

27
    = render layout: 'projects/md_preview', locals: { preview_class: "md-preview", referenced_users: true } do
28
      = render 'projects/zen', f: f, attr: :description,
29
                               classes: 'description form-control js-quick-submit'
30
      = render 'projects/notes/hints'
31 32
      .clearfix
      .error-alert
33
  %hr
34
- if can?(current_user, :"admin_#{issuable.to_ability_name}", issuable.project)
35 36 37 38 39 40 41 42
  .form-group
    .issue-assignee
      = f.label :assignee_id, class: 'control-label' do
        %i.fa.fa-user
        Assign to
      .col-sm-10
        = users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]",
            placeholder: 'Select a user', class: 'custom-form-control', null_user: true,
43
            selected: issuable.assignee_id, project: @target_project || @project,
44
            first_user: true, current_user: true)
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
        &nbsp;
        = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
  .form-group
    .issue-milestone
      = f.label :milestone_id, class: 'control-label' do
        %i.fa.fa-clock-o
        Milestone
      .col-sm-10
        - if milestone_options(issuable).present?
          = f.select(:milestone_id, milestone_options(issuable),
            { include_blank: 'Select milestone' }, { class: 'select2' })
        - else
          .prepend-top-10
          %span.light No open milestones available.
        &nbsp;
        - 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
    = f.label :label_ids, class: 'control-label' do
      %i.fa.fa-tag
      Labels
66
    .col-sm-10
67 68 69
      - if issuable.project.labels.any?
        = f.collection_select :label_ids, issuable.project.labels.all, :id, :name,
          { selected: issuable.label_ids }, multiple: true, class: 'select2'
70
      - else
71
        .prepend-top-10
72
        %span.light No labels yet.
73
      &nbsp;
74 75
      - 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's avatar
Dmitriy Zaporozhets committed
76

77 78
- if issuable.is_a?(MergeRequest)
  %hr
79
    - if @merge_request.new_record?
80 81 82 83 84 85 86 87 88 89 90
      .form-group
        = f.label :source_branch, class: 'control-label' do
          %i.fa.fa-code-fork
          Source Branch
        .col-sm-10
          = f.select(:source_branch, [@merge_request.source_branch], { }, { class: 'source_branch select2 span2', disabled: true })
  .form-group
    = f.label :target_branch, class: 'control-label' do
      %i.fa.fa-code-fork
      Target Branch
    .col-sm-10
91 92 93 94
      = f.select(:target_branch, @merge_request.target_branches, { include_blank: "Select branch" }, { class: 'target_branch select2 span2', disabled: @merge_request.new_record? })
      - if @merge_request.new_record?
        %p.help-block
        = link_to 'Change branches', mr_change_branches_path(@merge_request)
95

96
.form-actions
Douwe Maan's avatar
Douwe Maan committed
97
  - if !issuable.project.empty_repo? && (guide_url = contribution_guide_path(issuable.project)) && !issuable.persisted?
98 99
    %p
      Please review the
100
      %strong #{link_to 'guidelines for contribution', guide_url}
101
      to this repository.
102 103 104 105 106 107 108 109
  - if issuable.new_record?
    = f.submit "Submit new #{issuable.class.model_name.human.downcase}", class: 'btn btn-create'
  - else
    = f.submit 'Save changes', class: 'btn btn-save'
  - if issuable.new_record?
    - cancel_project = issuable.source_project
  - else
    - cancel_project = issuable.project
Vinnie Okada's avatar
Vinnie Okada committed
110
  = link_to 'Cancel', [cancel_project.namespace.becomes(Namespace), cancel_project, issuable], class: 'btn btn-cancel'