Commit 4fc66ead4f50f76efb80e119bbedc7514602f57f

Authored by Riyad Preukschas
1 parent 29c71f2f

Rename 'notes/show' partial to 'notes/note'

app/views/notes/_create_common_note.js.haml
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 $('.note-form-holder #preview-link').text('Preview'); 5 $('.note-form-holder #preview-link').text('Preview');
6 $('.note-form-holder #preview-note').hide(); 6 $('.note-form-holder #preview-note').hide();
7 $('.note-form-holder').show(); 7 $('.note-form-holder').show();
8 - NoteList.appendNewNote(#{note.id}, "#{escape_javascript(render "notes/show", note: note)}"); 8 + NoteList.appendNewNote(#{note.id}, "#{escape_javascript(render "notes/note", note: note)}");
9 9
10 - else 10 - else
11 :plain 11 :plain
app/views/notes/_note.html.haml 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +%li{id: dom_id(note), class: "note"}
  2 + = image_tag gravatar_icon(note.author.email), class: "avatar s32"
  3 + %div.note-author
  4 + %strong= note.author_name
  5 + = link_to "##{dom_id(note)}", name: dom_id(note) do
  6 + %cite.cgray
  7 + = time_ago_in_words(note.updated_at)
  8 + ago
  9 + - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)
  10 + = link_to [@project, note], confirm: 'Are you sure?', method: :delete, remote: true, class: "cred delete-note btn very_small" do
  11 + %i.icon-trash
  12 + Remove
  13 +
  14 + %div.note-title
  15 + = preserve do
  16 + = markdown(note.note)
  17 + - if note.attachment.url
  18 + .right
  19 + %div.file
  20 + = link_to note.attachment_identifier, note.attachment.url, target: "_blank"
  21 + .clear
app/views/notes/_notes_list.html.haml
1 - @notes.each do |note| 1 - @notes.each do |note|
2 - next unless note.author 2 - next unless note.author
3 - = render partial: "notes/show", locals: {note: note} 3 + = render "notes/note", note: note
4 4
app/views/notes/_per_line_show.html.haml
1 %tr.line_notes_row 1 %tr.line_notes_row
2 %td{colspan: 3} 2 %td{colspan: 3}
3 %ul 3 %ul
4 - = render "notes/show", note: note 4 + = render "notes/note", note: note
5 5
app/views/notes/_show.html.haml
@@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
1 -%li{id: dom_id(note), class: "note"}  
2 - = image_tag gravatar_icon(note.author.email), class: "avatar s32"  
3 - %div.note-author  
4 - %strong= note.author_name  
5 - = link_to "##{dom_id(note)}", name: dom_id(note) do  
6 - %cite.cgray  
7 - = time_ago_in_words(note.updated_at)  
8 - ago  
9 - - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project)  
10 - = link_to [@project, note], confirm: 'Are you sure?', method: :delete, remote: true, class: "cred delete-note btn very_small" do  
11 - %i.icon-trash  
12 - Remove  
13 -  
14 - %div.note-title  
15 - = preserve do  
16 - = markdown(note.note)  
17 - - if note.attachment.url  
18 - .right  
19 - %div.file  
20 - = link_to note.attachment_identifier, note.attachment.url, target: "_blank"  
21 - .clear