]> git.parisson.com Git - teleforma.git/commitdiff
fix doc typed list, styles
authoryomguy <yomguy@parisson.com>
Thu, 7 Jun 2012 14:16:07 +0000 (16:16 +0200)
committeryomguy <yomguy@parisson.com>
Thu, 7 Jun 2012 14:16:07 +0000 (16:16 +0200)
teleforma/models.py
teleforma/static/teleforma/css/teleforma.css
teleforma/templates/teleforma/course_detail.html
teleforma/templates/teleforma/inc/conference_list.html
teleforma/templates/teleforma/inc/document_list.html
teleforma/templates/teleforma/inc/media_list.html
teleforma/templatetags/teleforma_tags.py
teleforma/views.py

index 03fb191f161f8af0b367bad30faf95f76a37c323..e5bf53fbbb9a9bc389a63c8cdb5ab529112a236c 100755 (executable)
@@ -346,7 +346,7 @@ class Document(MediaBase):
 
     class Meta:
         db_table = app_label + '_' + 'document'
-        ordering = ['-date_modified']
+        ordering = ['-date_added']
 
 
 class Media(MediaBase):
index f803ce3d5d06b4a0a0422dcd5a17fa26667ce786..1df0edfb01bc997439210033c843fd1b4e08750f 100644 (file)
@@ -1574,4 +1574,11 @@ input,textarea{
 #paginate_fix {
     padding: 1em 0em 0em 0em;
     margin: 0em 0em -0.8em 0em;
+    }
+
+.doc_type_title {
+    padding: 0em 0em 0em 1.5em;
+    font-weight: bold;
+    font-size: 0.8125em;
+    text-align: center;
     }
\ No newline at end of file
index f8eaa7e2d34c5d812cefc7b7ce068a35f954ab65..e8754e8760bfe279b3e4380353fc1741f4f5e03f 100644 (file)
@@ -21,7 +21,7 @@ $(document).ready(function(){
 {% endblock courses %}
 
 {% block course %}
-<div class="desk_media">
+<div class="desk_center">
     {% for c in courses %}
      {% for course in c.courses %}
       {% for type in c.types %}
@@ -50,7 +50,7 @@ $(document).ready(function(){
 
 {% block chat %}
 {% if room %}
-<div id="module-set" style="width: 24%">
+<div id="module-set" style="width: 22%">
 {% with "Local tweeter" as title %}
 {% include "teleforma/inc/chat_room.html" %}
 {% endwith %}
index 8b01e3d5cf6f85b6fb854c190e0ea5f9e8bec306..9d2e0ed2e5a86a10c0e1c31d381421ca1787c465 100644 (file)
@@ -1,7 +1,7 @@
 {% load teleforma_tags %}
 {% load i18n %}
 
-{% if course.conference.all|from_type:type %}
+{% if course.conference.all|from_course_type:type %}
 <div class="course_content">
 <div class="course_subtitle">
     <h3><img src="{% url telemeta-images "item_title.png" %}" style="vertical-align:middle" /> {% trans "Live conference"%}</h3>
@@ -16,7 +16,7 @@
         </tr>
     </thead>
     <tbody>
-        {% for conference in course.conference.all|from_type:type %}
+        {% for conference in course.conference.all|from_course_type:type %}
             <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
             <td><a href="{% url teleforma-conference-detail conference.id %}">{{ conference.session }}</a></td>
             <td><a href="{% url telemeta-profile-detail conference.professor.user.username %}" target="_blank">{{ conference.professor }}</a></td>
index 5b118be49f8782ac43e1aeefff8aa29d46761d02..a0e494ced1e0330098ffb3387b56e0d9011f2811 100644 (file)
@@ -1,11 +1,15 @@
 {% load teleforma_tags %}
 {% load i18n %}
 
-{% if course.document.all|from_type:type %}
+{% if course.document.all|from_course_type:type %}
 <div class="course_content">
 <div class="course_subtitle">
 <h3><img src="{% url telemeta-images "item_title.png" %}" style="vertical-align:middle" /> {% trans "Documents"%}</h3>
 </div>
+
+{% for doc_type in doc_types %}
+{% if course.document.all|from_doc_type:doc_type %}
+<span class="doc_type_title">{{ doc_type }}</span>
 <table class="listing" width="100%">
     <thead>
         <tr>
@@ -16,7 +20,8 @@
         </tr>
     </thead>
     <tbody>
-        {% for document in course.document.all|from_type:type %}
+        {% for document in course.document.all|from_course_type:type %}
+        {% if document.type == doc_type %}
         <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
         <td>{% if document.file %}<a href="{% url teleforma-document-detail document.id %}" target="_blank">{% endif %}{{ document.title }}{% if document.file %}</a>{% endif %}</td>
         <td align="center">
         <td>{{ document.date_added }}</td>
         <td align="center">{% if document.file %}<a href="{% url teleforma-document-download document.id %}"><img src="{% url telemeta-images "download.png" %}" width="16px"  style="vertical-align:middle" /></a>{% endif %}</td>
         </tr>
+        {% endif %}
     {% endfor %}
     </tbody>
 </table>
+{% endif %}
+{% endfor %}
 </div>
 
 {% else %}
index 63401f03b3a23a8051b20ea396aa0ff530a4f372..f25dcb683a041e289e42a56de45ccaf206d685f3 100644 (file)
@@ -1,7 +1,7 @@
 {% load teleforma_tags %}
 {% load i18n %}
 
-{% if course.media.all|from_type:type %}
+{% if course.media.all|from_course_type:type %}
 <div class="course_content">
 <div class="course_subtitle">
     <h3><img src="{% url telemeta-images "item_title.png" %}" style="vertical-align:middle" /> {% trans "Passed conferences"%}</h3>
@@ -16,7 +16,7 @@
         </tr>
     </thead>
     <tbody>
-        {% for media in course.media.all|from_type:type %}
+        {% for media in course.media.all|from_course_type:type %}
          {% if media.published or user.is_staff %}
             <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
             <td><a href="{% url teleforma-media-detail media.id %}">{{ media.conference.session }}</a></td>
index 184e9aee50d6118bf266e8562d30fe393118e91d..1cf493d4019e4391f7b06c629a663ebf83b03786 100644 (file)
@@ -100,5 +100,9 @@ def yes_no(bool):
         return _('No')
 
 @register.filter
-def from_type(docs, type):
+def from_course_type(docs, type):
     return docs.filter(course_type=type)
+
+@register.filter
+def from_doc_type(docs, type):
+    return docs.filter(type=type)
index 059d0a84e1b5af6d3b96dc9e36a76f337ba83bb2..ca7cef33d45994384468b502dcd33e106d4a29a0 100755 (executable)
@@ -159,6 +159,7 @@ class CourseView(DetailView):
         content_type = ContentType.objects.get(app_label="teleforma", model="course")
         context['room'] = get_room(name=course.title, content_type=content_type,
                                    id=course.id)
+        context['doc_types'] = DocumentType.objects.all()
         return context
 
     @method_decorator(login_required)
@@ -178,6 +179,7 @@ class CoursesView(ListView):
         context = super(CoursesView, self).get_context_data(**kwargs)
         context['notes'] = Note.objects.filter(author=self.request.user)
         context['room'] = get_room(name='site')
+        context['doc_types'] = DocumentType.objects.all()
         return context
 
     @method_decorator(login_required)