diff options
Diffstat (limited to 'app/views/notes')
-rw-r--r-- | app/views/notes/_form.html.haml | 28 | ||||
-rw-r--r-- | app/views/notes/_notes.html.haml | 14 | ||||
-rw-r--r-- | app/views/notes/_show.html.haml | 19 | ||||
-rw-r--r-- | app/views/notes/create.js.haml | 8 |
4 files changed, 69 insertions, 0 deletions
diff --git a/app/views/notes/_form.html.haml b/app/views/notes/_form.html.haml new file mode 100644 index 00000000000..ccb159f128c --- /dev/null +++ b/app/views/notes/_form.html.haml @@ -0,0 +1,28 @@ +%div + = form_for [@project, @note], :remote => "true", :multipart => true do |f| + -if @note.errors.any? + .errors.error + - @note.errors.full_messages.each do |msg| + %div= msg + + = f.hidden_field :noteable_id + = f.hidden_field :noteable_type + + %div + = f.label :note + %cite (255 symbols only) + %br + = f.text_area :note, :style => "width:97%;height:100px", :size => 255 + + %div + = f.label :attachment + %cite (less than 10 MB) + %br + = f.file_field :attachment + + = check_box_tag :notify, 1, true + = label_tag :notify, "Notify project team about your note" + + .clear + %br + = f.submit 'Add note', :class => "lbutton vm" diff --git a/app/views/notes/_notes.html.haml b/app/views/notes/_notes.html.haml new file mode 100644 index 00000000000..457bb8db763 --- /dev/null +++ b/app/views/notes/_notes.html.haml @@ -0,0 +1,14 @@ +%ul#notes-list + - @notes.each do |note| + = render :partial => "notes/show", :locals => {:note => note} + +%br +%br +- if can? current_user, :write_note, @project + = render "notes/form" + +:javascript + $('.delete-note').live('ajax:success', function() { + $(this).closest('li').fadeOut(); }); + + diff --git a/app/views/notes/_show.html.haml b/app/views/notes/_show.html.haml new file mode 100644 index 00000000000..2b0a6d2ebcd --- /dev/null +++ b/app/views/notes/_show.html.haml @@ -0,0 +1,19 @@ +%li{:id => dom_id(note)} + %div.note_author + = image_tag gravatar_icon(note.author.email), :class => "left", :width => 40, :style => "padding-right:5px;" + %div.note_content + = simple_format(html_escape(note.note)) + - if note.attachment.url + Attachment: + = link_to note.attachment_identifier, note.attachment.url + %br + %span + %span + [ #{note.author.name} ] + + = time_ago_in_words(note.updated_at) + ago + %br + - if(note.author_id == current_user.id) || can?(current_user, :admin_note, @project) + = link_to 'Remove', [@project, note], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-note right negative" + .clear diff --git a/app/views/notes/create.js.haml b/app/views/notes/create.js.haml new file mode 100644 index 00000000000..47cff1d8834 --- /dev/null +++ b/app/views/notes/create.js.haml @@ -0,0 +1,8 @@ +- if @note.valid? + :plain + $("#new_note .errors").remove(); + $("#notes-list").append("#{escape_javascript(render(:partial => 'show', :locals => {:note => @note} ))}"); + $('#note_note').val(""); +- else + :plain + $("#new_note").replaceWith("#{escape_javascript(render('form'))}"); |