]> git.parisson.com Git - teleforma.git/commitdiff
add testimonial links and filename
authoryomguy <yomguy@parisson.com>
Thu, 20 Dec 2012 12:16:04 +0000 (13:16 +0100)
committeryomguy <yomguy@parisson.com>
Thu, 20 Dec 2012 12:16:04 +0000 (13:16 +0100)
teleforma/templates/teleforma/inc/testimonial_list.html [new file with mode: 0644]
teleforma/templates/teleforma/seminar_detail.html
teleforma/urls.py
teleforma/views/pro.py

diff --git a/teleforma/templates/teleforma/inc/testimonial_list.html b/teleforma/templates/teleforma/inc/testimonial_list.html
new file mode 100644 (file)
index 0000000..e5ccb49
--- /dev/null
@@ -0,0 +1,22 @@
+{% load teleforma_tags %}
+{% load i18n %}
+
+<div class="course_content">
+
+<div class="course_subtitle">
+<h3><img src="{{ STATIC_URL }}/telemeta/images/item_title.png" width="10px" alt="" /> {{ title }}</h3>
+</div>
+
+<table class="listing" width="100%">
+    <tbody>
+        
+            <tr>
+            <td {% if forloop.first %}class="border-top"{% endif %} width="95%"><a href="{% url teleforma-seminar-testimonial seminar.id %}?format=pdf" target="_blank" title="{% trans "Testimonial" %}"><img src="{{ STATIC_URL }}/teleforma/images/application-msword.png" style="vertical-align:middle" alt="" /> {% trans "Testimonial" %} : {{ seminar.title }}{% if seminar.rank %} n°{{seminar.rank}}{% endif %}</a></td>
+            <td {% if forloop.first %}class="border-top"{% endif %} width="5%" align="center"><a href="{% url teleforma-seminar-testimonial-download seminar.id %}?format=pdf"><img src="{{ STATIC_URL }}teleforma/images/download.png" style="vertical-align:middle" alt="" title="{% trans "Download" %}" /></a></td>
+            </tr>
+        
+    </tbody>
+</table>
+
+</div>
+
index 64e96592486081d3c935493b5f2201bc42f06fed..2a8841f9e6ee8264428d3b02e4af05209a4672a0 100644 (file)
@@ -142,6 +142,10 @@ $(function() {
            {% endwith %}
           {% endwith %}
 
+           {% with _("Step 7 : download your testimonial") as title %}
+            {% include "teleforma/inc/testimonial_list.html" %}
+           {% endwith %}
+
          {% endif %}
 
       {% endblock course_content %}
index 87406de0a36f3a98cd7333ee39e0cf14de27d4e6..d40884e7e45c79ef3fabe8dee368257237da48cc 100644 (file)
@@ -47,7 +47,6 @@ user_export = UsersXLSExport()
 profile_view = ProfileView()
 document = DocumentView()
 media = MediaView()
-testimonial = TestimonialView()
 
 urlpatterns = patterns('',
 #    url(r'^$', HomeView.as_view(), name='teleforma-home'),
@@ -107,6 +106,8 @@ urlpatterns = patterns('',
     # Testimonial
     url(r'^desk/seminars/(?P<pk>.*)/testimonial/$', TestimonialView.as_view(), 
                                                     name="teleforma-seminar-testimonial"),
+    url(r'^desk/seminars/(?P<pk>.*)/testimonial/download/$', TestimonialDownloadView.as_view(), 
+                                                    name="teleforma-seminar-testimonial-download"),
 
     # Postman
     url(r'^messages/', include('postman.urls')),
index 1d71238b65e9d18ef1bb22e61ce96b3f242877a1..392856a34294f034f6d71174a63fc6f96384ee4c 100644 (file)
@@ -547,9 +547,24 @@ class TestimonialView(PDFTemplateResponseMixin, SeminarView):
     @method_decorator(login_required)
     def dispatch(self, *args, **kwargs):
         return super(TestimonialView, self).dispatch(*args, **kwargs)
-    
+
     def get_context_data(self, **kwargs):
         context = super(TestimonialView, self).get_context_data(**kwargs)        
         context['seminar'] = self.get_object()
         return context
 
+
+class TestimonialDownloadView(TestimonialView):
+
+    pdf_filename = 'testimonial.pdf'
+
+    def get_pdf_filename(self):
+        super(TestimonialView, self).get_pdf_filename()
+        seminar = self.get_object()
+        prefix = unicode(_('Testimonial'))
+        filename = '_'.join([prefix, seminar.title, 
+                            self.request.user.first_name, self.request.user.last_name,])
+        filename += '.pdf'
+        return filename.encode('utf-8')
+
+