benoit@0: {# benoit@0: # Description: benoit@0: # Web Template used in Farol Design benoit@0: # benoit@0: # Authors: benoit@0: # BenoƮt Allard benoit@0: # benoit@0: # Copyright: benoit@0: # Copyright (C) 2014 Greenbone Networks GmbH benoit@0: # benoit@0: # This program is free software; you can redistribute it and/or benoit@0: # modify it under the terms of the GNU General Public License benoit@0: # as published by the Free Software Foundation; either version 2 benoit@0: # of the License, or (at your option) any later version. benoit@0: # benoit@0: # This program is distributed in the hope that it will be useful, benoit@0: # but WITHOUT ANY WARRANTY; without even the implied warranty of benoit@0: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the benoit@0: # GNU General Public License for more details. benoit@0: # benoit@0: # You should have received a copy of the GNU General Public License benoit@0: # along with this program; if not, write to the Free Software benoit@0: # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. benoit@0: -#} benoit@0: benoit@126: {% macro textinput(name, label, placeholder="", value=None, required=False, type="text", extras={}, help='', regex=None) %} benoit@0:
benoit@34: {% if caller %} benoit@34: {% set content=caller () %} benoit@34: {% call modal(name + "_modal", label) %} benoit@34: {{ content }} benoit@34: {% endcall %} benoit@34: {% endif %} benoit@34: benoit@0: {% if type == "datetime" %}
{% endif %} benoit@0: benoit@0: {% if type == "datetime" %} benoit@0: benoit@0: benoit@0: benoit@0:
benoit@0: {% endif %} benoit@0: {% if help %} benoit@0: {{ help }} benoit@0: {% endif %} benoit@0:
benoit@0: {% endmacro %} benoit@0: benoit@0: {% macro textarea(name, label, placeholder="", value=None, rows=10, required=False) %} benoit@0:
benoit@35: {% if caller %} benoit@35: {% set content=caller () %} benoit@35: {% call modal(name + "_modal", label) %} benoit@35: {{ content }} benoit@35: {% endcall %} benoit@35: {% endif %} benoit@35: benoit@0: benoit@0:
benoit@0: {% endmacro %} benoit@0: benoit@0: {% macro selectinput(name, label, choices, value) %} benoit@0:
benoit@35: {% if caller %} benoit@35: {% set content=caller () %} benoit@35: {% call modal(name + "_modal", label) %} benoit@35: {{ content }} benoit@35: {% endcall %} benoit@35: {% endif %} benoit@35: benoit@0: benoit@0:
benoit@0: {% endmacro %} benoit@0: benoit@0: {# Big difference with the one above is that the choices are tuple (name, value) #} benoit@0: {% macro selectinput2(name, label, choices, value, multiple=False) %} benoit@0: {% if not multiple %} benoit@0: {% set value= [value] %} benoit@0: {% endif %} benoit@0:
benoit@0: benoit@0: benoit@0:
benoit@0: {% endmacro %} benoit@0: benoit@32: {% macro panel(type="default", heading=None, badge=None, title=0, collapsible=True, extended=False) %} benoit@0: {% if not heading %} benoit@0: {% set collapsible = False %} benoit@0: {% endif %} benoit@0:
benoit@0: {% if heading %} benoit@0:
benoit@0: {%- if title %}{% endif -%} benoit@0: {%- if collapsible %}{% endif -%} benoit@44: {{ heading }} benoit@44: {%- if badge is not none %}{{ badge }}{% endif %} benoit@0: {%- if collapsible %}{% endif -%} benoit@0: {%- if title %}{% endif -%} benoit@0:
benoit@0: {% endif %} benoit@0: {% if collapsible %}
{% endif %} benoit@0:
benoit@0: {{ caller() }} benoit@0:
benoit@0: {% if collapsible %}
{% endif %} benoit@0:
benoit@0: {% endmacro %} benoit@0: benoit@44: {% macro modal(id, title, size=None) %} benoit@44: {# /.modal #} benoit@44: {% endmacro %} benoit@44: benoit@0: {# This should be placed inside a .form-horizontal #} benoit@0: {% macro label_value(label, value, left=2, right=10) %} benoit@0:
benoit@0: benoit@0:
benoit@0:

{{ value }}

benoit@0:
benoit@0:
benoit@0: {% endmacro %} benoit@34: benoit@53: {% macro examples(list, title='') %} benoit@53:

{{ title + ' ' if title }}Example{{ 's' if list | length > 1 }}:

benoit@34: {% if list | length == 1 %} benoit@34: {{ list[0] }} benoit@34: {% else %} benoit@34: benoit@34: {% endif %} benoit@34: {% endmacro %} benoit@69: benoit@101: {% macro POST_button(url, text, fields, out=False, style='btn-default') %} benoit@101: {% if caller and out %} benoit@101: {{ caller('$(this).next()') }} benoit@101: {% endif %} benoit@101: benoit@101: {% endmacro %} benoit@101: benoit@105: {% macro edit_button(url, text="edit") -%} benoit@105: {{ text }} benoit@105: {%- endmacro %} benoit@105: benoit@105: {% macro add_button(url, text="add") -%} benoit@105: {{ text }} benoit@105: {%- endmacro %} benoit@105: benoit@105: {% macro delete_button(url, hiddens={}, text="delete") -%} benoit@104: {{ POST_button(url, text, hiddens, style="btn-danger btn-xs") }} benoit@105: {%- endmacro %}