changeset 44:df5182d0787f

Some macro cleanups
author Benoît Allard <benoit.allard@greenbone.net>
date Tue, 07 Oct 2014 09:45:46 +0200
parents c79082d0d44d
children 7c4d001839e7
files farol/templates/macros.j2
diffstat 1 files changed, 22 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/farol/templates/macros.j2	Mon Oct 06 15:58:25 2014 +0200
+++ b/farol/templates/macros.j2	Tue Oct 07 09:45:46 2014 +0200
@@ -56,26 +56,6 @@
 </div>
 {% endmacro %}
 
-{% macro modal(id, title, size=None) %}
-<div class="modal fade" id="{{ id }}" tabindex="-1" role="dialog" aria-labelledby="{{ id }}_title" aria-hidden="true">
-  <div class="modal-dialog{{ ' modal-%s' % size if size}}">
-    <div class="modal-content">
-      <div class="modal-header">
-        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
-        <h4 class="modal-title" id="{{ id }}_title">{{ title }}</h4>
-      </div>
-      <div class="modal-body">
-        {{ caller() }}
-      </div>{# We don't need a footer yet ...
-      <div class="modal-footer">
-        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-        <button type="button" class="btn btn-primary">Save changes</button>
-      </div>#}
-    </div>{# /.modal-content #}
-  </div>{# /.modal-dialog #}
-</div>{# /.modal #}
-{% endmacro %}
-
 {% macro textarea(name, label, placeholder="", value=None, rows=10, required=False) %}
 <div class="form-group">
   {% if caller %}
@@ -132,7 +112,8 @@
   <div class="panel-heading">
     {%- if title %}<h{{ title }} class="panel-title">{% endif -%}
     {%- if collapsible %}<a data-toggle="collapse" href="#{{ heading | secure_filename }}">{% endif -%}
-    {{ heading }}{% if badge is not none %}<span class="pull-right badge">{{ badge }}</span>{% endif %}
+    {{ heading }}
+    {%- if badge is not none %}<span class="pull-right badge">{{ badge }}</span>{% endif %}
     {%- if collapsible %}</a>{% endif -%}
     {%- if title %}</h{{ title }}>{% endif -%}
   </div>
@@ -145,6 +126,26 @@
 </div>
 {% endmacro %}
 
+{% macro modal(id, title, size=None) %}
+<div class="modal fade" id="{{ id }}" tabindex="-1" role="dialog" aria-labelledby="{{ id }}_title" aria-hidden="true">
+  <div class="modal-dialog{{ ' modal-%s' % size if size}}">
+    <div class="modal-content">
+      <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+        <h4 class="modal-title" id="{{ id }}_title">{{ title }}</h4>
+      </div>
+      <div class="modal-body">
+        {{ caller() }}
+      </div>{# We don't need a footer yet ...
+      <div class="modal-footer">
+        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+        <button type="button" class="btn btn-primary">Save changes</button>
+      </div>#}
+    </div>{# /.modal-content #}
+  </div>{# /.modal-dialog #}
+</div>{# /.modal #}
+{% endmacro %}
+
 {# This should be placed inside a .form-horizontal #}
 {% macro label_value(label, value, left=2, right=10) %}
 <div class="form-group">
@@ -156,14 +157,6 @@
 {% endmacro %}
 
 {% macro examples(list) %}
-{% if False %}
-<dl>
-  <dt>Example{{ 's' if list | length > 1 }}:</dt>
-  {% for elem in list %}
-  <dd><samp>{{ elem }}</samp></dd>
-  {% endfor %}
-</dl>
-{% else %}
 <p><strong>Example{{ 's' if list | length > 1 }}:</strong></p>
 {% if list | length == 1 %}
 <samp>{{ list[0] }}</samp>
@@ -174,5 +167,4 @@
   {%- endfor %}
 </ul>
 {% endif %}
-{% endif %}
 {% endmacro %}

http://farol.wald.intevation.org