Pull together and rename Notes partials

This commit is contained in:
Riyad Preukschas 2012-12-02 23:14:56 +01:00
parent 6fc10fa256
commit c20af32ae4
7 changed files with 24 additions and 30 deletions

View file

@ -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();

View file

@ -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)}");

View file

@ -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(){

View file

@ -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(){

View file

@ -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();

View file

@ -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();