story#115762063 - use special helper method to generate class name

This commit is contained in:
Vladimir Krylov 2016-03-23 18:28:40 +02:00
parent 306819eeaf
commit bcc8e7b6f8
5 changed files with 59 additions and 33 deletions

View file

@ -72,4 +72,15 @@ module ApplicationHelper
link_to(title, url_for(sort: {param_name => order}), class: "sort_link #{order}")
end
def changing_css_class(version, *attrs)
return unless version
css_class = "text-warning"
if attrs.size == 1
version.object_changes.to_h[attrs.first] && css_class
else
version.object_changes.to_h.slice(*attrs).any? && css_class
end
end
end