Refactoring of order comments.

This commit is contained in:
benni 2011-06-19 20:47:27 +02:00
parent 38b5dcba1f
commit 88b268cb0b
14 changed files with 57 additions and 47 deletions

View file

@ -0,0 +1,5 @@
= simple_form_for order_comment, :remote => true, :validate => true do |f|
= f.hidden_field :order_id
= f.hidden_field :user_id
= f.input :text, :input_html => {:size => "50x6"}
= f.submit

View file

@ -0,0 +1 @@
$('#comments').html('<%= escape_javascript(render(:partial => 'shared/comments', :locals => { :comments => @order_comment.order.comments })) %>');

View file

@ -0,0 +1 @@
$('#new_comment').html('<%= escape_javascript(render('form', :locals => { :order_comment => @order_comment})) %>');

View file

@ -104,14 +104,8 @@
.single_column{:style => "width:70em;"}
.box_title
%h2 Kommentare
.column_content#comments
= render :partial => 'shared/comments', :locals => { :comments => @order.comments }
%p
- form_for :comment, :url => { :action => :add_comment, :id => @order } do |form|
%p
%b Neuen Kommentar hinzufügen:
%br/
= form.text_area :text, :cols => 50, :rows => 6
%br/
= submit_tag "Kommentar hinzufügen"
.column_content
#comments
= render :partial => 'shared/comments', :locals => { :comments => @order.comments }
#new_comment= render :partial => 'order_comments/form', :locals => { :order_comment => @order.comments.build(:user => current_user)}
= link_to_top

View file

@ -79,15 +79,8 @@
.single_column{:style => "width:70em;"}
.box_title
%h2 Kommentare
.column_content#comments
= render :partial => "/shared/comments", :locals => { :comments => @order.comments }
%p
- form_for :comment, :url => add_comment_order_path(@order) do |form|
%p
%b Neuen Kommentar hinzufügen:
%br/
= form.text_area :text, :cols => 50, :rows => 6
%br/
= submit_tag "Kommentar hinzufügen"
.column_content
#comments
= render :partial => 'shared/comments', :locals => { :comments => @order.comments }
#new_comment= render :partial => 'order_comments/form', :locals => { :order_comment => @order.comments.build(:user => current_user)}
= link_to_top