Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-29 23:56:50 +0300
committerRobert Speicher <rspeicher@gmail.com>2015-05-06 19:58:27 +0300
commit922497560eb7d619a6064d7b1d44c831ccd64ea9 (patch)
treef55998a6c82fdd8f2cd0b368df096091871dd40b
parenta3d55db91053955a36c6a48c9ad596752a3aba40 (diff)
Update task list behavior for Notes
-rw-r--r--app/assets/javascripts/notes.js.coffee17
-rw-r--r--app/views/projects/notes/_edit_form.html.haml5
-rw-r--r--app/views/projects/notes/_note.html.haml2
3 files changed, 20 insertions, 4 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 6dfe10f0006..416218d2e00 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -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()
diff --git a/app/views/projects/notes/_edit_form.html.haml b/app/views/projects/notes/_edit_form.html.haml
index acb3991d294..d2c0933f8bb 100644
--- a/app/views/projects/notes/_edit_form.html.haml
+++ b/app/views/projects/notes/_edit_form.html.haml
@@ -1,9 +1,8 @@
.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 }}
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index 0728f8fa42b..203ab816e43 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -50,7 +50,7 @@
\-1
- .note-body
+ .note-body.js-task-list-container
.note-text
= preserve do
= markdown(note.note, {no_header_anchors: true})