- form = local_assigns.fetch(:f)
- commits = local_assigns[:commits]
- project = @target_project || @project

= form_errors(issuable)

- 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

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

  = render 'shared/issuable/form/template_selector', issuable: issuable
  = render 'shared/issuable/form/title', issuable: issuable, form: form, has_wip_commits: commits && commits.detect(&:work_in_progress?)

= render 'shared/issuable/form/description', issuable: issuable, form: form

- if issuable.respond_to?(:confidential)
  .form-group
    .col-sm-offset-2.col-sm-10
      .checkbox
        = form.label :confidential do
          = form.check_box :confidential
          This issue is confidential and should only be visible to team members with at least Reporter access.

= render 'shared/issuable/form/metadata', issuable: issuable, form: form

- 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
        = 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 }
      &nbsp;
      %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')

= render 'shared/issuable/form/branch_chooser', issuable: issuable, form: form

= render 'shared/issuable/form/merge_params', issuable: issuable

- if @merge_request_for_resolving_discussions
  .form-group
    .col-sm-10.col-sm-offset-2
      - if @merge_request_for_resolving_discussions.discussions_can_be_resolved_by?(current_user)
        = icon('exclamation-triangle')
        Creating this issue will mark all discussions in
        = link_to @merge_request_for_resolving_discussions.to_reference, merge_request_path(@merge_request_for_resolving_discussions)
        as resolved.
        = hidden_field_tag 'merge_request_for_resolving_discussions', @merge_request_for_resolving_discussions.iid
      - else
        = icon('exclamation-triangle')
        You can't automatically mark all discussions in
        = link_to @merge_request_for_resolving_discussions.to_reference, merge_request_path(@merge_request_for_resolving_discussions)
        as resolved. Ask someone with sufficient rights to resolve the them.

- is_footer = !(issuable.is_a?(MergeRequest) && issuable.new_record?)
.row-content-block{ class: (is_footer ? "footer-block" : "middle-block") }
  - if issuable.new_record?
    = form.submit "Submit #{issuable.class.model_name.human.downcase}", class: 'btn btn-create'
  - else
    = form.submit 'Save changes', class: 'btn btn-save'

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

  - if issuable.new_record?
    = link_to 'Cancel', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable.class]), class: 'btn btn-cancel'
  - else
    .pull-right
      - if can?(current_user, :"destroy_#{issuable.to_ability_name}", @project)
        = link_to 'Delete', polymorphic_path([@project.namespace.becomes(Namespace), @project, issuable]), data: { confirm: "#{issuable.human_class_name} 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'

= form.hidden_field :lock_version
