diff options
author | Rémy Coutable <remy@rymai.me> | 2017-05-05 12:07:56 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-05-05 12:07:56 +0300 |
commit | 8b336ae124408566116c36d198264c9175bcbe9b (patch) | |
tree | 1132d797275e108624f008609f1321a679552d62 /app/views/projects/notes | |
parent | 8d059643f93f0d1b99ba153cf7321e905e7d43bb (diff) | |
parent | 45e4c665653cd511b0d96119d3973652c43238bb (diff) |
Merge branch 'adam-separate-slash-commands' into 'master'
Display slash commands outcome when previewing Markdown
Closes #21531
See merge request !10054
Diffstat (limited to 'app/views/projects/notes')
-rw-r--r-- | app/views/projects/notes/_edit_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/notes/_form.html.haml | 6 | ||||
-rw-r--r-- | app/views/projects/notes/_notes_with_form.html.haml | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/app/views/projects/notes/_edit_form.html.haml b/app/views/projects/notes/_edit_form.html.haml index a1efc0b051a..00230b0bdf8 100644 --- a/app/views/projects/notes/_edit_form.html.haml +++ b/app/views/projects/notes/_edit_form.html.haml @@ -2,7 +2,7 @@ = form_tag '#', method: :put, class: 'edit-note common-note-form js-quick-submit' do = hidden_field_tag :target_id, '', class: 'js-form-target-id' = hidden_field_tag :target_type, '', class: 'js-form-target-type' - = render layout: 'projects/md_preview', locals: { preview_class: 'md-preview', referenced_users: true } do + = render layout: 'projects/md_preview', locals: { url: preview_markdown_path(project), referenced_users: true } do = render 'projects/zen', attr: 'note[note]', classes: 'note-textarea js-note-text js-task-list-field', placeholder: "Write a comment or drag your files here..." = render 'projects/notes/hints' diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml index 0d835a9e949..46f785fefca 100644 --- a/app/views/projects/notes/_form.html.haml +++ b/app/views/projects/notes/_form.html.haml @@ -1,4 +1,8 @@ - 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 [@project.namespace.becomes(Namespace), @project, @note], 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 @@ -18,7 +22,7 @@ -# DiffNote = f.hidden_field :position - = render layout: 'projects/md_preview', locals: { preview_class: "md-preview", referenced_users: true } do + = 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', diff --git a/app/views/projects/notes/_notes_with_form.html.haml b/app/views/projects/notes/_notes_with_form.html.haml index 555228623cc..2a66addb08a 100644 --- a/app/views/projects/notes/_notes_with_form.html.haml +++ b/app/views/projects/notes/_notes_with_form.html.haml @@ -1,7 +1,7 @@ %ul#notes-list.notes.main-notes-list.timeline = render "shared/notes/notes" -= render 'projects/notes/edit_form' += render 'projects/notes/edit_form', project: @project %ul.notes.notes-form.timeline %li.timeline-entry |