From 7a3ee89548e942fe9f46bc6572a5030ab304d06a Mon Sep 17 00:00:00 2001 From: felipebormann Date: Thu, 9 Feb 2017 16:11:38 -0300 Subject: [PATCH] added header on pdf view and redirect on website link and pdf file are now correct --- links/views.py | 3 ++- pdf_file/templates/pdf_file/view.html | 26 ++++++++++++++++++++++---- pdf_file/views.py | 3 ++- users/templates/users/login.html | 38 ++++++++++++++++++++------------------ 4 files changed, 46 insertions(+), 24 deletions(-) diff --git a/links/views.py b/links/views.py index c9fc59a..4408e02 100644 --- a/links/views.py +++ b/links/views.py @@ -134,7 +134,8 @@ class CreateLinkView(LoginRequiredMixin, LogMixin, generic.edit.CreateView): def get_success_url(self): messages.success(self.request, _('The Link "%s" was added to the Topic "%s" of the virtual environment "%s" successfully!')%(self.object.name, self.object.topic.name, self.object.topic.subject.name)) - return reverse_lazy('subjects:view', kwargs = {'slug': self.object.topic.subject.slug}) + return reverse_lazy('subjects:topic_view', kwargs = {'slug': self.object.topic.subject.slug, 'topic_slug': self.object.topic.slug}) + diff --git a/pdf_file/templates/pdf_file/view.html b/pdf_file/templates/pdf_file/view.html index ff42885..76d6673 100644 --- a/pdf_file/templates/pdf_file/view.html +++ b/pdf_file/templates/pdf_file/view.html @@ -15,16 +15,34 @@ {% block breadcrumbs %} {% clear_breadcrumbs %} {% breadcrumb 'Home' 'subjects:home' %} - {% breadcrumb pdf_file.topic.subject.category 'subjects:cat_view' pdf_file.topic.subject.category.slug %} - {% breadcrumb pdf_file.topic.subject 'subjects:view' pdf_file.topic.subject.slug %} - {% breadcrumb pdf_file.topic 'subjects:topic_view' pdf_file.topic.subject.slug pdf_file.topic.slug %} + {% breadcrumb subject.category 'subjects:cat_view' subject.category.slug %} + {% breadcrumb subject 'subjects:view' subject.slug %} + {% breadcrumb pdf_file.topic 'subjects:topic_view' subject.slug pdf_file.topic.slug %} {% breadcrumb pdf_file 'pdf_file:view' pdf_file.slug %} {% endblock %} {% block content %} - + {% if subject.visible %} +
+
+ {% elif has_subject_permissions %} +
+
+ {% endif %} +
+
+

+ {{ webpage }} +

+ +
+ +
+
+
+

{% trans "PDF could not be displayed" %}

diff --git a/pdf_file/views.py b/pdf_file/views.py index 1690655..b9cd42b 100644 --- a/pdf_file/views.py +++ b/pdf_file/views.py @@ -37,6 +37,7 @@ class ViewPDFFile(generic.TemplateView): slug = self.kwargs.get('slug', '') pdf_file = PDFFile.objects.get(slug=slug) context['pdf_file'] = pdf_file + context['subject'] = pdf_file.topic.subject return context @@ -171,7 +172,7 @@ class PDFFileCreateView(LoginRequiredMixin, LogMixin , generic.CreateView): def get_success_url(self): messages.success(self.request, _('The PDF File "%s" was added to the Topic "%s" of the virtual environment "%s" successfully!')%(self.object.name, self.object.topic.name, self.object.topic.subject.name)) - return reverse_lazy('subjects:view', kwargs = {'slug': self.object.topic.subject.slug}) + return reverse_lazy('subjects:topic_view', kwargs = {'slug': self.object.topic.subject.slug, 'topic_slug': self.object.topic.slug}) class UpdateView(LoginRequiredMixin, LogMixin, generic.UpdateView): diff --git a/users/templates/users/login.html b/users/templates/users/login.html index 9a57f51..272d9cc 100644 --- a/users/templates/users/login.html +++ b/users/templates/users/login.html @@ -55,7 +55,26 @@ - -
-
- {% if not deny_register %} -
- -
- - {% else %} -
- -
- {% endif %} -
-
-
{% if not deny_register %}
-- libgit2 0.21.2