Quantcast
Channel: How do I add 2 conditional classes to a div? - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by regularfry for How do I add 2 conditional classes to a div?

I don't know if it's "right" per se, but this should work::class => [list.overdue? ? "progress-danger" : nil, list.dirty? ? "progress-warning" : nil].compact.join("")

View Article


Answer by Arpit Vaishnav for How do I add 2 conditional classes to a div?

Why dont you take it to a helper View code .progress{ :class => check_list_over_due }Helper Codedef check_list_over_due if condition'classname' elsif condition'classname' else'classname' endend

View Article

Answer by VadimAlekseev for How do I add 2 conditional classes to a div?

I think the best way is to write helper, like "progress_bar_class(list)" and implement all logic in light structurized code.

View Article

How do I add 2 conditional classes to a div?

Here is my div. What is the syntax for adding another conditional class?.progress{ :class => list.overdue? ? "progress-danger" : "" }I essential want to add list.dirty? ? "progress-warning" : ""But...

View Article
Browsing latest articles
Browse All 4 View Live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>