1

I am trying to do an admin page for a webapp, displaying the status of a user ("User" or "Admin"). Here is an extract of the Selmer template I wrote:

<tbody>
{% for user in users %}
<tr>
    <td>{{user.admin}}</td>
    <td>{% if {{user.admin}} %}TRUE{% else %}FALSE{% endif %}</td>
</tr>
{% endfor %}
</tbody>

And here is the source code of the resulting page:

<tr>
    <td>true</td>
    <td>FALSE</td>
</tr>

<tr>
    <td>false</td>
    <td>FALSE</td>
</tr>

As you can see I would like the first FALSE to be TRUE instead. There must be something wrong with the way I am using "if"... can somebody help?

PS: here is the "users" map that is passed to Selmer :

{:users ({:email "my-admin@test.com", :admin true} {:email "my-user@test.com", :admin false})}
Gordon Gustafson
  • 40,133
  • 25
  • 115
  • 157

1 Answers1

5

You've almost got it, but you don't have to use {{..}} inside a tag, so the if statement should look as follows:

{% if user.admin %}TRUE{% else %}FALSE{% endif %}
Yogthos
  • 311
  • 3
  • 10