From cf9e882e20d806e1a999169c63df0aa0cb5fee32 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Mon, 25 Nov 2019 15:02:46 -0300 Subject: [PATCH] =?UTF-8?q?corrige=20actions=20de=20compila=C3=A7=C3=A3o?= =?UTF-8?q?=20em=20normajuridica=5Fdetail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/norma/views.py | 24 ++++++++++-------- ...cao.a90234d6.js => compilacao.77fbad73.js} | 2 +- .../frontend/js/compilacao.77fbad73.js.gz | Bin 0 -> 6798 bytes .../frontend/js/compilacao.a90234d6.js.gz | Bin 6792 -> 0 bytes sapl/templates/compilacao/subnav.html | 1 - sapl/templates/compilacao/text_edit.html | 6 ++--- .../compilacao/text_list__embedded.html | 6 +++-- .../compilacao/textoarticulado_detail.html | 3 ++- .../templates/norma/normajuridica_detail.html | 3 ++- sapl/webpack-stats.json | 1 - 10 files changed, 25 insertions(+), 21 deletions(-) rename sapl/static/sapl/frontend/js/{compilacao.a90234d6.js => compilacao.77fbad73.js} (52%) create mode 100644 sapl/static/sapl/frontend/js/compilacao.77fbad73.js.gz delete mode 100644 sapl/static/sapl/frontend/js/compilacao.a90234d6.js.gz delete mode 100644 sapl/webpack-stats.json diff --git a/sapl/norma/views.py b/sapl/norma/views.py index c593d89a3..5fd5f0a5e 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -274,7 +274,8 @@ class NormaCrud(Crud): pk=self.kwargs['pk'] ) - # Feito desta forma para que sejam materializados os assuntos antigos + # Feito desta forma para que sejam materializados os assuntos + # antigos assuntos_antigos = set(norma_antiga.assuntos.all()) dict_objeto_antigo = norma_antiga.__dict__ @@ -282,11 +283,11 @@ class NormaCrud(Crud): dict_objeto_novo = self.object.__dict__ atributos = ['tipo_id', 'numero', 'ano', 'data', 'esfera_federacao', - 'complemento', 'materia_id', 'numero', - 'data_publicacao', 'data_vigencia', - 'veiculo_publicacao', 'pagina_inicio_publicacao', - 'pagina_fim_publicacao', 'ementa', 'indexacao', - 'observacao', 'texto_integral'] + 'complemento', 'materia_id', 'numero', + 'data_publicacao', 'data_vigencia', + 'veiculo_publicacao', 'pagina_inicio_publicacao', + 'pagina_fim_publicacao', 'ementa', 'indexacao', + 'observacao', 'texto_integral'] for atributo in atributos: if dict_objeto_antigo[atributo] != dict_objeto_novo[atributo]: @@ -294,8 +295,9 @@ class NormaCrud(Crud): self.object.ip = get_client_ip(self.request) self.object.save() break - - # Campo Assuntos não veio no __dict__, então é comparado separadamente + + # Campo Assuntos não veio no __dict__, então é comparado + # separadamente assuntos_novos = set(self.object.assuntos.all()) if assuntos_antigos != assuntos_novos: self.object.user = self.request.user @@ -391,7 +393,8 @@ class ImpressosView(PermissionRequiredMixin, TemplateView): def gerar_pdf_impressos(request, context, template_name): template = loader.get_template(template_name) html = template.render(context, request) - pdf = weasyprint.HTML(string=html, base_url=request.build_absolute_uri()).write_pdf() + pdf = weasyprint.HTML( + string=html, base_url=request.build_absolute_uri()).write_pdf() response = HttpResponse(pdf, content_type='application/pdf') response['Content-Disposition'] = 'inline; filename="relatorio_impressos.pdf"' @@ -418,7 +421,8 @@ class NormaPesquisaSimplesView(PermissionRequiredMixin, FormView): kwargs.update({'data__gte': form.cleaned_data['data_inicial'], 'data__lte': form.cleaned_data['data_final']}) - normas = NormaJuridica.objects.filter(**kwargs).order_by('-numero', 'ano') + normas = NormaJuridica.objects.filter( + **kwargs).order_by('-numero', 'ano') quantidade_normas = normas.count() normas = normas[:2000] if quantidade_normas > 2000 else normas diff --git a/sapl/static/sapl/frontend/js/compilacao.a90234d6.js b/sapl/static/sapl/frontend/js/compilacao.77fbad73.js similarity index 52% rename from sapl/static/sapl/frontend/js/compilacao.a90234d6.js rename to sapl/static/sapl/frontend/js/compilacao.77fbad73.js index 8202550c9..047b550cc 100644 --- a/sapl/static/sapl/frontend/js/compilacao.a90234d6.js +++ b/sapl/static/sapl/frontend/js/compilacao.77fbad73.js @@ -1 +1 @@ -!function(t){function e(e){for(var o,s,r=e[0],d=e[1],l=e[2],p=0,f=[];p .dpt-form").html(""),e(".dpt-actions, .dpt-actions-bottom").html(""),window.tinymce.remove(),e(".dpt-selected").removeClass("dpt-selected")},t.editDispositivo=function(i){var o=i.target.classList.contains("dpt-link")?i.target:i.target.parentElement.classList.contains("dpt-link")?i.target.parentElement:null;if(!(o&&o.getAttribute("href")&&o.getAttribute("href").length>0)){var n=e(this).closest(".dpt");if(n.hasClass("dpt-selected"))"editor-close"===this.getAttribute("action")&&t.clearEditSelected();else{t.clearEditSelected(),t.loadActionsEdit(n);var a=n.attr("formtype");n.on(a,t[a]),t.loadForm(n,a)}}},t.gc=function(){setTimeout((function(){e(".dpt:not(.dpt-selected) > .dpt-form").html("")}),500)},t.get_form_base=function(){var i=e(this);i.addClass("dpt-selected"),i.children().filter(".dpt-form").find("form").submit(t.onSubmitEditFormBase),t.scrollTo(i),i.off("get_form_base"),i.find(".btn-fechar").on("click",(function(e){t.clearEditSelected(),e.preventDefault()}));var o=i.find(".btns-excluir");i.find(".dpt-actions-bottom").first().append(o),o.find(".btn-outline-danger").on("click",t.bindActionsClick)},t.get_form_alteracao=function(){var i=e(this);i.off("get_form_alteracao"),e(".dpt-actions, .dpt-actions-bottom").html("");var o=i.children().filter(".dpt-form").children().first(),n=o[0].id_dispositivo_search_form.value;window.DispositivoSearch({url_form:n,text_button:"Selecionar",autostart:!0}),t.scrollTo(i),o.submit(t.onSubmitFormRegistraAlteracao),i.find(".btn-fechar").on("click",(function(e){t.clearEditSelected(),t.triggerBtnDptEdit(i.attr("pk")),e.preventDefault()}))},t.get_form_inclusao=function(){var i=e(this);i.off("get_form_inclusao"),e(".dpt-actions, .dpt-actions-bottom").html("");var o=i.children().filter(".dpt-form").children().first(),n=o[0].id_dispositivo_search_form.value;window.DispositivoSearch({url_form:n,text_button:"Selecionar",post_selected:t.allowed_inserts_registro_inclusao,params_post_selected:{pk_bloco:i.attr("pk")},autostart:!0}),t.scrollTo(i),o.submit(t.onSubmitFormRegistraInclusao),i.find(".btn-fechar").on("click",(function(e){t.clearEditSelected(),t.triggerBtnDptEdit(i.attr("pk")),e.preventDefault()}))},t.get_form_revogacao=function(){var i=e(this);i.off("get_form_revogacao"),e(".dpt-actions, .dpt-actions-bottom").html("");var o=i.children().filter(".dpt-form").children().first(),n=o[0].id_dispositivo_search_form.value;window.DispositivoSearch({url_form:n,text_button:"Selecionar",autostart:!0}),t.scrollTo(i),o.submit(t.onSubmitFormRegistraRevogacao),i.find(".btn-fechar").on("click",(function(){t.clearEditSelected(),t.triggerBtnDptEdit(i.attr("pk"))}))},t.allowed_inserts_registro_inclusao=function(i){var o=e("#id"+i.pk_bloco+" input[name='dispositivo_base_para_inclusao']");if(0!==o.length){var n=o[0].value,a={action:"get_actions_allowed_inserts_registro_inclusao",pk_bloco:i.pk_bloco},s=n+"/refresh";t.waitShow(),e.get(s,a).done((function(i){e(".allowed_inserts").html(i),e(".allowed_inserts").find(".btn-action").on("click",t.bindActionsClick)})).fail(t.waitHide).always(t.waitHide)}},t.loadActionsEdit=function(o){var n=o.attr("pk")+"/refresh?action=get_actions";e.get(n).done((function(n){o.find(".dpt-actions").first().html(n),o.find(".btn-action").on("click",t.bindActionsClick),o.find(".btn-compila").on("click",t.loadFormsCompilacao),o.find(".btn-editor-type").on("click",t.bindActionsEditorType),"construct"===i&&(o.find(".btn-group-inserts").first().addClass("open show"),o.find(".btn-group-inserts ul").first().addClass("show")),o.find(".btn-group-inserts button").mouseenter((function(t){o.find(".btn-group-inserts ul").removeClass("show"),o.find(".btn-group-inserts").removeClass("open show"),e(this.parentElement).addClass("open show"),e(this.parentElement).find("ul").addClass("show")})),o.find(".btn-group-inserts").mouseleave((function(t){o.find(".btn-group-inserts ul").removeClass("show"),o.find(".btn-group-inserts").removeClass("open show")})),t.gc()}))},t.loadForm=function(o,n){var a=o.attr("pk"),s=o.children().filter(".dpt-form");if(1===s.length){var r=a+"/refresh?action="+n;e.get(r).done((function(t){"construct"!==i&&(s.html(t),"tinymce"===i&&window.initTextRichEditor()),o.trigger(n)})).always((function(){t.waitHide()}))}},t.loadFormsCompilacao=function(i){var o=e(this).closest(".dpt"),n=this.getAttribute("action");o.on(n,t[n]),t.loadForm(o,n)},t.modalMessage=function(t,i,o){return null!==t&&""!==t&&(e("#modal-message #message").html(t),e("#modal-message").modal("show"),e("#modal-message, #modal-message .alert button").off(),e("#modal-message .alert").removeClass("alert-success alert-info alert-warning alert-danger alert-danger"),e("#modal-message .alert").addClass(i),null!=o&&e("#modal-message").on("hidden.bs.modal",o),e("#modal-message .alert button").on("click",(function(){e("#modal-message").modal("hide")})),!0)},t.message=function(i){if(void 0!==i.message)if(i.message.modal)t.modalMessage(i.message.value,"alert-"+i.message.type,(function(){t.waitShow(),t.refreshScreenFocusPk(i)}));else{if(t.refreshScreenFocusPk(i),!("message"in i))return;var o=e(".cp-notify");o.removeClass("hide");var n=o.find(".message");n.text(i.message.value),n.removeClass("bg-primary bg-success bg-info bg-warning bg-danger").addClass("bg-"+i.message.type),setTimeout((function(){o.addClass("hide")}),i.message.time?i.message.time:3e3)}else t.refreshScreenFocusPk(i)},t.offClicks=function(){e(".btn-dpt-edit").off()},t.onClicks=function(i){(null==i?e(".btn-dpt-edit"):e(i).find(".btn-dpt-edit")).on("click",t.editDispositivo)},t.onSubmitFormRegistraAlteracao=function(i){if(void 0===this.dispositivo_alterado)return t.modalMessage("Nenhum dispositivo selecionado","alert-info"),void(null!=i&&i.preventDefault());var o=void 0===this.dispositivo_alterado.length?[this.dispositivo_alterado]:Array.from(this.dispositivo_alterado),n={csrfmiddlewaretoken:this.csrfmiddlewaretoken.value,dispositivo_alterado:o.filter((function(t,e,i){return t.checked})).map((function(t){return t.value})),formtype:"get_form_alteracao"},a=e(this).closest(".dpt").attr("pk")+"/refresh";t.waitShow(),e.post(a,n).done((function(e){t.clearEditSelected(),null!=e.pk?t.message(e):alert("Erro na resposta!")})).always((function(){t.waitHide()})),null!=i&&i.preventDefault()},t.onSubmitFormRegistraInclusao=function(i){var o={csrfmiddlewaretoken:this.csrfmiddlewaretoken.value,dispositivo_base_para_inclusao:this.dispositivo_base_para_inclusao.value,formtype:"get_form_inclusao"},n=e(this).closest(".dpt").attr("pk")+"/refresh";t.waitShow(),e.post(n,o).done((function(e){t.clearEditSelected(),null!=e.pk?t.message(e):alert("Erro na resposta!")})).always((function(){t.waitHide()})),null!=i&&i.preventDefault()},t.onSubmitFormRegistraRevogacao=function(i){if(void 0===this.dispositivo_revogado)return t.modalMessage("Nenhum dispositivo selecionado","alert-info"),void(null!=i&&i.preventDefault());var o=void 0===this.dispositivo_revogado.length?[this.dispositivo_revogado]:Array.from(this.dispositivo_revogado),n={csrfmiddlewaretoken:this.csrfmiddlewaretoken.value,dispositivo_revogado:o.filter((function(t,e,i){return t.checked})).map((function(t){return t.value})),revogacao_em_bloco:this.revogacao_em_bloco.value,formtype:"get_form_revogacao"},a=e(this).closest(".dpt").attr("pk")+"/refresh";t.waitShow(),e.post(a,n).done((function(e){t.clearEditSelected(),null!=e.pk?t.message(e):alert("Erro na resposta!")})).always((function(){t.waitHide()})),null!=i&&i.preventDefault()},t.onSubmitEditFormBase=function(i){var o=this,n="",a="",s="",r=window.tinymce.get("id_texto"),d=window.tinymce.get("id_texto_atualizador");n=null!=r?r.getContent():this.id_texto.value,null!=d?a=d.getContent():"id_texto_atualizador"in this&&(a=this.id_texto_atualizador.value),"visibilidade"in this&&(s=this.visibilidade.value);var l={csrfmiddlewaretoken:this.csrfmiddlewaretoken.value,texto:n,texto_atualizador:a,visibilidade:s,formtype:"get_form_base"},c=e(this).closest(".dpt").attr("pk")+"/refresh";t.waitShow(),e.post(c,l).done((function(i){if("string"==typeof i){var n=e(o).closest(".dpt");return n=e("#"+n.replaceWith(i).attr("id")),t.onClicks(n),void t.waitHide()}t.clearEditSelected(),null!=i.pk?t.message(i):alert("Erro na resposta!")})).always((function(){t.waitHide()})),null!=i&&i.preventDefault()},t.refreshContent=function(i,o){if(0!==i.length){var n=i.shift(),a=n+"/refresh";e.get(a).done((function(a){var s=e("#id"+n).closest(".dpt");s=e("#"+s.replaceWith(a).attr("id")),t.onClicks(s),t.reloadFunctionsDraggables(),o>0&&t.triggerBtnDptEdit(o),t.refreshContent(i)}))}else t.waitHide()},t.refreshScreenFocusPk=function(e){if(t.waitShow(),-1===e.pai[0]){t.waitShow();var i=location.href.split("#")[0];location.href=i+"#"+e.pk,location.reload(!0)}else t.refreshContent(e.pai,e.pk)},t.reloadFunctionsDraggables=function(){e(".dpt-alts").sortable({revert:!0,distance:15,start:function(t,e){},stop:function(t,i){var o=i.item.attr("pk"),n=i.item.closest(".dpt-alts").closest(".dpt").attr("pk"),a=o+"/refresh?action=json_drag_move_dpt_alterado&index="+i.item.index()+"&bloco_pk="+n;e.get(a).done((function(t){}))}}),e(".dpt-alts .dpt").draggable({connectToSortable:".dpt-alts",revert:"invalid",zIndex:1,distance:15,drag:function(t,i){e(".dpt-alts").addClass("drag")},stop:function(t,i){e(".dpt-alts").removeClass("drag")}}),e(".dpt-alts").disableSelection()},t.scrollTo=function(t){try{e("html, body").animate({scrollTop:t.offset().top-window.innerHeight/9},100)}catch(t){}},t.triggerBtnDptEdit=function(t){var i=e("#id"+t+" > .dpt-text.btn-dpt-edit");0===i.length&&(i=e("#id"+t+" > .dpt-actions-fixed > .btn-dpt-edit")),i.first().trigger("click")},t.waitHide=function(){e("#wait_message").addClass("displaynone")},t.waitShow=function(){e("#wait_message").removeClass("displaynone")},t.init=function(){e(".dpt-actions-fixed").first().css("opacity","1"),null!==(i=window.ReadCookie("editortype"))&&""!==i||(i="textarea",window.SetCookie("editortype",i,30)),t.offClicks(),t.onClicks(),t.reloadFunctionsDraggables();var o=location.href.split("#");2===o.length&&""!==o[1]&&t.triggerBtnDptEdit(o[1]),e("main").click((function(e){e.target!==this&&e.target!==this.firstElementChild||t.clearEditSelected()})),t.waitHide()},t.init()},e(document).ready((function(){t(".cpe").length>0&&window.DispositivoEdit()}))}).call(this,i("1157"))},1:function(t,e,i){t.exports=i("6ccd")},"4a8b":function(t,e,i){"use strict";i("7514");var o=window.$;function n(t){o(t).append('
')}e.a={SetCookie:function(t,e,i){var o=new Date,n=new Date;null!==i&&0!==i||(i=1),n.setTime(o.getTime()+864e5*i),document.cookie=t+"="+escape(e)+";expires="+n.toGMTString()},ReadCookie:function(t){var e=" "+document.cookie,i=e.indexOf(" "+t+"=");if(-1===i&&(i=e.indexOf(";"+t+"=")),-1===i||""===t)return"";var o=e.indexOf(";",i+1);return-1===o&&(o=e.length),unescape(e.substring(i+t.length+2,o))},insertWaitAjax:n,DispositivoSearch:function(t){o((function(){var e={},i=o("body").children("#container_ds");i.length>0&&o(i).remove(),i=o('
'),o("body").prepend(i),o('[data-sapl-ta="DispositivoSearch"]').each((function(){var a=o(this),s=a.attr("data-type-selection"),r=a.attr("data-field"),d=a.attr("data-function"),l=function(t){if("checkbox"===s){var e=a.find('input[name="ta_select_all"]');e.off(),e.on("change",(function(t){o(this).closest("ul").find('input[name="'+r+'"]').prop("checked",this.checked)}))}else{var i=a.find("input");i.off(),i.attr("type","hidden"),o('').insertBefore(i).append(o('')).on("click",(function(){2===o(this).closest("ul").find("li").length?o(this).closest("ul").remove():o(this).closest("li").remove()}))}};l();var c=function(t){var i=o('select[name="tipo_ta"]').val(),a=o('select[name="tipo_model"]').val(),l=o('input[name="num_ta"]').val(),c=o('input[name="ano_ta"]').val(),p=o('input[name="tipo_resultado"]:checked').val(),f=o('input[name="rotulo_dispositivo"]').val(),u=o('input[name="texto_dispositivo"]').val(),m=o('select[name="max_results"]').val();f.length>0||u.length>0?(o('input[name="tipo_resultado"]').prop("disabled",!1),o('input[name="tipo_resultado"]').each((function(t,e){e.parentElement.classList.remove("disabled")})),o('input[name="tipo_resultado"]').closest("#div_id_tipo_resultado").css("opacity","1")):(o('input[name="tipo_resultado"]').filter('[value="False"]').prop("checked",!0),o('input[name="tipo_resultado"]').prop("disabled",!0),o('input[name="tipo_resultado"]').each((function(t,e){e.parentElement.classList.add("disabled")})),o('input[name="tipo_resultado"]').closest("#div_id_tipo_resultado").css("opacity","0.3"),p="False"),e={tipo_ta:i,tipo_model:a,num_ta:l,ano_ta:c,texto:u,rotulo:f,tipo_resultado:p,max_results:m,data_type_selection:s,data_field:r,data_function:d},window.localStorage.setItem("dispositivo_search_form_data",JSON.stringify(e)),o(".result-busca-dispositivo").html(""),n(".result-busca-dispositivo"),o.get("/ta/search_fragment_form",e).done((function(t){if(o(".result-busca-dispositivo").html(t),"checkbox"===s){var e=o(".result-busca-dispositivo").find('input[name="ta_select_all"]');e.off(),e.on("change",(function(t){o(this).closest("ul").find('input[name="'+r+'"]').prop("checked",this.checked)}))}}))},p=function(t){var e=o('input[name="rotulo_dispositivo"]').val(),i=o('input[name="texto_dispositivo"]').val();e.length>0||i.length>0?(o('input[name="tipo_resultado"]').prop("disabled",!1),o('input[name="tipo_resultado"]').each((function(t,e){e.parentElement.classList.remove("disabled")})),o('input[name="tipo_resultado"]').closest("#div_id_tipo_resultado").css("opacity","1")):(o('input[name="tipo_resultado"]').filter('[value="False"]').prop("checked",!0),o('input[name="tipo_resultado"]').prop("disabled",!0),o('input[name="tipo_resultado"]').each((function(t,e){e.parentElement.classList.add("disabled")})),o('input[name="tipo_resultado"]').closest("#div_id_tipo_resultado").css("opacity","0.3"))},f=a.children("#buttonDs");f.length>0&&o(f).remove(),f=o('
'),a.prepend(f);var u=o("