Merge branch 'master' of git://github.com/bennibu/foodsoft
This commit is contained in:
commit
c9931b0e4e
4 changed files with 39 additions and 10 deletions
|
@ -15,13 +15,40 @@ class Finance::BalancingController < ApplicationController
|
|||
def new
|
||||
@order = Order.find(params[:id])
|
||||
@comments = @order.comments
|
||||
|
||||
if params['sort']
|
||||
sort = case params['sort']
|
||||
when "name" then "articles.name"
|
||||
when "order_number" then "articles.order_number"
|
||||
when "name_reverse" then "articles.name DESC"
|
||||
when "order_number_reverse" then "articles.order_number DESC"
|
||||
end
|
||||
else
|
||||
sort = "articles.name"
|
||||
end
|
||||
|
||||
@articles = @order.order_articles.ordered.find(
|
||||
:all,
|
||||
:include => :article,
|
||||
:order => sort
|
||||
)
|
||||
|
||||
case params[:view]
|
||||
when 'editResults'
|
||||
render :partial => 'edit_results_by_articles'
|
||||
render :partial => 'edit_results_by_articles' and return
|
||||
when 'groupsOverview'
|
||||
render :partial => 'shared/articles_by_groups', :locals => {:order => @order}
|
||||
render :partial => 'shared/articles_by_groups', :locals => {:order => @order} and return
|
||||
when 'articlesOverview'
|
||||
render :partial => 'shared/articles_by_articles', :locals => {:order => @order}
|
||||
render :partial => 'shared/articles_by_articles', :locals => {:order => @order} and return
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.haml
|
||||
format.js do
|
||||
render :update do |page|
|
||||
page.replace_html 'results', :partial => "edit_results_by_articles"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ module ApplicationHelper
|
|||
return result
|
||||
end
|
||||
|
||||
def sort_link_helper(text, param, per_page = (@per_page || 10) )
|
||||
def sort_link_helper(text, param, per_page = (@per_page || 10), action = "list" )
|
||||
key = param
|
||||
key += "_reverse" if params[:sort] == param
|
||||
options = {
|
||||
|
@ -68,8 +68,8 @@ module ApplicationHelper
|
|||
:method => :get
|
||||
}
|
||||
html_options = {
|
||||
:title => _('Sort by this field'),
|
||||
:href => url_for(:action => 'list', :params => params.merge({:sort => key, :page => nil, :per_page => per_page}))
|
||||
:title => _("Nach #{text} sortieren"),
|
||||
:href => url_for(:action => action, :params => params.merge({:sort => key, :page => nil, :per_page => per_page}))
|
||||
}
|
||||
link_to_remote(text, options, html_options)
|
||||
end
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
%table{:class => "ordered_articles", :style => "clear:both"}
|
||||
%thead
|
||||
%tr
|
||||
%th{:colspan => "1"} Artikel
|
||||
%th Nr.
|
||||
%th[sort_td_class_helper "name"]{:colspan => "1"}
|
||||
= sort_link_helper "Artikel", "name", 1000, "new"
|
||||
%th[sort_td_class_helper "order_number"]
|
||||
= sort_link_helper "Nr.", "order_number", 1000, "new"
|
||||
%th Menge
|
||||
%th GebGr * Einheit
|
||||
%th Netto
|
||||
|
@ -16,5 +18,5 @@
|
|||
%th Pfand
|
||||
%th{:colspan => "2"}
|
||||
%tbody#result_table
|
||||
- for order_article in @order.order_articles.ordered.all(:include => [:article, :article_price])
|
||||
- for order_article in @articles
|
||||
= render :partial => "order_article_result", :locals => {:order_article => order_article}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
%td=h order.name
|
||||
%td=h format_time(order.ends) unless order.ends.nil?
|
||||
%td=h truncate(order.note)
|
||||
%td= link_to "Beenden", finish_order_path(order), :confirm => "Willst Du wirklich die Bestellung beenden?\nEs gibt kein zurück..", :method => :post
|
||||
%td= link_to "Beenden", finish_order_path(order), :confirm => "Willst Du wirklich die Bestellung \"#{order.name}\" beenden?\nEs gibt kein zurück.", :method => :post
|
||||
%td
|
||||
= link_to "Anzeigen", order
|
||||
= link_to icon(:edit), edit_order_path(order)
|
||||
|
|
Loading…
Reference in a new issue