Last active
May 28, 2016 07:43
-
-
Save uhtred/5b4893c6cb993fff8b44 to your computer and use it in GitHub Desktop.
Nunjucks Macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro input(name, value, type='text', class="") %} | |
<input type={{ type }} name={{ name }} value={{ value }} class="{{ class }}" /> | |
{% endmacro %} | |
{% macro select(name='', id='', class='', options='', first='Selecione' ) %} | |
<select name="{{name}}" id="" {{ class }}> | |
{% if first %} | |
<option value="">{{first}}</option> | |
{% endif %} | |
{% for option in options %} | |
<option value="{{option.value}}" {{ "selected" if option.selected }}>{{option.text}}</option> | |
{% endfor %} | |
</select> | |
{% endmacro %} | |
{% macro label(text, for='', class='') %} | |
<label for="{{ for }}" class="{{ class }}">{{ text }}</label> | |
{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment