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

    - if issuable.is_a?(MergeRequest)
16
      %p.help-block
17 18 19 20
        - if issuable.work_in_progress?
          This merge request is marked a <strong>Work In Progress</strong>.
          When it's ready, remove the <code>WIP</code> prefix from the title to allow it to be accepted.
        - else
Douwe Maan's avatar
Douwe Maan committed
21
          To prevent this merge request from being accepted before it's ready, 
22
          mark it a <strong>Work In Progress</strong> by starting the title with <code>[WIP]</code> or <code>WIP:</code>.
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: "wiki" } do
28 29 30 31 32 33 34
      = render 'projects/zen', f: f, attr: :description,
                               classes: 'description form-control'
      .col-sm-12.hint
        .pull-left
          Parsed with
          #{link_to 'GitLab Flavored Markdown', help_page_path('markdown', 'markdown'), target: '_blank'}.
        .pull-right
35
          Attach files by dragging &amp; dropping
36 37 38 39
          or #{link_to 'selecting them', '#', class: 'markdown-selector' }.

      .clearfix
      .error-alert
40 41 42 43
%hr
.form-group
  .issue-assignee
    = f.label :assignee_id, class: 'control-label' do
44
      %i.fa.fa-user
45 46
      Assign to
    .col-sm-10
47
      = users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]",
48
          placeholder: 'Select a user', class: 'custom-form-control', null_user: true,
49 50 51 52 53 54
          selected: issuable.assignee_id)
      &nbsp;
      = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
.form-group
  .issue-milestone
    = f.label :milestone_id, class: 'control-label' do
55
      %i.fa.fa-clock-o
56
      Milestone
57 58 59 60 61
    .col-sm-10
      - if milestone_options(issuable).present?
        = f.select(:milestone_id, milestone_options(issuable),
          { include_blank: 'Select milestone' }, { class: 'select2' })
      - else
62
        .prepend-top-10
63 64
        %span.light No open milestones available.
      &nbsp;
65
      - if can? current_user, :admin_milestone, issuable.project
Vinnie Okada's avatar
Vinnie Okada committed
66
        = link_to 'Create new milestone', new_namespace_project_milestone_path(issuable.project.namespace, issuable.project), target: :blank
67 68
.form-group
  = f.label :label_ids, class: 'control-label' do
69
    %i.fa.fa-tag
70 71
    Labels
  .col-sm-10
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
72 73
    - if issuable.project.labels.any?
      = f.collection_select :label_ids, issuable.project.labels.all, :id, :name,
74
        { selected: issuable.label_ids }, multiple: true, class: 'select2'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
75
    - else
76
      .prepend-top-10
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
77 78
      %span.light No labels yet.
    &nbsp;
79
    - if can? current_user, :admin_label, issuable.project
Vinnie Okada's avatar
Vinnie Okada committed
80
      = link_to 'Create new label', new_namespace_project_label_path(issuable.project.namespace, issuable.project), target: :blank
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
81

82
.form-actions
83
  - if !issuable.project.empty_repo? && (guide_url = contribution_guide_url(issuable.project)) && !issuable.persisted?
84 85
    %p
      Please review the
86
      %strong #{link_to 'guidelines for contribution', guide_url}
87
      to this repository.
88 89 90 91 92 93 94 95
  - 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
96
  = link_to 'Cancel', [cancel_project.namespace.becomes(Namespace), cancel_project, issuable], class: 'btn btn-cancel'