_issuable_form.html.haml 4.53 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 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
        - if issuable.work_in_progress?
18 19
          Remove the <code>WIP</code> prefix from the title to allow this 
          <strong>Work In Progress</strong> merge request to be accepted when it's ready.
20
        - else
21 22
          Start the title with <code>[WIP]</code> or <code>WIP:</code> to prevent a 
          <strong>Work In Progress</strong> merge request from being accepted 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: "wiki", referenced_users: true } 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
          selected: issuable.assignee_id, project: @target_project || @project)
50 51 52 53 54
      &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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
- if issuable.is_a?(MergeRequest)
  %hr
    - unless @merge_request.persisted?
      .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 })
          %p.help-block
          = link_to 'Change source branch', mr_change_branches_path(@merge_request)
  .form-group
    = f.label :target_branch, class: 'control-label' do
      %i.fa.fa-code-fork
      Target Branch
    .col-sm-10
      = f.select(:target_branch, @merge_request.target_branches, { include_blank: "Select branch" }, { class: 'target_branch select2 span2' })

100
.form-actions
101
  - if !issuable.project.empty_repo? && (guide_url = contribution_guide_url(issuable.project)) && !issuable.persisted?
102 103
    %p
      Please review the
104
      %strong #{link_to 'guidelines for contribution', guide_url}
105
      to this repository.
106 107 108 109 110 111 112 113
  - 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
114
  = link_to 'Cancel', [cancel_project.namespace.becomes(Namespace), cancel_project, issuable], class: 'btn btn-cancel'