From 88104b215e689a3931edc13b376f376dffa70bf1 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Mon, 28 Jan 2019 20:44:22 -0200 Subject: [PATCH] cria template tag para tratar chunk-vendors --- sapl-frontend/src/apps/compilacao/main.js | 1 - sapl-frontend/vue.config.js | 1 + sapl/base/templatetags/common_tags.py | 12 ++++++++++++ sapl/templates/base.html | 4 ++-- sapl/templates/compilacao/text_edit.html | 2 +- webpack-stats.json | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sapl-frontend/src/apps/compilacao/main.js b/sapl-frontend/src/apps/compilacao/main.js index f60e87c40..a5ed0ac92 100644 --- a/sapl-frontend/src/apps/compilacao/main.js +++ b/sapl-frontend/src/apps/compilacao/main.js @@ -8,7 +8,6 @@ import compilacaoNotas from './js/old/compilacao_notas' import './js/old/compilacao_edit' - _.forEach(_.merge(_.merge(compilacao, compilacaoNotas), compilacaoView), function (func, key) { window[key] = func }) diff --git a/sapl-frontend/vue.config.js b/sapl-frontend/vue.config.js index 2496b337b..b7e9b4fa6 100644 --- a/sapl-frontend/vue.config.js +++ b/sapl-frontend/vue.config.js @@ -44,6 +44,7 @@ module.exports = { .mode('development') .devtool('cheap-module-eval-source-map') + config .plugin('RelativeBundleTrackerPlugin') .use(RelativeBundleTrackerPlugin, [{ diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py index 884a6968f..3c72b1654 100644 --- a/sapl/base/templatetags/common_tags.py +++ b/sapl/base/templatetags/common_tags.py @@ -1,5 +1,7 @@ from django import template from django.template.defaultfilters import stringfilter +from django.utils.safestring import mark_safe +from webpack_loader import utils from sapl.base.models import AppConfig from sapl.materia.models import DocumentoAcessorio, MateriaLegislativa, Proposicao @@ -274,3 +276,13 @@ def filiacao_data_filter(parlamentar, data_inicio): @register.filter def filiacao_intervalo_filter(parlamentar, date_range): return filiacao_data(parlamentar, date_range[0], date_range[1]) + + +@register.simple_tag +def render_chunk_vendors(extension=None): + try: + tags = utils.get_as_tags( + 'chunk-vendors', extension=extension, config='DEFAULT', attrs='') + return mark_safe('\n'.join(tags)) + except: + return '' diff --git a/sapl/templates/base.html b/sapl/templates/base.html index daf9efd33..22e2bd42d 100644 --- a/sapl/templates/base.html +++ b/sapl/templates/base.html @@ -16,7 +16,7 @@ {% block head_content %} {% block webpack_loader_css %} - {% render_bundle 'chunk-vendors' 'css' %} + {% render_chunk_vendors 'css' %} {% render_bundle 'global' 'css' %} {% endblock webpack_loader_css %} @@ -227,7 +227,7 @@ {% block foot_js %} {% block webpack_loader_js %} - {% render_bundle 'chunk-vendors' 'js' %} + {% render_chunk_vendors 'js' %} {% render_bundle 'global' 'js' %} {% endblock webpack_loader_js %} diff --git a/sapl/templates/compilacao/text_edit.html b/sapl/templates/compilacao/text_edit.html index 729b5d6f2..d1d93c5fd 100644 --- a/sapl/templates/compilacao/text_edit.html +++ b/sapl/templates/compilacao/text_edit.html @@ -13,7 +13,7 @@