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 'application'
= javascript_include_tag('ordering') if (controller.controller_name == "ordering")
= yield(:head)
%body
#logininfo= render :partial => 'shared/loginInfo'
@ -38,4 +39,4 @@
- if flash[:notice]
= javascript_tag("new Effect.Highlight('flashNotice', {delay:0.8, duration:1});")
- if flash[:error]
= javascript_tag("new Effect.Highlight('flashError', {delay:0.8, duration:1});")
= javascript_tag("new Effect.Highlight('flashError', {delay:0.8, duration:1});")

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}"
#element_navigation
= link_to_unless @order.previous == @order, "<< #{@order.previous.name}", :action => "my_order_result", :id => @order.previous
@ -52,6 +63,7 @@
%h2 Artikelübersicht
.column_content#result
- 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?
%table.list
%thead
@ -88,10 +100,10 @@
- quantity, tolerance, result, sub_total = 0, 0, 0, 0
- total += sub_total
- # give the article different colors, dependent on order-result
- style = "grey"
- class_name = "ignored"
- if (quantity > 0)
- style = result > 0 ? 'green' : 'red'
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color:#{style}"}
- class_name = result > 0 ? 'success' : 'failed'
%tr{:class => cycle('even', 'odd', :name => 'articles') + " " + class_name}
%td{:style => "width:40%"}
=h oa.article.name
- unless oa.article.note.blank?
@ -129,4 +141,4 @@
= form.text_area :text, :cols => 50, :rows => 6
%br/
= submit_tag "Kommentar hinzufügen"
= link_to_top
= link_to_top

View file

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

View file

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

View file

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