From 4d9d47e7578dd14fa0fb710f2ee538f4a6882f97 Mon Sep 17 00:00:00 2001 From: Mariana Mendes Date: Tue, 3 Oct 2017 11:45:38 -0300 Subject: [PATCH 1/6] Corrige a url do help_path e adiciona parte das urls no template. --- sapl/base/urls.py | 9 ++-- sapl/base/views.py | 9 ++-- sapl/templates/ajuda.html | 50 +++++++++---------- .../templates/ajuda/modulo_parlamentares.html | 16 +++--- 4 files changed, 43 insertions(+), 41 deletions(-) diff --git a/sapl/base/urls.py b/sapl/base/urls.py index ed55f1767..6273b9912 100644 --- a/sapl/base/urls.py +++ b/sapl/base/urls.py @@ -11,7 +11,7 @@ from sapl.settings import EMAIL_SEND_USER from .apps import AppConfig from .forms import LoginForm, NovaSenhaForm, RecuperarSenhaForm -from .views import (AppConfigCrud, CasaLegislativaCrud, HelpView, +from .views import (AppConfigCrud, CasaLegislativaCrud, HelpTopicView, RelatorioAtasView, RelatorioHistoricoTramitacaoView, RelatorioMateriasPorAnoAutorTipoView, RelatorioMateriasPorAutorView, @@ -54,9 +54,10 @@ urlpatterns = [ url(r'^sistema/autor/tipo/', include(TipoAutorCrud.get_urls())), url(r'^sistema/autor/', include(AutorCrud.get_urls())), - url(r'^sistema/ajuda/', TemplateView.as_view(template_name='ajuda.html')), - url(r'^sistema/ajuda/(?P\w+)$', - HelpView.as_view(), name='help_topic'), + url(r'^sistema/ajuda/', TemplateView.as_view(template_name='ajuda.html'), + name='help'), + url(r'^sistema/ajuda-topico/$', + HelpTopicView.as_view(), name='help_topic'), url(r'^sistema/ajuda/', TemplateView.as_view(template_name='ajuda/index.html'), name='help_base'), diff --git a/sapl/base/views.py b/sapl/base/views.py index ebfd0f573..f87db51a6 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -492,11 +492,12 @@ class CasaLegislativaCrud(CrudAux): kwargs={'pk': self.kwargs['pk']})) -class HelpView(PermissionRequiredMixin, TemplateView): - # XXX treat non existing template as a 404!!!! - +class HelpTopicView(TemplateView): def get_template_names(self): - return ['ajuda/%s.html' % self.kwargs['topic']] + if 'topic' in self.request.GET and self.request.GET['topic']: + return ['ajuda/%s.html' % self.request.GET['topic']] + else: + return HttpResponseRedirect(reverse('sapl.base:help')) class AppConfigCrud(CrudAux): diff --git a/sapl/templates/ajuda.html b/sapl/templates/ajuda.html index b90f4db25..482240b70 100644 --- a/sapl/templates/ajuda.html +++ b/sapl/templates/ajuda.html @@ -7,44 +7,44 @@