Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 3af862412a81f6e68b393ece014350e9abc76217 2 parents 810e3c6 + af9099e
Matthias Guenther authored
View
7 app/models/station.rb
@@ -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
View
2  app/views/stations/list/_station.html.haml
@@ -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
View
2  app/views/stations/show.html.haml
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.