_form.html.haml 7.42 KB
Newer Older
1
- form = local_assigns.fetch(:f)
2
- project = @target_project || @project
3

4 5
= form_errors(issuable)

6 7 8 9 10 11 12
- if @conflict
  .alert.alert-danger
    Someone edited the #{issuable.class.model_name.human.downcase} the same time you did.
    Please check out
    = link_to "the #{issuable.class.model_name.human.downcase}", polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable]), target: "_blank"
    and make sure your changes will not unintentionally remove theirs

13
.form-group
14
  = form.label :title, class: 'control-label'
15

16
  = render 'shared/issuable/form/template_selector', issuable: issuable
17
  = render 'shared/issuable/form/title', issuable: issuable, form: form
18

19
.form-group.detail-page-description
20
  = form.label :description, 'Description', class: 'control-label'
21
  .col-sm-10
22

23
    = render layout: 'projects/md_preview', locals: { preview_class: "md-preview", referenced_users: true } do
24
      = render 'projects/zen', f: form, attr: :description,
25
                               classes: 'note-textarea',
26 27
                               placeholder: "Write a comment or drag your files here...",
                               supports_slash_commands: !issuable.persisted?
28
      = render 'projects/notes/hints', supports_slash_commands: !issuable.persisted?
29 30
      .clearfix
      .error-alert
31

32
- if issuable.is_a?(Issue)
33 34 35
  .form-group
    .col-sm-offset-2.col-sm-10
      .checkbox
36 37
        = form.label :confidential do
          = form.check_box :confidential
38
          This issue is confidential and should only be visible to team members with at least Reporter access.
39

40
- if can?(current_user, :"admin_#{issuable.to_ability_name}", issuable.project)
41
  - has_due_date = issuable.has_attribute?(:due_date)
42
  %hr
43 44 45
  .row
    %div{ class: (has_due_date ? "col-lg-6" : "col-sm-12") }
      .form-group.issue-assignee
46
        = form.label :assignee_id, "Assignee", class: "control-label #{"col-lg-4" if has_due_date}"
47
        .col-sm-10{ class: ("col-lg-8" if has_due_date) }
Phil Hughes's avatar
Phil Hughes committed
48
          .issuable-form-select-holder
49
            - if issuable.assignee_id
50
              = form.hidden_field :assignee_id
51
            = dropdown_tag(user_dropdown_label(issuable.assignee_id, "Assignee"), options: { toggle_class: "js-dropdown-keep-input js-user-search js-issuable-form-dropdown js-assignee-search", title: "Select assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit",
52
              placeholder: "Search assignee", data: { first_user: current_user.try(:username), null_user: true, current_user: true, project_id: project.try(:id), selected: issuable.assignee_id, field_name: "#{issuable.class.model_name.param_key}[assignee_id]", default_label: "Assignee"} })
53
      .form-group.issue-milestone
54
        = form.label :milestone_id, "Milestone", class: "control-label #{"col-lg-4" if has_due_date}"
55
        .col-sm-10{ class: ("col-lg-8" if has_due_date) }
56
          .issuable-form-select-holder
57
            = render "shared/issuable/milestone_dropdown", selected: issuable.milestone, name: "#{issuable.class.model_name.param_key}[milestone_id]", show_any: false, show_upcoming: false, extra_class: "js-issuable-form-dropdown js-dropdown-keep-input", dropdown_title: "Select milestone"
58
      .form-group
59
        - has_labels = @labels && @labels.any?
60 61
        = form.label :label_ids, "Labels", class: "control-label #{"col-lg-4" if has_due_date}"
        = form.hidden_field :label_ids, multiple: true, value: ''
62
        .col-sm-10{ class: "#{"col-lg-8" if has_due_date} #{'issuable-form-padding-top' if !has_labels}" }
63
          .issuable-form-select-holder
64
            = render "shared/issuable/label_dropdown", classes: ["js-issuable-form-dropdown"], selected: issuable.labels, data_options: { field_name: "#{issuable.class.model_name.param_key}[label_ids][]", show_any: false}, dropdown_title: "Select label"
Phil Hughes's avatar
Phil Hughes committed
65
    - if has_due_date
66 67
      .col-lg-6
        .form-group
68
          = form.label :due_date, "Due date", class: "control-label"
69
          .col-sm-10
70
            .issuable-form-select-holder
71
              = form.text_field :due_date, id: "issuable-due-date", class: "datepicker form-control", placeholder: "Select due date"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
72

73
- if issuable.can_move?(current_user)
74
  %hr
75 76 77
  .form-group
    = label_tag :move_to_project_id, 'Move', class: 'control-label'
    .col-sm-10
78
      .issuable-form-select-holder
79
        = hidden_field_tag :move_to_project_id, nil, class: 'js-move-dropdown', data: { placeholder: 'Select project', projects_url: autocomplete_projects_path(project_id: @project.id), page_size: MoveToProjectFinder::PAGE_SIZE }
80
       
81
      %span{ data: { toggle: 'tooltip', placement: 'auto top' }, style: 'cursor: default',
82
      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.' }
83
        = icon('question-circle')
84

Katarzyna Kobierska's avatar
Katarzyna Kobierska committed
85
- if issuable.is_a?(MergeRequest) && !issuable.closed_without_fork?
86
  %hr
87 88
  - if @merge_request.new_record?
    .form-group
89
      = form.label :source_branch, class: 'control-label'
90
      .col-sm-10
91
        .issuable-form-select-holder
92
          = form.select(:source_branch, [@merge_request.source_branch], { }, { class: 'source_branch select2 span2', disabled: true })
93
  .form-group
94
    = form.label :target_branch, class: 'control-label'
95
    .col-sm-10
96
      .issuable-form-select-holder
97
        = form.select(:target_branch, @merge_request.target_branches, { include_blank: true }, { class: 'target_branch select2 span2', disabled: @merge_request.new_record?, data: {placeholder: "Select branch"} })
98
      - if @merge_request.new_record?
99
         
100
        = link_to 'Change branches', mr_change_branches_path(@merge_request)
101 102 103 104 105
  - if @merge_request.can_remove_source_branch?(current_user)
    .form-group
      .col-sm-10.col-sm-offset-2
        .checkbox
          = label_tag 'merge_request[force_remove_source_branch]' do
106
            = hidden_field_tag 'merge_request[force_remove_source_branch]', '0', id: nil
107 108
            = check_box_tag 'merge_request[force_remove_source_branch]', '1', @merge_request.force_remove_source_branch?
            Remove source branch when merge request is accepted.
109

110
- is_footer = !(issuable.is_a?(MergeRequest) && issuable.new_record?)
Annabel Dunstone's avatar
Annabel Dunstone committed
111
.row-content-block{class: (is_footer ? "footer-block" : "middle-block")}
112
  - if issuable.new_record?
113
    = form.submit "Submit #{issuable.class.model_name.human.downcase}", class: 'btn btn-create'
114
  - else
115
    = form.submit 'Save changes', class: 'btn btn-save'
116 117 118 119 120 121 122

  - 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.

123
  - if issuable.new_record?
Alfredo Sumaran's avatar
Alfredo Sumaran committed
124
    = link_to 'Cancel', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable.class]), class: 'btn btn-cancel'
125
  - else
126
    .pull-right
127
      - if can?(current_user, :"destroy_#{issuable.to_ability_name}", @project)
Annabel Dunstone's avatar
Annabel Dunstone committed
128 129
        = 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'
130
      = link_to 'Cancel', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable]), class: 'btn btn-grouped btn-cancel'
131

132
= form.hidden_field :lock_version