{%- macro get_size(size) -%} {%- if size|lower == 'xl' %} {% set result = 'btn-block' -%} {% elif size|lower == 'l' %} {% set result = 'btn-lg' -%} {% elif size|lower == 'm' %} {%- set result = '' -%} {% elif size|lower == 's' %} {% set result = 'btn-sm' -%} {% else %} {% set result = 'btn-%s' % size -%} {%- endif -%} {{ result }} {%- endmacro -%} {%- macro get_color(color) -%} {#- because bootstrap uses context for colors -#} {%- if color == 'blue' -%} {% set result = 'btn-primary' -%} {% elif color == 'green' -%} {% set result = 'btn-success' -%} {% elif color == 'red' -%} {% set result = 'btn-danger' -%} {% elif color == 'yellow' -%} {% set result = 'btn-warning' -%} {% elif color == 'light-blue' -%} {% set result = 'btn-info' -%} {% elif color == 'grey' -%} {%- set result = 'btn-default' -%} {%- endif -%} {{ result }} {%- endmacro -%} {%- macro get_icon(icon,lib) -%} {%- if not icon == '' -%} {%- endif -%} {%- endmacro -%} {%- macro get_button(text,color='grey',size='m',icon='',lib='',type='button') -%} {% if lib == '' %} {% set lib = config['DEFAULT_ICON_LIBRARY'] %} {% endif %} {%- endmacro -%} {%- macro get_link_button(endpoint,text,color='grey',size='m',icon='hand-right',type='link') -%} {{get_icon(icon)}}{% if not icon == '' -%} {%- endif %}{{text}} {%- endmacro -%} {%- if args['type'] == 'link' -%} {{ get_link_button(**args)|safe }} {% else %} {{ get_button(**args)|safe }} {%- endif -%}