I'm trying to color some rows in a rails table based on a single attribute. I'm only specifying that so people don't get confused, thinking I'm trying to alternate the colors in my table. That's not the goal. Thing is, it worked 20 minutes ago, %tr.error
and %tr.warning
in my haml file colored the rows correctly (using bootstrap), but now they don't do anything. I'm seeing questions on here about how sorting tables can mess up coloring. I'm using thinking-sphinx as a search engine for my app. Could that be the problem? If so, is there a way to fix this without getting my hands too dirty in Javascript? (it's not really my strong suit)
EDIT: movies/index.html.haml
!!!
%head
%body
%br
= link_to "Sign out", signout_path, method: 'delete', class: "btn btn-primary"
= link_to "View checked out", checked_path, class: "btn btn-primary"
= link_to "Full index", root_path, class: "btn"
= link_to "My movies", my_movies_path, class: "btn btn-primary"
= link_to "Add a new movie", new_movie_path, class: "btn btn-success"
%br
%br
= form_tag movies_path, method: 'get' do
%p
= text_field_tag :search, params[:search], placeholder: "Search by name or keyword"
= submit_tag "Search", class: "btn btn-primary"
= "Showing #{Movie.all.length} results"
%br
%br
/ %table.table.table-bordered
/ %thead
/ %tr.info
/ %th Title
/ %th Year
/ %th Format
/ %th Loanee
/ %th Action
/ %tbody
/ = render partial: 'movies/table', collection: @movies, as: :m
/ = will_paginate
%table.table.table-striped.table-bordered
%thead
%tr
%th Title
%th Year
%th Format
%th Loanee
%th Action
%tbody
-@movies.each do |m|
-unless m.loanee.blank?
%tr.error
%td
= m.title
%td
= m.year
%td
= m.rec_form
%td
= m.loanee
%td
= link_to 'Check in', edit_movie_path(m), {:class => "btn"}
-else
%tr
%td
= m.title
%td
= m.year
%td
= m.rec_form
%td
= m.loanee
%td
= link_to 'Check out', edit_movie_path(m), {:class => "btn"}
= will_paginate
I was trying to add in a partial to ease out a lot of repetition and that was when stuff started breaking.