debian-mirror-gitlab/app/views/shared/issuable/_form.html.haml

172 lines
9 KiB
Text
Raw Normal View History

2016-11-03 12:29:30 +05:30
- project = @target_project || @project
2016-06-02 11:05:42 +05:30
= form_errors(issuable)
2016-09-29 09:46:39 +05:30
- 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
2015-09-11 14:41:01 +05:30
.form-group
2015-12-23 02:04:40 +05:30
= f.label :title, class: 'control-label'
2016-09-13 17:45:13 +05:30
- issuable_template_names = issuable_templates(issuable)
- if issuable_template_names.any?
.col-sm-3.col-lg-2
.js-issuable-selector-wrap{ data: { issuable_type: issuable.class.to_s.underscore.downcase } }
- title = selected_template(issuable) || "Choose a template"
= dropdown_tag(title, options: { toggle_class: 'js-issuable-selector',
title: title, filter: true, placeholder: 'Filter', footer_content: true,
2016-09-29 09:46:39 +05:30
data: { data: issuable_template_names, field_name: 'issuable_template', selected: selected_template(issuable), project_path: ref_project.path, namespace_path: ref_project.namespace.path } } ) do
2016-09-13 17:45:13 +05:30
%ul.dropdown-footer-list
%li
2016-11-03 12:29:30 +05:30
%a.no-template
No template
2016-09-13 17:45:13 +05:30
%a.reset-template
Reset template
%div{ class: issuable_template_names.any? ? 'col-sm-7 col-lg-8' : 'col-sm-10' }
2015-09-25 12:07:36 +05:30
= f.text_field :title, maxlength: 255, autofocus: true, autocomplete: 'off',
2016-06-02 11:05:42 +05:30
class: 'form-control pad', required: true
2015-09-11 14:41:01 +05:30
- if issuable.is_a?(MergeRequest)
%p.help-block
2016-06-02 11:05:42 +05:30
.js-wip-explanation
%a.js-toggle-wip{href: "", tabindex: -1}
Remove the
%code WIP:
prefix from the title
to allow this
%strong Work In Progress
merge request to be merged when it's ready.
.js-no-wip-explanation
%a.js-toggle-wip{href: "", tabindex: -1}
Start the title with
%code WIP:
to prevent a
%strong Work In Progress
merge request from being merged before it's ready.
2016-09-13 17:45:13 +05:30
- if can_add_template?(issuable)
%p.help-block
Add
= link_to "description templates", help_page_path('user/project/description_templates'), tabindex: -1
to help your contributors communicate effectively!
2015-12-23 02:04:40 +05:30
.form-group.detail-page-description
2015-09-11 14:41:01 +05:30
= f.label :description, 'Description', class: 'control-label'
.col-sm-10
2015-09-25 12:07:36 +05:30
= render layout: 'projects/md_preview', locals: { preview_class: "md-preview", referenced_users: true } do
2015-09-11 14:41:01 +05:30
= render 'projects/zen', f: f, attr: :description,
2016-06-02 11:05:42 +05:30
classes: 'note-textarea',
2016-09-13 17:45:13 +05:30
placeholder: "Write a comment or drag your files here...",
supports_slash_commands: !issuable.persisted?
= render 'projects/notes/hints', supports_slash_commands: !issuable.persisted?
2015-09-11 14:41:01 +05:30
.clearfix
.error-alert
2016-06-02 11:05:42 +05:30
- if issuable.is_a?(Issue)
2016-06-02 11:05:42 +05:30
.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 with at least Reporter access.
2016-06-02 11:05:42 +05:30
2015-09-11 14:41:01 +05:30
- if can?(current_user, :"admin_#{issuable.to_ability_name}", issuable.project)
- has_due_date = issuable.has_attribute?(:due_date)
2015-12-23 02:04:40 +05:30
%hr
.row
%div{ class: (has_due_date ? "col-lg-6" : "col-sm-12") }
.form-group.issue-assignee
= f.label :assignee_id, "Assignee", class: "control-label #{"col-lg-4" if has_due_date}"
.col-sm-10{ class: ("col-lg-8" if has_due_date) }
2016-06-02 11:05:42 +05:30
.issuable-form-select-holder
2016-11-03 12:29:30 +05:30
- if issuable.assignee_id
= f.hidden_field :assignee_id
= 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",
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"} })
.form-group.issue-milestone
= f.label :milestone_id, "Milestone", class: "control-label #{"col-lg-4" if has_due_date}"
.col-sm-10{ class: ("col-lg-8" if has_due_date) }
2016-11-03 12:29:30 +05:30
.issuable-form-select-holder
= 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"
.form-group
2016-11-03 12:29:30 +05:30
- has_labels = @labels && @labels.any?
= f.label :label_ids, "Labels", class: "control-label #{"col-lg-4" if has_due_date}"
2016-11-03 12:29:30 +05:30
= f.hidden_field :label_ids, multiple: true, value: ''
.col-sm-10{ class: "#{"col-lg-8" if has_due_date} #{'issuable-form-padding-top' if !has_labels}" }
2016-11-03 12:29:30 +05:30
.issuable-form-select-holder
= 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"
- if has_due_date
.col-lg-6
.form-group
= f.label :due_date, "Due date", class: "control-label"
.col-sm-10
.issuable-form-select-holder
= f.text_field :due_date, id: "issuable-due-date", class: "datepicker form-control", placeholder: "Select due date"
2015-09-11 14:41:01 +05:30
2016-06-02 11:05:42 +05:30
- if issuable.can_move?(current_user)
%hr
.form-group
= label_tag :move_to_project_id, 'Move', class: 'control-label'
.col-sm-10
.issuable-form-select-holder
2016-09-29 09:46:39 +05:30
= 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 }
2016-06-02 11:05:42 +05:30
 
