From f402145c516112d260eeca0cb7cddfd61e9a126d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Thu, 5 Sep 2019 00:09:11 +0200 Subject: [PATCH] Split base template into multiple files to improve structure. --- templates/_flash.html.twig | 31 +++++ templates/_navbar.html.twig | 92 +++++++++++++++ templates/_sidebar.html.twig | 69 +++++++++++ templates/base.html.twig | 215 +---------------------------------- 4 files changed, 195 insertions(+), 212 deletions(-) create mode 100644 templates/_flash.html.twig create mode 100644 templates/_navbar.html.twig create mode 100644 templates/_sidebar.html.twig diff --git a/templates/_flash.html.twig b/templates/_flash.html.twig new file mode 100644 index 00000000..583f88e8 --- /dev/null +++ b/templates/_flash.html.twig @@ -0,0 +1,31 @@ +{# The container to show the flash messages #} + +
+ {% for label, messages in app.flashes() %} + {% for message in messages %} + {% set flash_title = label|replace({'success': 'flash.success', 'error': 'flash.error' + , 'warning': 'flash.warning', 'notice': 'flash.notice', 'info': 'flash.info'}) %} + {% set flash_symbol = label|replace({'success': 'fa-check-circle', 'error': 'fa-exclamation-triangle' + , 'warning': 'fa-exclamation-circle', 'notice': 'fa-flag', 'info': 'fa-flag'}) %} + + {% set flash_bg = label|replace({'success': 'bg-success text-white', + 'error': 'bg-danger text-white', 'warning': 'bg-warning text-white', + 'notice': 'bg-info text-white', 'info': 'bg'})%} + + + {% endfor %} + {% endfor %} +
\ No newline at end of file diff --git a/templates/_navbar.html.twig b/templates/_navbar.html.twig new file mode 100644 index 00000000..cac412f5 --- /dev/null +++ b/templates/_navbar.html.twig @@ -0,0 +1,92 @@ + \ No newline at end of file diff --git a/templates/_sidebar.html.twig b/templates/_sidebar.html.twig new file mode 100644 index 00000000..6a2ee22d --- /dev/null +++ b/templates/_sidebar.html.twig @@ -0,0 +1,69 @@ +{% macro sidebar_dropdown(target) %} + +
  • {% trans %}expandAll{% endtrans %}
  • +
  • {% trans %}reduceAll{% endtrans %}
  • + + +
  • {% trans %}category.labelp{% endtrans %}
  • +
  • {% trans %}storelocation.labelp{% endtrans %}
  • +
  • {% trans %}footprint.labelp{% endtrans %}
  • +
  • {% trans %}manufacturer.labelp{% endtrans %}
  • +
  • {% trans %}supplier.labelp{% endtrans %}
  • +
  • {% trans %}device.labelp{% endtrans %}
  • +
  • {% trans %}tools.label{% endtrans %}
  • +{% endmacro %} + + \ No newline at end of file diff --git a/templates/base.html.twig b/templates/base.html.twig index a9093a3c..3d131aa6 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -23,129 +23,9 @@
    - - - -
    - {% for label, messages in app.flashes() %} - {% for message in messages %} - {% set flash_title = label|replace({'success': 'flash.success', 'error': 'flash.error' - , 'warning': 'flash.warning', 'notice': 'flash.notice', 'info': 'flash.info'}) %} - {% set flash_symbol = label|replace({'success': 'fa-check-circle', 'error': 'fa-exclamation-triangle' - , 'warning': 'fa-exclamation-circle', 'notice': 'fa-flag', 'info': 'fa-flag'}) %} - - {% set flash_bg = label|replace({'success': 'bg-success text-white', - 'error': 'bg-danger text-white', 'warning': 'bg-warning text-white', - 'notice': 'bg-info text-white', 'info': 'bg'})%} - - - {% endfor %} - {% endfor %} -
    + {% include "_flash.html.twig" %}
    @@ -154,97 +34,8 @@