From 8ab87322c655960f29744d705427a290e79f0ce8 Mon Sep 17 00:00:00 2001 From: yomguy Date: Tue, 19 Jun 2012 17:44:35 +0200 Subject: [PATCH] update desk tables, fix livestream properties, imgs to come.. --- teleforma/models.py | 17 +++++++---- teleforma/static/teleforma/css/teleforma.css | 7 ++--- teleforma/templates/postman/base_write.html | 29 +++++++++++++++++-- .../templates/teleforma/course_document.html | 1 - teleforma/templates/teleforma/courses.html | 3 +- .../teleforma/inc/conference_list.html | 16 +++------- .../teleforma/inc/document_list.html | 20 ++++--------- .../templates/teleforma/inc/media_list.html | 15 ++-------- teleforma/templatetags/teleforma_tags.py | 22 ++++++++++++++ teleforma/views.py | 6 ++-- 10 files changed, 83 insertions(+), 53 deletions(-) diff --git a/teleforma/models.py b/teleforma/models.py index 8709ed56..1a854ff7 100755 --- a/teleforma/models.py +++ b/teleforma/models.py @@ -247,21 +247,28 @@ class LiveStream(Model): stream_type = CharField(_('Streaming type'), choices=streaming_choices, max_length=32) + @property + def slug(self): + slug = '-'.join([self.course.department.slug, self.course.slug, + self.course_type.name.lower()]) + return slug + @property def mount_point(self): - slug = '-'.join([self.conference.course.department.slug, self.conference.course.slug, - self.conference.course_type.name.lower()]) if self.server.type == 'stream-m': - return 'consume/' + slug + return 'consume/' + self.slug else: - return slug + '.' + self.stream_type + return self.slug + '.' + self.stream_type @property def url(self): return 'http://' + self.server.host + ':' + self.server.port + '/' + self.mount_point def __unicode__(self): - return self.conference.description + if self.conference: + return self.conference.description + else: + return self.slug class Meta: db_table = app_label + '_' + 'live_stream' diff --git a/teleforma/static/teleforma/css/teleforma.css b/teleforma/static/teleforma/css/teleforma.css index 04f2fb82..29d1dbed 100644 --- a/teleforma/static/teleforma/css/teleforma.css +++ b/teleforma/static/teleforma/css/teleforma.css @@ -885,9 +885,9 @@ table.listing tbody td a:hover, table.listing tbody th a:hover { background-color: transparent; } table.listing tbody tr { border-top: 1px solid #ddd } -table.listing tbody tr.even { background-color: #fcfcfc } -table.listing tbody tr.odd { background-color: #f7f7f7 } -table.listing tbody tr:hover { background: #f7f8fa !important } +table.listing tbody tr.even { background-color: transparent } +table.listing tbody tr.odd { background-color: transparent } +table.listing tbody tr:hover { background: transparent !important } table td.error { color: red; @@ -1464,7 +1464,6 @@ input,textarea{ .course_subtitle { padding: 0.3em; - } .course_content p { diff --git a/teleforma/templates/postman/base_write.html b/teleforma/templates/postman/base_write.html index 23ad3cee..5b0e2690 100644 --- a/teleforma/templates/postman/base_write.html +++ b/teleforma/templates/postman/base_write.html @@ -1,5 +1,7 @@ {% extends "postman/base.html" %} {% load i18n %} +{% load teleforma_tags %} + {% block extrahead %}{{ block.super }} {% if is_autocompleted %} {# using the available admin jQuery is enough #} @@ -9,16 +11,33 @@ {% endif %} {% endblock %} + {% block content %}

{% block pm_write_title %}{% endblock %}

+ +{% if user.student.all %}
+ + + +
+{% endif %} +
{% csrf_token %} @@ -36,8 +55,14 @@ $("#_professorSelect").click(function () { var htmlStr = $(this).val(); $("#id_recipients").val(htmlStr); }); +$("#_adminSelect").click(function () { + var htmlStr = $(this).val(); + $("#id_recipients").val(htmlStr); + }); + } + $('#send_button').click(function() { $('#_messageForm').submit(); }); diff --git a/teleforma/templates/teleforma/course_document.html b/teleforma/templates/teleforma/course_document.html index e7f71d5d..c89cd2c5 100644 --- a/teleforma/templates/teleforma/course_document.html +++ b/teleforma/templates/teleforma/course_document.html @@ -56,7 +56,6 @@ PDFJS.getDocument('{% url teleforma-document-download document.id %}').then(func
{{ document.course.title }}{% for type in document.course_type.all%} - {{ type }}{% endfor %}{% if document.type %} - {{ document.type }}{% endif %}
-{% if document.title %}

{{ document.title }}

{% endif %}
{% if access_error %} diff --git a/teleforma/templates/teleforma/courses.html b/teleforma/templates/teleforma/courses.html index 669a5738..f0f2d7bf 100644 --- a/teleforma/templates/teleforma/courses.html +++ b/teleforma/templates/teleforma/courses.html @@ -58,7 +58,8 @@ $(document).ready(function(){ {% with c.course as course %} {% for type in c.types %}
-
{{ course.title }} - {{ type }}{% if course.description %} - {{ course.description }}{% endif %} + {% block conference %} diff --git a/teleforma/templates/teleforma/inc/conference_list.html b/teleforma/templates/teleforma/inc/conference_list.html index 5c28763d..89d247b9 100644 --- a/teleforma/templates/teleforma/inc/conference_list.html +++ b/teleforma/templates/teleforma/inc/conference_list.html @@ -1,24 +1,16 @@ {% load teleforma_tags %} {% load i18n %} -{% if course.conference.all|from_course_type:type %} +{% if course.livestream.all|from_course_type:type %}
-

{% trans "Live conference"%}

+

{% trans "Live conference"%}

- - - - - - - - - {% for conference in course.conference.all|from_course_type:type %} + {% for stream in course.livestream.all|from_course_type:type %} - +
{% trans "Session" %}{% trans "Professor" %}{% trans "Begin date" %}{% trans "Streaming" %}
{{ conference.session }} {{ stream.slug }} {% if conference.professor.user %}{{ conference.professor }}{% endif %} {{ conference.date_begin }} diff --git a/teleforma/templates/teleforma/inc/document_list.html b/teleforma/templates/teleforma/inc/document_list.html index 42ad3422..c10438eb 100644 --- a/teleforma/templates/teleforma/inc/document_list.html +++ b/teleforma/templates/teleforma/inc/document_list.html @@ -4,32 +4,24 @@ {% if course.document.all|from_course_type:type %}
-

{% trans "Documents"%}

+

{% trans "Documents"%}

{% for doc_type in doc_types %} {% if course.document.all|from_course_type:type|from_doc_type:doc_type %} {{ doc_type }} - - - - - - - - {% for document in course.document.all|from_course_type:type|from_doc_type:doc_type %} - - - + + - + {% endfor %} diff --git a/teleforma/templates/teleforma/inc/media_list.html b/teleforma/templates/teleforma/inc/media_list.html index 8001a0a6..aa50533a 100644 --- a/teleforma/templates/teleforma/inc/media_list.html +++ b/teleforma/templates/teleforma/inc/media_list.html @@ -4,23 +4,14 @@ {% if course.media.all|from_course_type:type %}
-

{% trans "Passed conferences"%}

+

{% trans "Passed conferences"%}

{% trans "Title" %}{% trans "Annal" %}{% trans "Date modified" %}{% trans "Download" %}
{% if document.file %}{% endif %}{{ document.title }}{% if document.file %}{% endif %} +
{% if document.file %}{% endif %} {{ document.title }}{% if document.file %}{% endif %} {{ document.date_added }}{% if document.file %}{% endif %}{% if document.file %}{% endif %}
- - - - - - - - - {% for media in course.media.all|from_course_type:type %} {% if media.published or user.is_staff %} - - + + diff --git a/teleforma/templatetags/teleforma_tags.py b/teleforma/templatetags/teleforma_tags.py index 1cf493d4..b77488f8 100644 --- a/teleforma/templatetags/teleforma_tags.py +++ b/teleforma/templatetags/teleforma_tags.py @@ -106,3 +106,25 @@ def from_course_type(docs, type): @register.filter def from_doc_type(docs, type): return docs.filter(type=type) + +@register.assignment_tag +def get_professors(): + return Professor.objects.all() + +@register.assignment_tag +def get_admins(): + return User.objects.filter(is_staff=True) + +@register.assignment_tag +def get_trainings(): + return Training.objects.all() + +@register.assignment_tag +def get_eijs(): + return IEJ.objects.all() + +@register.assignment_tag +def get_courses(): + return Course.objects.all() + + diff --git a/teleforma/views.py b/teleforma/views.py index 7b51408b..2766d762 100755 --- a/teleforma/views.py +++ b/teleforma/views.py @@ -52,13 +52,15 @@ def format_courses(courses, course=None, queryset=None, types=None): 'date': course.date_modified, 'number': course.number}) return courses + def get_courses(user, date_order=False, num_order=False): + courses = [] + if not user.is_authenticated(): - return [] + return courses professor = user.professor.all() student = user.student.all() - courses = [] if professor: professor = user.professor.get() -- 2.39.5
{% trans "Title" %}{% trans "Session" %}{% trans "Professor" %}{% trans "Begin date" %}{% trans "Duration" %}
{{ media.title }}
{{ media.title }} {{ media.conference.session }} {% if media.conference.professor.user %}{{ media.conference.professor }}{% endif %} {% if media.conference.date_begin %}{{ media.conference.date_begin }}{% endif %}