summaryrefslogtreecommitdiff
path: root/app/views/shared/notes/_form.html.haml
blob: 7080f38dfd151b9a3a1c6641b67cfb96afca49c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
- supports_autocomplete = local_assigns.fetch(:supports_autocomplete, true)
- supports_slash_commands = note_supports_slash_commands?(@note)
- if supports_slash_commands
  - preview_url = preview_markdown_path(@project, slash_commands_target_type: @note.noteable_type, slash_commands_target_id: @note.noteable_id)
- else
  - preview_url = preview_markdown_path(@project)

= form_for form_resources, url: new_form_url, remote: true, html: { :'data-type' => 'json', multipart: true, id: nil, class: "new-note js-new-note-form js-quick-submit common-note-form", "data-noteable-iid" => @note.noteable.try(:iid), }, authenticity_token: true do |f|
  = hidden_field_tag :view, diff_view
  = hidden_field_tag :line_type
  = hidden_field_tag :merge_request_diff_head_sha, @note.noteable.try(:diff_head_sha)
  = hidden_field_tag :in_reply_to_discussion_id

  = note_target_fields(@note)
  = f.hidden_field :noteable_type
  = f.hidden_field :noteable_id
  = f.hidden_field :commit_id
  = f.hidden_field :type

  -# LegacyDiffNote
  = f.hidden_field :line_code

  -# DiffNote
  = f.hidden_field :position

  = render layout: 'projects/md_preview', locals: { url: preview_url, referenced_users: true } do
    = render 'projects/zen', f: f,
      attr: :note,
      classes: 'note-textarea js-note-text',
      placeholder: "Write a comment or drag your files here...",
      supports_slash_commands: supports_slash_commands,
      supports_autocomplete: supports_autocomplete
    = render 'shared/notes/hints', supports_slash_commands: supports_slash_commands
    .error-alert

  .note-form-actions.clearfix
    = render partial: 'shared/notes/comment_button'

    = yield(:note_actions)

    %a.btn.btn-cancel.js-note-discard{ role: "button", data: {cancel_text: "Cancel" } }
      Discard draft