per line comments w/o tests & with dirty code

This commit is contained in:
Dmitriy Zaporozhets 2012-01-12 00:26:01 +02:00
parent 9da4d06a87
commit 99bb4a153d
11 changed files with 55391 additions and 12 deletions

View file

@ -0,0 +1,34 @@
%table{:style => "display:none;"}
%tr.per_line_form
%td{:colspan => 3 }
%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
= f.hidden_field :line_code
%div
= f.label :note
%cite.cgray markdown supported
%br
%br
= f.text_area :note, :size => 255
%p.notify_controls
%span Notify:
= check_box_tag :notify, 1, @note.noteable_type != "Commit"
= label_tag :notify, "Project team"
-if @note.noteable_type == "Commit"
= check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
= label_tag :notify_author, "Commit author"
.clear
%br
= f.submit 'Add note', :class => "grey-button", :id => "submit_note"

View file

@ -0,0 +1,5 @@
%tr.line_notes_row
%td{:colspan => 3}
%ul
= render :partial => "notes/show", :locals => {:note => note}

View file

@ -1,11 +1,18 @@
- if @note.valid?
:plain
$("#new_note .errors").remove();
$('#note_note').val("");
NoteList.prepend(#{@note.id}, "#{escape_javascript(render :partial => "notes/show", :locals => {:note => @note})}");
- if @note.line_code
:plain
$(".per_line_form").hide();
$('#new_note textarea').val("");
$(".#{@note.line_code}").parent().after("#{escape_javascript(render :partial => "notes/per_line_show", :locals => {:note => @note})}");
- else
:plain
$("#new_note .errors").remove();
$('#new_note textarea').val("");
NoteList.prepend(#{@note.id}, "#{escape_javascript(render :partial => "notes/show", :locals => {:note => @note})}");
- else
:plain
$("#new_note").replaceWith("#{escape_javascript(render('form'))}");
- unless @note.line_code
:plain
$("#new_note").replaceWith("#{escape_javascript(render('form'))}");
:plain
$("#submit_note").removeAttr("disabled");