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. 27
      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(
'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):
return True
if not request:
return False
if request.user in self.owners.all():
return True

27
sapl/templates/compilacao/text_list__embedded.html

@ -1,4 +1,3 @@
{% extends "base.html" %}
{% load i18n %}
{% load compilacao_filters %}
{% load common_tags %}
@ -9,20 +8,6 @@
<link rel="stylesheet" href="{% sass_src 'styles/compilacao.scss' %}" type="text/css">
{% 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">
{% if object_list %}
@ -93,13 +78,9 @@
</ul>
{% include 'compilacao/text_list_bloco.html'%}
</div>
{% endblock base_content %}
{% block foot_js %}
<script type="text/javascript" src="{% static 'js/compilacao.js' %}"></script>
<script type="text/javascript" src="{% static 'js/compilacao_view.js' %}"></script>
<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 %}
<script type="text/javascript" src="{% static 'js/compilacao_notas.js' %}"></script>
{% endif %}
{% endblock %}
<script type="text/javascript" src="{% static 'js/compilacao_notas.js' %}"></script>
{% endif %}

6
sapl/templates/norma/normajuridica_detail.html

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

Loading…
Cancel
Save