Permalink
Browse files

Merge branch 'master' of github.com:sozialhelden/brokenlift

  • Loading branch information...
Matthias Guenther
Matthias Guenther committed Apr 15, 2012
2 parents 810e3c6 + af9099e commit 3af862412a81f6e68b393ece014350e9abc76217
Showing with 7 additions and 4 deletions.
  1. +5 −2 app/models/station.rb
  2. +1 −1 app/views/stations/list/_station.html.haml
  3. +1 −1 app/views/stations/show.html.haml
View
@@ -28,6 +28,9 @@ def lifts_total
def lifts_working
lifts.reject{|l| l.broken?}.size
end
+
+ def broken?
+ station.lifts_working != station.lifts_total rescue false
+ end
-end
-
+end
@@ -1,3 +1,3 @@
%li.station
- %span.status{:class => station.lifts_working == station.lifts_total ? "working" : "broken" }
+ %span.status{:class => station.broken? ? "broken" : "working" }
= link_to station.name, :controller => "stations", :action => "show", :id => station.id
@@ -9,7 +9,7 @@
.row-fluid
.span12
%div
- %h2.station.header{:class => @station.lifts_working == @station.lifts_total ? "working" : "broken" }
+ %h2.station.header{:class => @station.broken? ? "broken" : "working" }
%span= @station.name
%ul.status-list{:id=>'lifts-list'}
= render :partial => 'lifts/lift', :collection => @station.lifts

0 comments on commit 3af8624

Please sign in to comment.