summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-12-02 23:14:56 +0100
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-12-03 22:51:57 +0100
commitc20af32ae4adb1ec891e32ea048ae06ef4c7bc5f (patch)
tree7d1bdf0b12a850b0bbbd4efe043b474c3b73f898
parent6fc10fa2564538bb892090759fdb05604b0e5567 (diff)
downloadgitlab-ce-c20af32ae4adb1ec891e32ea048ae06ef4c7bc5f.tar.gz
Pull together and rename Notes partials
-rw-r--r--app/views/notes/_create_common_note.js.haml10
-rw-r--r--app/views/notes/_create_discussion_note.js.haml5
-rw-r--r--app/views/notes/_form.html.haml (renamed from app/views/notes/_common_form.html.haml)0
-rw-r--r--app/views/notes/_notes_with_form.html.haml4
-rw-r--r--app/views/notes/_reversed_notes_with_form.html.haml4
-rw-r--r--app/views/notes/create.js.haml18
-rw-r--r--app/views/notes/index.js.haml13
7 files changed, 24 insertions, 30 deletions
diff --git a/app/views/notes/_create_common_note.js.haml b/app/views/notes/_create_common_note.js.haml
deleted file mode 100644
index 7ea8c4cd8c7..00000000000
--- a/app/views/notes/_create_common_note.js.haml
+++ /dev/null
@@ -1,10 +0,0 @@
-- if note.valid?
- - if note.for_wall?
- NoteList.appendNewWallNote(#{note.id}, "#{escape_javascript(render "notes/note", note: note)}");
- - else
- NoteList.appendNewNote(#{note.id}, "#{escape_javascript(render "notes/note", note: note)}");
-
-- else
- -# TODO: insert form correctly
- $(".js-main-target-note").replaceWith("#{escape_javascript(render 'notes/common_form')}");
- GitLab.GfmAutoComplete.setup();
diff --git a/app/views/notes/_create_discussion_note.js.haml b/app/views/notes/_create_discussion_note.js.haml
deleted file mode 100644
index 3a6c3dad657..00000000000
--- a/app/views/notes/_create_discussion_note.js.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-- if note.valid?
- :plain
- NoteList.appendNewDiscussionNote("#{note.discussion_id}",
- "#{escape_javascript(render "notes/diff_notes_with_reply", notes: [note])}",
- "#{escape_javascript(render "notes/note", note: note)}");
diff --git a/app/views/notes/_common_form.html.haml b/app/views/notes/_form.html.haml
index 9d600447296..9d600447296 100644
--- a/app/views/notes/_common_form.html.haml
+++ b/app/views/notes/_form.html.haml
diff --git a/app/views/notes/_notes_with_form.html.haml b/app/views/notes/_notes_with_form.html.haml
index 2511cbe52c2..2566edd81ad 100644
--- a/app/views/notes/_notes_with_form.html.haml
+++ b/app/views/notes/_notes_with_form.html.haml
@@ -1,9 +1,9 @@
%ul#notes-list.notes
-.notes-status
+.js-notes-busy
.js-main-target-form
- if can? current_user, :write_note, @project
- = render "notes/common_form"
+ = render "notes/form"
:javascript
$(function(){
diff --git a/app/views/notes/_reversed_notes_with_form.html.haml b/app/views/notes/_reversed_notes_with_form.html.haml
index 6a7f08f9b90..bb583b8c3b8 100644
--- a/app/views/notes/_reversed_notes_with_form.html.haml
+++ b/app/views/notes/_reversed_notes_with_form.html.haml
@@ -1,10 +1,10 @@
.js-main-target-form
- if can? current_user, :write_note, @project
- = render "notes/common_form"
+ = render "notes/form"
%ul#new-notes-list.reversed.notes
%ul#notes-list.reversed.notes
-.notes-status
+.notes-busy.js-notes-busy
:javascript
$(function(){
diff --git a/app/views/notes/create.js.haml b/app/views/notes/create.js.haml
index 03aec54b018..6ffb0cdee0e 100644
--- a/app/views/notes/create.js.haml
+++ b/app/views/notes/create.js.haml
@@ -1,4 +1,16 @@
-- if note_for_main_target?(@note)
- = render "create_common_note", note: @note
+- if @note.valid?
+ var noteHtml = "#{escape_javascript(render "notes/note", note: @note)}";
+
+ - if note_for_main_target?(@note)
+ - if @note.for_wall?
+ NoteList.appendNewWallNote(#{@note.id}, noteHtml);
+ - else
+ NoteList.appendNewNote(#{@note.id}, noteHtml);
+ - else
+ var firstDiscussionNoteHtml = "#{escape_javascript(render "notes/diff_notes_with_reply", notes: [@note])}";
+ NoteList.appendNewDiscussionNote("#{@note.discussion_id}", firstDiscussionNoteHtml, noteHtml);
+
- else
- = render "create_discussion_note", note: @note
+ -# TODO: insert form correctly
+ $(".js-main-target-note").replaceWith("#{escape_javascript(render 'notes/common_form')}");
+ GitLab.GfmAutoComplete.setup(); \ No newline at end of file
diff --git a/app/views/notes/index.js.haml b/app/views/notes/index.js.haml
index ae70dcad289..f0826100fbf 100644
--- a/app/views/notes/index.js.haml
+++ b/app/views/notes/index.js.haml
@@ -1,18 +1,15 @@
- unless @notes.blank?
+ var notesHtml = "#{escape_javascript(render 'notes/notes')}";
- new_note_ids = @notes.map(&:id)
- if loading_more_notes?
- :plain
- NoteList.appendMoreNotes(#{new_note_ids}, "#{escape_javascript(render 'notes/notes')}");
+ NoteList.appendMoreNotes(#{new_note_ids}, notesHtml);
- elsif loading_new_notes?
- :plain
- NoteList.replaceNewNotes(#{new_note_ids}, "#{escape_javascript(render 'notes/notes')}");
+ NoteList.replaceNewNotes(#{new_note_ids}, notesHtml);
- else
- :plain
- NoteList.setContent(#{new_note_ids}, "#{escape_javascript(render 'notes/notes')}");
+ NoteList.setContent(#{new_note_ids}, notesHtml);
- else
- if loading_more_notes?
- :plain
- NoteList.finishedLoadingMore();
+ NoteList.finishedLoadingMore();