Browse Source

Fix #2121 e parte da #2220

pull/2250/head
Leandro Roberto 6 years ago
parent
commit
de7a1ca2bb
  1. 5
      sapl/compilacao/models.py
  2. 23
      sapl/templates/compilacao/text_list__embedded.html
  3. 6
      sapl/templates/norma/normajuridica_detail.html

5
sapl/compilacao/models.py

@ -266,10 +266,13 @@ class TextoArticulado(TimestampedMixin):
user.has_perm( user.has_perm(
'compilacao.change_your_dispositivo_edicao_dinamica')) 'compilacao.change_your_dispositivo_edicao_dinamica'))
def has_view_permission(self, request): def has_view_permission(self, request=None):
if self.privacidade in (STATUS_TA_IMMUTABLE_PUBLIC, STATUS_TA_PUBLIC): if self.privacidade in (STATUS_TA_IMMUTABLE_PUBLIC, STATUS_TA_PUBLIC):
return True return True
if not request:
return False
if request.user in self.owners.all(): if request.user in self.owners.all():
return True return True

23
sapl/templates/compilacao/text_list__embedded.html

@ -1,4 +1,3 @@
{% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load compilacao_filters %} {% load compilacao_filters %}
{% load common_tags %} {% load common_tags %}
@ -9,20 +8,6 @@
<link rel="stylesheet" href="{% sass_src 'styles/compilacao.scss' %}" type="text/css"> <link rel="stylesheet" href="{% sass_src 'styles/compilacao.scss' %}" type="text/css">
{% endblock %} {% endblock %}
{% block navigation %}{% endblock %}
{% block main_header %}{% endblock %}
{% block title %}{% endblock %}
{% block sections_nav %}{% endblock %}
{% block extra_sections_nav %}{% endblock %}
{% block actions %}{% endblock %}
{% block dsp_actions %}{% endblock %}
{% block detail_content %}{% endblock %}
{% block footer_container %}{% endblock %}
{% block base_content %}
<div class="cp"> <div class="cp">
{% if object_list %} {% if object_list %}
@ -93,13 +78,9 @@
</ul> </ul>
{% include 'compilacao/text_list_bloco.html'%} {% include 'compilacao/text_list_bloco.html'%}
</div> </div>
{% endblock base_content %} <script type="text/javascript" src="{% static 'js/compilacao.js' %}"></script>
<script type="text/javascript" src="{% static 'js/compilacao_view.js' %}"></script>
{% block foot_js %}
<script type="text/javascript" src="{% static 'js/compilacao.js' %}"></script>
<script type="text/javascript" src="{% static 'js/compilacao_view.js' %}"></script>
{% if perms.compilacao.add_nota %} {% if perms.compilacao.add_nota %}
<script type="text/javascript" src="{% static 'js/compilacao_notas.js' %}"></script> <script type="text/javascript" src="{% static 'js/compilacao_notas.js' %}"></script>
{% endif %} {% endif %}
{% endblock %}

6
sapl/templates/norma/normajuridica_detail.html

@ -77,7 +77,7 @@
</div> </div>
</div> </div>
{% if object.texto_articulado.exists %} {% if object.texto_articulado.exists and object.texto_articulado.first.has_view_permission %}
<hr /> <hr />
<div class="row-fluid"> <div class="row-fluid">
<div class="col-sm-12"> <div class="col-sm-12">
@ -90,13 +90,13 @@
{% endblock detail_content %} {% endblock detail_content %}
{% block extra_js %} {% block extra_js %}
{% if object.texto_articulado.exists %} {% if object.texto_articulado.exists and object.texto_articulado.first.has_view_permission %}
<script language="Javascript"> <script language="Javascript">
window.onload = function () { window.onload = function () {
$.get("{% url 'sapl.compilacao:ta_text' object.texto_articulado.first.id %}?embedded", $.get("{% url 'sapl.compilacao:ta_text' object.texto_articulado.first.id %}?embedded",
function(data, status) { function(data, status) {
$('#textomultivigente').html(data) $('#textomultivigente').html(data)
$('a').dropdown() $('cp a[data-toggle="dropdown"]').dropdown()
$('.dne').remove() $('.dne').remove()
}); });
} }

Loading…
Cancel
Save