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