Commit 92249756 authored by Robert Speicher's avatar Robert Speicher

Update task list behavior for Notes

parent a3d55db9
......@@ -11,6 +11,7 @@ class @Notes
@setupMainTargetNoteForm()
@cleanBinding()
@addBinding()
@initTaskList()
addBinding: ->
# add note to UI after creation
......@@ -81,6 +82,9 @@ class @Notes
$(document).off "click", ".js-note-target-reopen"
$(document).off "click", ".js-note-target-close"
$('.note .js-task-list-container').taskList('disable')
$(document).off 'tasklist:changed', '.note .js-task-list-container'
initRefresh: ->
clearInterval(Notes.interval)
Notes.interval = setInterval =>
......@@ -114,6 +118,7 @@ class @Notes
if @isNewNote(note)
@note_ids.push(note.id)
$('ul.main-notes-list').append(note.html)
@initTaskList()
###
Check if note does not exists on page
......@@ -268,6 +273,8 @@ class @Notes
note_li.replaceWith(note.html)
note_li.find('.note-edit-form').hide()
note_li.find('.note-body > .note-text').show()
note_li.find('js-task-list-container').taskList('enable')
@enableTaskList()
###
Called in response to clicking the edit note link
......@@ -479,3 +486,13 @@ class @Notes
else
form.find('.js-note-target-reopen').text('Reopen')
form.find('.js-note-target-close').text('Close')
enableTaskList: ->
$('.note .js-task-list-container').taskList('enable')
initTaskList: ->
@enableTaskList()
$(document).on 'tasklist:changed', '.note .js-task-list-container', @updateTaskList
updateTaskList: ->
$('form', this).submit()
.note-edit-form
= form_for note, url: namespace_project_note_path(@project.namespace, @project, note), method: :put, remote: true, authenticity_token: true do |f|
= note_target_fields(note)
= render layout: 'projects/md_preview', locals: { preview_class: "note-text" } do
= render 'projects/zen', f: f, attr: :note,
classes: 'note_text js-note-text'
= render layout: 'projects/md_preview', locals: { preview_class: 'note-text' } do
= render 'projects/zen', f: f, attr: :note, classes: 'note_text js-note-text js-task-list-field'
.comment-hints.clearfix
.pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }}
......
......@@ -50,7 +50,7 @@
\-1
.note-body
.note-body.js-task-list-container
.note-text
= preserve do
= markdown(note.note, {no_header_anchors: true})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment