Topic: Conditional formatting of view text.

I am writing an app which has a view of units.  Each unit has a status (unit.status).I want to conditionally format the color of unit.status but am not sure how.

Here's what I've come up with so far:
module UnitsHelper
  def set_status(object, in_service)
    "#{in_service}" if unit.status == "In Service"

.in_service {
    color: #00FF00;

<td><div class="set_status"><%= unit.status.try(:unit_status) %></div></td>

I've tried to get this to work and it doesn't color the output text properly.  Can anyone help me get on track?

Any time I try to evaluate unit.status == "In Service" no formatting happens.

Last edited by cz3ch (2012-06-12 12:54:20)