From 514f3f79ea418ea8bfae90a14d2edeee47ffd714 Mon Sep 17 00:00:00 2001 From: Stefane Fermigier Date: Thu, 19 Jul 2018 14:06:27 +0200 Subject: [PATCH] don't remove this file as it breaks tests. --- abilian/web/templates/macros.html | 258 ++++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 abilian/web/templates/macros.html diff --git a/abilian/web/templates/macros.html b/abilian/web/templates/macros.html new file mode 100644 index 00000000..a22d278d --- /dev/null +++ b/abilian/web/templates/macros.html @@ -0,0 +1,258 @@ +{# + This file is deprecated. Put macros in "macros" directory +#} + +{% macro deprecated(name, newfile) %} + This block is generated from macro "{{ name }}" + in deprecated file "macros.html". + Import from "macros/{{ newfile }}.html" instead. + +{% endmacro %} + +{# Generic renderer for boxes / portlets #} +{% macro m_box(title, color="blue", with_toolbar=False) %} +
+ {{ deprecated("m_box", "box") }} + + {% if title %} +
+
{{ title }}
+ + {# LATER + {% if with_toolbar %} +
+ + + +
+ {% endif %} + #} +
+ {% endif %} + +
+
+ {{ caller() }} +
+
+
+{% endmacro %} + +{% macro m_box_menu(title=None, color="green", with_toolbar=False) %} + {{ deprecated("m_box_menu", "box") }} +
+
+
{{ title or _('Menu') }}
+
+ +
+ {{ caller() }} +
+
+{% endmacro %} + +{% macro m_box_content(title=None, color="blue", with_toolbar=False) %} +
+ {{ deprecated("m_box_content", "box") }} + {% if title %} +
+
{{ title }}
+
+ {% endif %} + +
+
+ {{ caller() }} +
+
+
+
+{% endmacro %} + +{# Generic renderer for activity streams #} +{% macro m_activities(entries, ignore_communities=False) %} + {{ deprecated("m_activities", "activity") }} + +{% endmacro %} + + +{% macro _m_audit_field_changes(changes) %} + {{ deprecated("_m_audit_field_changes", "audit") }} + +{% endmacro %} + +{% macro m_audit_log(entries) %} + {{ deprecated("m_audit_log", "audit") }} + {%- if entries %} + +
+ {%- for entry in entries %} + {%- if entry.related or entry.op == 1 %} +
+ + {{ entry.user.name }} + made changes on {{ entry.happened_at.strftime('%Y-%m-%d %H:%M') }} + {{ _m_audit_field_changes(entry.changes) }} +
+ {%- elif entry.type == 0 %} +
+ + {{ entry.user.name }} + created this record + on {{ entry.happened_at.strftime('%Y-%m-%d %H:%M') }} +
+ {%- endif %} + {%- endfor %} +
+ {%- endif %} +{% endmacro %} + +{% macro m_breadcrumbs(breadcrumbs) %} + + Breadcrumb is no more generated from a macro. Just include + "breadcrumb.html" if you are overriding "body" block from "base.html". + +{% endmacro %} + +{% macro m_flashed_messages() %} + + Flash message block is no more generated from a macro. Just include + "flash-messages.html" if you are overriding "body" block from + "base.html". + +{% endmacro %} + + +{% macro m_recent_items(recent_items) %} + {{ deprecated("m_recent_items", "recent") }} + + {%- if recent_items %} +
+ +
+ {%- endif %} +{% endmacro %} + + +{# NOTE: there was a m_docs_table macro here, it has moved to the + # documents app. Maybe a global macroa is needed, but probably a different one. + #} + + +{% macro m_table(lines) %} + {{ deprecated("m_table", "?") }} + + + + {%- for line in lines %} + + + {%- if line[0] == 'Size' %} + + {%- else %} + + {%- endif %} + + {%- endfor %} + +
{{ line[0] }}{{ line[1]|filesize }}{{ line[1] }}
+{%- endmacro %} + + +{% macro m_renderfield(field) -%} + {{ deprecated("m_renderfield", "form") }} + {% set with_label = kwargs.pop('with_label', True) %} + {% set placeholder = '' %} + {% if not with_label %} + {% set placeholder = field.label.text %} + {% endif %} + +
+ {% if with_label and not field.type in ('BooleanField', 'CSRFTokenField') %} + + {% endif %} + + {% set class_ = kwargs.pop('class_', '') %} + {% if field.flags.required %} + {% set class_ = class_ + ' required' %} + {% endif %} + + {% if field.type == 'CSRFTokenField' %} + {{ field() }} + {% elif field.type == 'BooleanField' %} + + {% else %} + {% if field.type == 'FileField' %} + {% set class_ = class_ + ' input-file' %} + {% endif %} + {{ field(class_=class_, placeholder=placeholder, **kwargs)|safe }} + {% endif %} + + {% if field.errors %} + {{ field.errors|join(', ') }} + {% endif %} + + {% if field.description %} + {{ field.description|safe }} + {% endif %} + +
+{%- endmacro %}