diff --git a/amadeus/static/js/course.js b/amadeus/static/js/course.js index b233458..bab6cbe 100755 --- a/amadeus/static/js/course.js +++ b/amadeus/static/js/course.js @@ -109,23 +109,27 @@ function replicate_course(url, course) { $('.collapse').on('show.bs.collapse', function (e) { if($(this).is(e.target)){ var btn = $(this).parent().find('.fa-angle-right'); + + btn = btn[0]; - btn.switchClass("fa-angle-right", "fa-angle-down", 250, "easeInOutQuad"); + $(btn).switchClass("fa-angle-right", "fa-angle-down", 250, "easeInOutQuad"); var url = $(this).parent().find('.log_url').val(); var log_input = $(this).parent().find('.log_id'); - $.ajax({ - url: url, - data: {'action': 'open'}, - dataType: 'json', - success: function (data) { - log_input.val(data.log_id); - }, - error: function (data) { - console.log(data); - } - }); + if (typeof(url) != 'undefined') { + $.ajax({ + url: url, + data: {'action': 'open'}, + dataType: 'json', + success: function (data) { + log_input.val(data.log_id); + }, + error: function (data) { + console.log(data); + } + }); + } } }); @@ -133,21 +137,25 @@ $('.collapse').on('hide.bs.collapse', function (e) { if($(this).is(e.target)){ var btn = $(this).parent().find('.fa-angle-down'); - btn.switchClass("fa-angle-down", "fa-angle-right", 250, "easeInOutQuad"); + btn = btn[0]; + + $(btn).switchClass("fa-angle-down", "fa-angle-right", 250, "easeInOutQuad"); var url = $(this).parent().find('.log_url').val(); var log_id = $(this).parent().find('.log_id').val(); - $.ajax({ - url: url, - data: {'action': 'close', 'log_id': log_id}, - dataType: 'json', - success: function (data) { - console.log(data.message); - }, - error: function (data) { - console.log(data); - } - }); + if (typeof(url) != 'undefined') { + $.ajax({ + url: url, + data: {'action': 'close', 'log_id': log_id}, + dataType: 'json', + success: function (data) { + console.log(data.message); + }, + error: function (data) { + console.log(data); + } + }); + } } }); \ No newline at end of file diff --git a/subjects/templates/subjects/list.html b/subjects/templates/subjects/list.html index 552bd7c..e0ebb3b 100644 --- a/subjects/templates/subjects/list.html +++ b/subjects/templates/subjects/list.html @@ -42,165 +42,131 @@
{% for category in categories %} {% if category.visible %} - - -
-
-
-
-

- - {{category.name}} - -

- {% if user.is_staff or user in category.coordinators.all %} -
-
- - +
+
+
+
+

+ + {{category.name}} + +

+ {% if user.is_staff or user in category.coordinators.all %} +
+
+ + +
-
- {% else %} -
-
- {% endif %} - + {% else %} +
+
+ {% endif %} +
- +
-
-
- - - {% if category.coordinators.all|length > 0 %} -

{% trans "Coordinator(s) " %}: - {{ category.coordinators.all|join:', ' }} -

- {% else %} -

{% trans "It doesn't possess coordinators" %}

- {% endif %} - - {{category.description|safe}} - - {% if user in category.coordinators.all %} - - {% endif %} +
+ + + {% if category.coordinators.all|length > 0 %} +

{% trans "Coordinator(s) " %}: + {{ category.coordinators.all|join:', ' }} +

+ {% else %} +

{% trans "It doesn't possess coordinators" %}

+ {% endif %} + + {{category.description|safe}} -
- {% for subject in category.subject_category.all %} - {% include "subjects/subject_card.html" %} - {% endfor %} + {% if user in category.coordinators.all %} + + {% endif %} + +
+ {% for subject in category.subject_category.all %} + {% include "subjects/subject_card.html" %} + {% endfor %} +
- -
- - - - - {% comment %} -
- {% for subject in subjects %} - {% include "categories/category_card.html" %} - {% endfor %} -
- {% endcomment %} -
- {% elif request.user in category.coordinators.all %} - - - -
-
-
-
-

- - {{category.name}} - -

- {% if user.is_staff or user in category.coordinators.all %} -
-
- - +
+
+
+
+

+ + {{category.name}} + +

+ {% if user.is_staff or user in category.coordinators.all %} +
+
+ + +
-
- {% else %} -
-
- {% endif %} - + {% else %} +
+
+ {% endif %} +
- +
-
-
- - - {% if category.coordinators.all|length > 0 %} -

{% trans "Coordinator(s) " %}: - {{ category.coordinators.all|join:', ' }} -

- {% else %} -

{% trans "It doesn't possess coordinators" %}

- {% endif %} - - {{category.description|safe}} - - {% if user in category.coordinators.all %} - - {% endif %} -
- {% for subject in category.subjects %} - {% include "subjects/subject_card.html" %} - {% endfor %} -
- - -
+
+ + + {% if category.coordinators.all|length > 0 %} +

{% trans "Coordinator(s) " %}: + {{ category.coordinators.all|join:', ' }} +

+ {% else %} +

{% trans "It doesn't possess coordinators" %}

+ {% endif %} + + {{category.description|safe}} + + {% if user in category.coordinators.all %} + + {% endif %} - - - - {% comment %} -
- {% for subject in subjects %} - {% include "categories/category_card.html" %} - {% endfor %} +
+ {% for subject in category.subject_category.all %} + {% include "subjects/subject_card.html" %} + {% endfor %} +
- {% endcomment %} -
- +
{% endif %} {% endfor %}
diff --git a/subjects/templates/subjects/subject_card.html b/subjects/templates/subjects/subject_card.html index cfd35c8..ed61e63 100644 --- a/subjects/templates/subjects/subject_card.html +++ b/subjects/templates/subjects/subject_card.html @@ -1,74 +1,62 @@ {% load static i18n permission_tags %} -
-
-
-
-

- - {{subject.name}} - -

- - {% if request.user in subject.professor.all or request.user in category.coordinators.all %} - - {% endif %} -
- - - - -
- + +
+
+
+
+

+ + {{subject.name}} + +

+ {% if request.user in subject.professor.all or request.user in category.coordinators.all %} + + {% endif %} +
+ + + +
+
- -
+
+
- - - {% if subject.professor.all|length > 0 %} -

{% trans "Professors(s) " %}: - {{ subject.professor.all|join:', ' }} -

- {% else %} -

{% trans "It doesn't possess professors" %}

- {% endif %} + {% if subject.professor.all|length > 0 %} +

{% trans "Professors(s) " %}: + {{ subject.professor.all|join:', ' }} +

+ {% else %} +

{% trans "It doesn't possess professors" %}

+ {% endif %}
- -
-

{% trans "Beginning" %}: {{subject.init_date}}

+

{% trans "Beginning" %}: {{subject.init_date}}

-

{% trans "End" %}: {{subject.end_date}}

+

{% trans "End" %}: {{subject.end_date}}

- - - - -

{{subject.description_brief|safe}}

+

{{subject.description_brief|safe}}

{% if request.user in subject.students.all or request.user in subject.professor.all or quest.user.is_staff %} {% else %} {% endif %} - -
- +
\ No newline at end of file -- libgit2 0.21.2