foodsoft/app/helpers/articles_helper.rb

16 lines
478 B
Ruby
Raw Normal View History

2009-01-06 11:49:19 +01:00
module ArticlesHelper
# useful for highlighting attributes, when synchronizing articles
def highlight_new(unequal_attributes, attribute)
return unless unequal_attributes
unequal_attributes.has_key?(attribute) ? 'background-color: yellow' : ''
2009-01-06 11:49:19 +01:00
end
def row_classes(article)
2012-10-28 18:03:50 +01:00
classes = []
classes << 'unavailable' unless article.availability
classes << 'just-updated' if article.recently_updated && article.availability
classes.join(' ')
end
end