Hide ignored articles in order result.

* also added js-link to show them if wanted
This commit is contained in:
Benjamin Meichsner 2009-10-17 12:22:13 +02:00
parent 20c7c0ef02
commit 1f629ff861
5 changed files with 36 additions and 5 deletions

View File

@ -13,6 +13,7 @@
= javascript_include_tag 'controls' = javascript_include_tag 'controls'
= javascript_include_tag 'application' = javascript_include_tag 'application'
= javascript_include_tag('ordering') if (controller.controller_name == "ordering") = javascript_include_tag('ordering') if (controller.controller_name == "ordering")
= yield(:head)
%body %body
#logininfo= render :partial => 'shared/loginInfo' #logininfo= render :partial => 'shared/loginInfo'

View File

@ -1,3 +1,14 @@
- content_for :head do
:javascript
document.observe("dom:loaded", function() {
// initially hide all ignored articles
$$('tr.ignored').invoke('hide');
});
function toggleIgnoredArticles() {
$$('tr.ignored').invoke('toggle');
};
- title "Dein Bestellergebnis für #{@order.name}" - title "Dein Bestellergebnis für #{@order.name}"
#element_navigation #element_navigation
= link_to_unless @order.previous == @order, "<< #{@order.previous.name}", :action => "my_order_result", :id => @order.previous = link_to_unless @order.previous == @order, "<< #{@order.previous.name}", :action => "my_order_result", :id => @order.previous
@ -52,6 +63,7 @@
%h2 Artikelübersicht %h2 Artikelübersicht
.column_content#result .column_content#result
- if @group_order - if @group_order
%p(style="float:right")= link_to_function "Zeige/Verstecke nicht bestellte Artikel", "toggleIgnoredArticles();"
%p= link_to("Bestellung ändern", :action => "order", :id => @order) if @order.open? %p= link_to("Bestellung ändern", :action => "order", :id => @order) if @order.open?
%table.list %table.list
%thead %thead
@ -88,10 +100,10 @@
- quantity, tolerance, result, sub_total = 0, 0, 0, 0 - quantity, tolerance, result, sub_total = 0, 0, 0, 0
- total += sub_total - total += sub_total
- # give the article different colors, dependent on order-result - # give the article different colors, dependent on order-result
- style = "grey" - class_name = "ignored"
- if (quantity > 0) - if (quantity > 0)
- style = result > 0 ? 'green' : 'red' - class_name = result > 0 ? 'success' : 'failed'
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color:#{style}"} %tr{:class => cycle('even', 'odd', :name => 'articles') + " " + class_name}
%td{:style => "width:40%"} %td{:style => "width:40%"}
=h oa.article.name =h oa.article.name
- unless oa.article.note.blank? - unless oa.article.note.blank?

View File

@ -239,6 +239,12 @@ table {
background-color: #ffffc2; } background-color: #ffffc2; }
table tr.click-me { table tr.click-me {
cursor: pointer; } cursor: pointer; }
table tr.ignored {
color: grey; }
table tr.success {
color: green; }
table tr.failed {
color: red; }
table.list tr { table.list tr {
border: 1px solid #e3e3e3; } border: 1px solid #e3e3e3; }

View File

@ -239,6 +239,12 @@ table {
background-color: #ffffc2; } background-color: #ffffc2; }
table tr.click-me { table tr.click-me {
cursor: pointer; } cursor: pointer; }
table tr.ignored {
color: grey; }
table tr.success {
color: green; }
table tr.failed {
color: red; }
table.list tr { table.list tr {
border: 1px solid #e3e3e3; } border: 1px solid #e3e3e3; }

View File

@ -264,6 +264,12 @@ table
:background-color #ffffc2 :background-color #ffffc2
tr.click-me tr.click-me
:cursor pointer :cursor pointer
tr.ignored
color: grey
tr.success
color: green
tr.failed
color: red
table.list table.list
//:border 2px solid #78b74e //:border 2px solid #78b74e