v1.0
This commit is contained in:
parent
0f43e98ef8
commit
d378468794
317 changed files with 11347 additions and 0 deletions
28
app/views/notes/_form.html.haml
Normal file
28
app/views/notes/_form.html.haml
Normal file
|
@ -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"
|
14
app/views/notes/_notes.html.haml
Normal file
14
app/views/notes/_notes.html.haml
Normal file
|
@ -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(); });
|
||||
|
||||
|
19
app/views/notes/_show.html.haml
Normal file
19
app/views/notes/_show.html.haml
Normal file
|
@ -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
|
8
app/views/notes/create.js.haml
Normal file
8
app/views/notes/create.js.haml
Normal file
|
@ -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'))}");
|
Loading…
Add table
Add a link
Reference in a new issue