Fixed edit_not in balancing.
This commit is contained in:
parent
da8fd1d72a
commit
c49edb79a2
7 changed files with 24 additions and 24 deletions
|
@ -1,8 +1,7 @@
|
|||
# encoding: utf-8
|
||||
class Finance::BalancingController < ApplicationController
|
||||
before_filter :authenticate_finance
|
||||
verify :method => :post, :only => [:close, :close_direct]
|
||||
|
||||
|
||||
def index
|
||||
@financial_transactions = FinancialTransaction.find(:all, :order => "created_on DESC", :limit => 8)
|
||||
@orders = Order.finished_not_closed
|
||||
|
@ -55,18 +54,15 @@ class Finance::BalancingController < ApplicationController
|
|||
|
||||
def edit_note
|
||||
@order = Order.find(params[:id])
|
||||
render :partial => 'edit_note'
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def update_note
|
||||
@order = Order.find(params[:id])
|
||||
render :update do |page|
|
||||
if @order.update_attributes(params[:order])
|
||||
page["note"].replace_html simple_format(@order.note)
|
||||
page["edit_box"].hide
|
||||
else
|
||||
page["results"].replace_html :partial => "edit_note"
|
||||
end
|
||||
if @order.update_attributes(params[:order])
|
||||
render :layout => false
|
||||
else
|
||||
render :action => :edit_note, :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ module ApplicationHelper
|
|||
:success => "Element.hide('loader')",
|
||||
:method => :get
|
||||
}
|
||||
link_to_remote(text, remote_options.merge(options))
|
||||
link_to(text, options[:url], remote_options.merge(options))
|
||||
end
|
||||
|
||||
def format_roles(record)
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
%h2 Notiz bearbeiten
|
||||
- remote_form_for 'order', @order, :url => {:action => 'update_note', :id => @order}, |
|
||||
:before => "Element.show('loader')", :success => "Element.hide('loader')" do |form| |
|
||||
= form.error_messages
|
||||
= form.text_area "note", :size => "60x20"
|
||||
%p
|
||||
= submit_tag "Speichern"
|
||||
|
|
||||
= link_to_function 'Abbrechen', "Element.hide('edit_box')"
|
||||
= simple_form_for @order, url: update_note_finance_order_path(@order), remote: true, method: :put do |f|
|
||||
= f.input :note, inner_html: {size: "60x20"}
|
||||
= f.submit
|
1
app/views/finance/balancing/edit_note.js.erb
Normal file
1
app/views/finance/balancing/edit_note.js.erb
Normal file
|
@ -0,0 +1 @@
|
|||
$.fancybox('<%= escape_javascript(render("edit_note")) %>');
|
|
@ -35,14 +35,12 @@
|
|||
= simple_format @order.note
|
||||
- else
|
||||
%p Hier kannst Du deine Abrechnung kommentieren
|
||||
= remote_link_to "Notiz bearbeiten", |
|
||||
:update => 'edit_box', :url => {:action => 'edit_note', :id => @order}, |
|
||||
:success => "Element.hide('loader'); Element.show('edit_box')" |
|
||||
= link_to "Notiz bearbeiten", edit_note_finance_order_path(@order), remote: true
|
||||
.box_title
|
||||
%h2 Kommentare
|
||||
.column_content
|
||||
#comments
|
||||
= render :partial => 'shared/comments'
|
||||
= render :partial => 'shared/comments', locals: {comments: @order.comments}
|
||||
|
||||
.left_column{:style => 'width: 69%'}
|
||||
.box_title
|
||||
|
@ -53,6 +51,6 @@
|
|||
%li= remote_link_to 'Bestellung bearbeiten', :update => 'results', :url => {:action => 'new', :id => @order, :view => 'editResults'}
|
||||
.column_content
|
||||
#results
|
||||
= render :partial => 'edit_results_by_articles'
|
||||
/= render :partial => 'edit_results_by_articles'
|
||||
%p= link_to_top
|
||||
#edit_box{:style => 'display:none'}
|
2
app/views/finance/balancing/update_note.js.erb
Normal file
2
app/views/finance/balancing/update_note.js.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
$.fancybox.close();
|
||||
$('#note').html('<%= escape_javascript(simple_format(@order.note)) %>');
|
|
@ -119,6 +119,14 @@ Foodsoft::Application.routes.draw do
|
|||
|
||||
namespace :finance do
|
||||
root :to => 'balancing#index'
|
||||
|
||||
resources :order, controller: 'balancing', path: 'balancing' do
|
||||
member do
|
||||
get :edit_note
|
||||
put :update_note
|
||||
end
|
||||
end
|
||||
|
||||
match 'balancing/list' => 'balancing#list', :as => 'balancing'
|
||||
|
||||
resources :invoices
|
||||
|
|
Loading…
Reference in a new issue