%span{ data: { toggle: 'tooltip', placement: 'auto top' }, style: 'cursor: default',
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.' }
= icon('question-circle')
2016-09-29 09:46:39 +05:30
- if issuable.is_a?(MergeRequest) && !issuable.closed_without_fork?
2015-09-11 14:41:01 +05:30
%hr
2016-06-02 11:05:42 +05:30
- if @merge_request.new_record?
.form-group
= f.label :source_branch, class: 'control-label'
.col-sm-10
.issuable-form-select-holder
2015-09-11 14:41:01 +05:30
= f.select(:source_branch, [@merge_request.source_branch], { }, { class: 'source_branch select2 span2', disabled: true })
.form-group
2015-12-23 02:04:40 +05:30
= f.label :target_branch, class: 'control-label'
2015-09-11 14:41:01 +05:30
.col-sm-10
2016-06-02 11:05:42 +05:30
.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"} })
2015-09-11 14:41:01 +05:30
- if @merge_request.new_record?
2016-06-02 11:05:42 +05:30
 
2015-09-11 14:41:01 +05:30
= link_to 'Change branches', mr_change_branches_path(@merge_request)
2016-06-02 11:05:42 +05:30
- 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
2016-11-24 13:41:30 +05:30
= hidden_field_tag 'merge_request[force_remove_source_branch]', '0', id: nil
2016-06-02 11:05:42 +05:30
= check_box_tag 'merge_request[force_remove_source_branch]', '1', @merge_request.force_remove_source_branch?
Remove source branch when merge request is accepted.
2015-09-11 14:41:01 +05:30
2015-12-23 02:04:40 +05:30
- is_footer = !(issuable.is_a?(MergeRequest) && issuable.new_record?)
2016-06-02 11:05:42 +05:30
.row-content-block{class: (is_footer ? "footer-block" : "middle-block")}
2015-09-11 14:41:01 +05:30
- if issuable.new_record?
2015-12-23 02:04:40 +05:30
= f.submit "Submit #{issuable.class.model_name.human.downcase}", class: 'btn btn-create'
2015-09-11 14:41:01 +05:30
- else
= f.submit 'Save changes', class: 'btn btn-save'
2015-12-23 02:04:40 +05:30
- 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.
2015-09-11 14:41:01 +05:30
- if issuable.new_record?
2016-06-02 11:05:42 +05:30
= link_to 'Cancel', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable.class]), class: 'btn btn-cancel'
2015-09-11 14:41:01 +05:30
- else
2016-06-02 11:05:42 +05:30
.pull-right
2016-09-29 09:46:39 +05:30
- if can?(current_user, :"destroy_#{issuable.to_ability_name}", @project)
2016-06-02 11:05:42 +05:30
= 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'
= link_to 'Cancel', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable]), class: 'btn btn-grouped btn-cancel'
2016-09-29 09:46:39 +05:30
= f.hidden_field :lock_version