Reputation: 8212
I have this code
- value="true"
- if (value)
p yes #if the condition is true I want to insert a glyphicon. (<i class="fa fa-check-circle"></i>)
- else
p no
How to convert it into condition? <i class="fa fa-check-circle"></i> : <i class="fa fa-times-circle"></i>
But this is causing error!
Upvotes: 2
Views: 3524
Reputation: 580
Your first code can simply be replaced with this:
= value ? "yes" : "no"
Any lines starting with =
are evaluated, and the resulting return value is inserted into the document after a call to escape_html
.
Because you explained in your comments that you actually want HTML code to be inserted, you'll have to do this:
== value ? '<i class="fa fa-check-circle"></i>' : '<i class="fa fa-times-circle"></i>'
Upvotes: 4