Commit 791b7e581def3431af7f5cded8adc0e29c48bf68

Authored by ailsoncgt
2 parents a0abbd08 06578451

Merge

Showing 55 changed files with 990 additions and 715 deletions   Show diff stats
amadeus/settings.py
@@ -139,7 +139,7 @@ TIME_ZONE = 'America/Recife' @@ -139,7 +139,7 @@ TIME_ZONE = 'America/Recife'
139 139
140 USE_I18N = True 140 USE_I18N = True
141 141
142 -USE_L10N = True 142 +USE_L10N = False
143 143
144 USE_TZ = True 144 USE_TZ = True
145 145
amadeus/staticfiles/css/base/amadeus.css
@@ -18,9 +18,6 @@ @@ -18,9 +18,6 @@
18 padding-bottom: 1%; 18 padding-bottom: 1%;
19 width: 15%; 19 width: 15%;
20 } 20 }
21 -.navigation{  
22 - margin: 10% 10% 5% 5%;  
23 -}  
24 .breadcrumb{ 21 .breadcrumb{
25 margin-bottom: 5px; 22 margin-bottom: 5px;
26 } 23 }
@@ -320,4 +317,4 @@ body .container .jumbotron-inverse, body .container .well-inverse, body .contain @@ -320,4 +317,4 @@ body .container .jumbotron-inverse, body .container .well-inverse, body .contain
320 317
321 .notification-count { 318 .notification-count {
322 background-color: #FF0000; 319 background-color: #FF0000;
323 -} 320 -}
  321 +}
324 \ No newline at end of file 322 \ No newline at end of file
app/templates/home.html
@@ -3,55 +3,55 @@ @@ -3,55 +3,55 @@
3 {% load static i18n django_bootstrap_breadcrumbs permission_tags %} 3 {% load static i18n django_bootstrap_breadcrumbs permission_tags %}
4 4
5 {% block javascript %} 5 {% block javascript %}
6 - {% if page_obj %}  
7 - <script type="text/javascript">  
8 - var pageNum = {{ page_obj.number }}; // The latest page loaded  
9 - var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages  
10 - var baseUrl = '{% url "app:index" %}'; 6 + {% if page_obj %}
  7 + <script type="text/javascript">
  8 + var pageNum = {{ page_obj.number }}; // The latest page loaded
  9 + var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages
  10 + var baseUrl = '{% url "app:index" %}';
11 11
12 - // loadOnScroll handler  
13 - var loadOnScroll = function() {  
14 - // If the current scroll position is past out cutoff point...  
15 - if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {  
16 - // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row  
17 - $(window).unbind();  
18 - // execute the load function below that will visit the view and return the content  
19 - loadItems();  
20 - }  
21 - }; 12 + // loadOnScroll handler
  13 + var loadOnScroll = function() {
  14 + // If the current scroll position is past out cutoff point...
  15 + if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
  16 + // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row
  17 + $(window).unbind();
  18 + // execute the load function below that will visit the view and return the content
  19 + loadItems();
  20 + }
  21 + };
22 22
23 - var loadItems = function() {  
24 - // Check if page is equal to the number of pages  
25 - if (pageNum == numberPages) {  
26 - return false  
27 - }  
28 - // Update the page number  
29 - pageNum = pageNum + 1; 23 + var loadItems = function() {
  24 + // Check if page is equal to the number of pages
  25 + if (pageNum == numberPages) {
  26 + return false
  27 + }
  28 + // Update the page number
  29 + pageNum = pageNum + 1;
30 30
31 - $("#loading").show();  
32 - // Configure the url we're about to hit  
33 - setTimeout(function (){  
34 - $.ajax({  
35 - url: baseUrl,  
36 - data: {'page': pageNum},  
37 - success: function(data) {  
38 - $("#loading").hide(); 31 + $("#loading").show();
  32 + // Configure the url we're about to hit
  33 + setTimeout(function (){
  34 + $.ajax({
  35 + url: baseUrl,
  36 + data: {'page': pageNum},
  37 + success: function(data) {
  38 + $("#loading").hide();
39 39
40 - $("#timeline").append(data);  
41 - },  
42 - complete: function(data, textStatus){  
43 - // Turn the scroll monitor back on  
44 - $(window).bind('scroll', loadOnScroll);  
45 - }  
46 - });  
47 - }, 1000)  
48 - }; 40 + $("#timeline").append(data);
  41 + },
  42 + complete: function(data, textStatus){
  43 + // Turn the scroll monitor back on
  44 + $(window).bind('scroll', loadOnScroll);
  45 + }
  46 + });
  47 + }, 1000)
  48 + };
49 49
50 - $(document).ready(function(){  
51 - $(window).bind('scroll', loadOnScroll);  
52 - });  
53 - </script>  
54 - {% endif %} 50 + $(document).ready(function(){
  51 + $(window).bind('scroll', loadOnScroll);
  52 + });
  53 + </script>
  54 + {% endif %}
55 {% endblock %} 55 {% endblock %}
56 56
57 {% block breadcrumbs %} 57 {% block breadcrumbs %}
@@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
64 {% endblock %} 64 {% endblock %}
65 65
66 {% block sidebar %} 66 {% block sidebar %}
67 - <div class="panel panel-primary navigation"> 67 + <div class="panel panel-primary">
68 <div class="panel-heading"> 68 <div class="panel-heading">
69 <h4>Menu</h4> 69 <h4>Menu</h4>
70 </div> 70 </div>
@@ -97,19 +97,19 @@ @@ -97,19 +97,19 @@
97 {% endblock %} 97 {% endblock %}
98 98
99 {% block content %} 99 {% block content %}
100 - {% if user|has_role:'system_admin' %} 100 + {% if user|has_role:'system_admin' %}
101 <h3>{% trans 'Courses' %}</h3> 101 <h3>{% trans 'Courses' %}</h3>
102 <div id="timeline"> 102 <div id="timeline">
103 - {% include page_template %} 103 + {% include page_template %}
104 </div> 104 </div>
105 - {% else %} 105 + {% else %}
106 <div id="timeline"> 106 <div id="timeline">
107 {% include page_template %} 107 {% include page_template %}
108 </div> 108 </div>
109 - {% endif %}  
110 - <div id="loading" class="alert alert-primary" role="alert" style="display: none">  
111 - <center>  
112 - <span class="fa fa-spin fa-circle-o-notch"></span>  
113 - </center>  
114 - </div> 109 + {% endif %}
  110 + <div id="loading" class="alert alert-primary" role="alert" style="display: none">
  111 + <center>
  112 + <span class="fa fa-spin fa-circle-o-notch"></span>
  113 + </center>
  114 + </div>
115 {% endblock %} 115 {% endblock %}
app/templates/home_professor.html
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 {% endblock %} 15 {% endblock %}
16 16
17 {% block sidebar %} 17 {% block sidebar %}
18 - <div class="panel panel-primary navigation"> 18 + <div class="panel panel-primary">
19 <div class="panel-heading"> 19 <div class="panel-heading">
20 <h5>{% trans 'Menu' %}</h5> 20 <h5>{% trans 'Menu' %}</h5>
21 </div> 21 </div>
@@ -32,9 +32,9 @@ @@ -32,9 +32,9 @@
32 {% block content %} 32 {% block content %}
33 33
34 <h3>{% trans 'Courses' %}</h3> 34 <h3>{% trans 'Courses' %}</h3>
35 - {% if courses|length > 0 %}  
36 - {% for course in courses %}  
37 - <a href="{% url 'course:view' course.slug %}"> 35 + {% if courses|length > 0 %}
  36 + {% for course in courses %}
  37 + <a href="{% url 'course:view' course.slug %}">
38 <div class="panel panel-default courseHome"> 38 <div class="panel panel-default courseHome">
39 <div class="panel-body"> 39 <div class="panel-body">
40 <p>{{ course }}</p> 40 <p>{{ course }}</p>
@@ -48,9 +48,9 @@ @@ -48,9 +48,9 @@
48 </div> 48 </div>
49 </div> 49 </div>
50 </a> 50 </a>
51 - {% endfor %}  
52 - {% else %}  
53 - <p>{% trans "You didn't create any course yet." %}</p>  
54 - {% endif %} 51 + {% endfor %}
  52 + {% else %}
  53 + <p>{% trans "You didn't create any course yet." %}</p>
  54 + {% endif %}
55 {% endblock %} 55 {% endblock %}
56 56
app/templates/home_student.html
@@ -16,23 +16,23 @@ @@ -16,23 +16,23 @@
16 16
17 17
18 {% block sidebar %} 18 {% block sidebar %}
19 - <div class="panel panel-primary navigation"> 19 + <div class="panel panel-primary">
20 <div class="panel-heading"> 20 <div class="panel-heading">
21 <h4>{% trans 'Menu' %}</h4> 21 <h4>{% trans 'Menu' %}</h4>
22 </div> 22 </div>
23 <div class="panel-body"> 23 <div class="panel-body">
24 - <ul class="nav nav-pills nav-stacked">  
25 - <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>  
26 - <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> 24 + <ul class="nav nav-pills nav-stacked">
  25 + <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
  26 + <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>
27 <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li> 27 <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
28 - <li><a href="javascript:void(0)">{% trans 'Google accounts' %}</a></li> 28 + <li><a href="javascript:void(0)">{% trans 'Google accounts' %}</a></li>
29 </ul> 29 </ul>
30 </div> 30 </div>
31 </div> 31 </div>
32 {% endblock %} 32 {% endblock %}
33 33
34 {% block content %} 34 {% block content %}
35 - <h3>{% trans 'Notifications' %}</h3> 35 + <h3>{% trans 'Notifications' %}</h3>
36 {% if messages %} 36 {% if messages %}
37 {% for message in messages %} 37 {% for message in messages %}
38 <div class="alert alert-success alert-dismissible" role="alert"> 38 <div class="alert alert-success alert-dismissible" role="alert">
@@ -44,27 +44,27 @@ @@ -44,27 +44,27 @@
44 {% endfor %} 44 {% endfor %}
45 {% endif %} 45 {% endif %}
46 <div class="panel panel-default"> 46 <div class="panel panel-default">
47 - <div class="panel-body">  
48 - His course has notified a new activity!  
49 - </div>  
50 - <div class="panel-footer">  
51 - Go  
52 - </div> 47 + <div class="panel-body">
  48 + His course has notified a new activity!
  49 + </div>
  50 + <div class="panel-footer">
  51 + Go
  52 + </div>
53 </div> 53 </div>
54 <div class="panel panel-default"> 54 <div class="panel panel-default">
55 - <div class="panel-body">  
56 - His teacher has notified a new material!  
57 - </div>  
58 - <div class="panel-footer">  
59 - Go  
60 - </div> 55 + <div class="panel-body">
  56 + His teacher has notified a new material!
  57 + </div>
  58 + <div class="panel-footer">
  59 + Go
  60 + </div>
61 </div> 61 </div>
62 <div class="panel panel-default"> 62 <div class="panel panel-default">
63 - <div class="panel-body"> 63 + <div class="panel-body">
64 You have a new guardian! 64 You have a new guardian!
65 - </div>  
66 - <div class="panel-footer">  
67 - Go  
68 - </div> 65 + </div>
  66 + <div class="panel-footer">
  67 + Go
  68 + </div>
69 </div> 69 </div>
70 {% endblock %} 70 {% endblock %}
app/templates/home_teacher_student_content.html
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 </div> 11 </div>
12 <div class="col-xs-10 col-md-11"> 12 <div class="col-xs-10 col-md-11">
13 <h4 class="resource_inline"><b>{{ notification.actor.username }}</b></h4> 13 <h4 class="resource_inline"><b>{{ notification.actor.username }}</b></h4>
14 - <p class="resource_inline">{{notification.message}} em : <a href="{% url 'core:notification_read' notification.id %}">{{ notification.action_resource.resource.name }}</a></p> 14 + <p class="resource_inline">{{notification.message}} {% trans 'at' %} : <a href="{% url 'core:notification_read' notification.id %}">{{ notification.action_resource.resource.name }}</a></p>
15 <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p> 15 <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p>
16 </div> 16 </div>
17 </div> 17 </div>
core/static/css/base/amadeus.css
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 margin: 10% 10% 5% 5%; 30 margin: 10% 10% 5% 5%;
31 } 31 }
32 .breadcrumb{ 32 .breadcrumb{
33 - margin-bottom: 5px; 33 + margin-bottom: 25px;
34 } 34 }
35 .courseHome{ 35 .courseHome{
36 text-align: center; 36 text-align: center;
@@ -394,4 +394,21 @@ ul, li { @@ -394,4 +394,21 @@ ul, li {
394 -webkit-animation-duration: 900ms; 394 -webkit-animation-duration: 900ms;
395 -webkit-animation-iteration-count: 3; 395 -webkit-animation-iteration-count: 3;
396 -webkit-animation-timing-function: ease-in-out; 396 -webkit-animation-timing-function: ease-in-out;
397 -}  
398 \ No newline at end of file 397 \ No newline at end of file
  398 +}
  399 +/* Icon Topic */
  400 +.divMoreActions {text-align: right; height: 39px; float: right;}
  401 +.divMoreActions div button {padding-left: 10px; padding-right: 10px; padding-bottom: 10px; margin-bottom: 4px; height: 31px;}
  402 +.titleTopic {padding-top: 18px; padding-left: 0px;}
  403 +.titleTopic-detail {padding-top: 8px; color: white;}
  404 +.titleTopic a h4 {margin-top: 0px; color: white; cursor:pointer;}
  405 +.dropdown-menu .pull-right {
  406 + right: 0;
  407 + }
  408 +.moreAccordion{ padding-left: 0px; padding-right: 0px;}
  409 +.moreAccordion div button{ padding-left: 0px; padding-right: 0px;}
  410 +.cards-content{ padding-left: 0px; padding-right: 0px; }
  411 +.cards-detail{margin-left: 4%;}
  412 +.cards-detail .panel .panel-heading{/*background-color:;*/}
  413 +.cards-detail .panel .panel-heading h4{color:black;}
  414 +.course, .subject, .topic{ padding-top: 0px; padding-bottom: 0px; }
  415 +.course-detail{padding-top: 10px; padding-bottom: 10px;}
399 \ No newline at end of file 416 \ No newline at end of file
core/templates/base.html
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 2
3 {% load static i18n %} 3 {% load static i18n %}
  4 +{% load static i18n permission_tags %}
4 {% get_current_language as LANGUAGE_CODE %} 5 {% get_current_language as LANGUAGE_CODE %}
5 6
6 <html> 7 <html>
@@ -69,14 +70,14 @@ @@ -69,14 +70,14 @@
69 <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications"> 70 <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
70 <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a> 71 <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a>
71 <ul id="notification-dropdown" class="dropdown-menu"> 72 <ul id="notification-dropdown" class="dropdown-menu">
72 - <li class="dropdown-header">Notifications</li> 73 + <li class="dropdown-header"> {% trans 'Notifications' %}</li>
73 {% include "notifications.html" %} 74 {% include "notifications.html" %}
74 75
75 <li> 76 <li>
76 <a onclick="getNotifications(5)"> 77 <a onclick="getNotifications(5)">
77 <div id="notification-see-more" class="list-group-item"> 78 <div id="notification-see-more" class="list-group-item">
78 <div class="row-content"> 79 <div class="row-content">
79 - <p class="list-group-item-text">See More</p> 80 + <p class="list-group-item-text">{% trans 'See More' %}</p>
80 </div> 81 </div>
81 </a> 82 </a>
82 </li> 83 </li>
@@ -93,7 +94,54 @@ @@ -93,7 +94,54 @@
93 <div class="container-fluid"> 94 <div class="container-fluid">
94 <div class="row"> 95 <div class="row">
95 <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2"> 96 <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2">
96 - {% block sidebar %}{% endblock %} 97 + {% block sidebar %}
  98 + <div class="panel panel-primary navigation">
  99 + <div class="panel-heading">
  100 + <h4>{% trans "Menu" %}</h4>
  101 + </div>
  102 + <div class="panel-body">
  103 + <ul class="nav nav-pills nav-stacked">
  104 + <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li>
  105 + <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
  106 + {% if user|has_role:'student' or not user.is_staff %}
  107 + <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
  108 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
  109 + {% endif %}
  110 + {% if user|has_role:'system_admin' %}
  111 + <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
  112 + {% endif %}
  113 + {% if user|has_role:'system_admin' or user|has_role:'professor' %}
  114 + <li>
  115 + <a href="#courses_list" class="accordion" data-toggle="collapse">{% trans 'Manage Courses' %}</a>
  116 + <div id="courses_list" class="collapse">
  117 + <ul class="nav nav-pill nav-stacked accordion_list">
  118 + {% for course in courses_list %}
  119 + <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li>
  120 + {% endfor %}
  121 + </ul>
  122 + </div>
  123 + </li>
  124 + {% endif %}
  125 + </ul>
  126 + </div>
  127 + </div>
  128 +
  129 + {% if user|has_role:'professor' or user|has_role:'system_admin' %}
  130 +
  131 + <div class="panel panel-primary navigation">
  132 + <div class="panel-heading">
  133 + <h3 class="panel-title">{% trans 'Category' %}</h3>
  134 + </div>
  135 + <div class="panel-body">
  136 + <ul class="nav nav-pills nav-stacked">
  137 + <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category'%}</a></li>
  138 + <li><a href="{% url 'course:manage_cat' %}">{% trans 'List Category' %}</a></li>
  139 + </ul>
  140 + </div>
  141 + </div>
  142 +
  143 + {% endif %}
  144 + {% endblock %}
97 </div> 145 </div>
98 <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10"> 146 <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10">
99 {% block breadcrumbs %}{% endblock %} 147 {% block breadcrumbs %}{% endblock %}
core/templates/guest.html
@@ -5,82 +5,80 @@ @@ -5,82 +5,80 @@
5 5
6 <html> 6 <html>
7 <head> 7 <head>
8 - <title>{{ title }}</title>  
9 -  
10 - <meta http-equiv="Cache-Control" content="no-cache, no-store" />  
11 - <link href="{% static 'img/favicon.ico' %}" rel="shortcut icon" />  
12 - <!-- Roboto font -->  
13 - <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">  
14 - <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">  
15 -  
16 - <!-- jQuery & jQuery UI -->  
17 - <script type="text/javascript" src="{% static 'js/vendor/jquery-3.1.0.min.js' %}"></script>  
18 - <script type="text/javascript" src="{% static 'js/vendor/jquery-ui.js' %}"></script>  
19 -  
20 - <!-- Bootstrap and themes (material) -->  
21 - <link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/css/bootstrap.css' %}">  
22 - <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/material.min.css' %}">  
23 - <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/ripples.min.css' %}">  
24 - <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/datepicker.css' %}">  
25 - <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/alertify.min.css' %}">  
26 - <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/themes/bootstrap.css' %}">  
27 - <script type="text/javascript" src="{% static 'bootstrap-3.3.7/js/bootstrap.js' %}"></script>  
28 - <script type="text/javascript" src="{% static 'js/vendor/bootstrap-acessibility.min.js' %}"></script>  
29 - <script type="text/javascript" src="{% static 'js/vendor/material.min.js' %}"></script>  
30 - <script type="text/javascript" src="{% static 'js/vendor/ripples.min.js' %}"></script>  
31 - <script type="text/javascript" src="{% static 'js/vendor/bootstrap-datepicker.js' %}"></script>  
32 - <script type="text/javascript" src="{% static 'js/vendor/alertify.min.js' %}"></script>  
33 -  
34 - <!-- Font awesome -->  
35 - <link rel="stylesheet" type="text/css" href="{% static 'font-awesome-4.6.3/css/font-awesome.min.css' %}">  
36 -  
37 - <!-- Custom styles -->  
38 - <link rel="stylesheet" type="text/css" href="{% static 'css/base/amadeus.css' %}">  
39 -  
40 - <!-- Init material Bootstrap -->  
41 - <script type="text/javascript">$.material.init()</script>  
42 -  
43 - <!--Javascript block for specific-app ones -->  
44 - <script src="{% static 'js/base/amadeus.js' %}"></script>  
45 - {% block style %}  
46 - {% endblock %}  
47 - {% block javascript %}  
48 - <script type="text/javascript" src="{% static 'js/course.js' %}"></script>  
49 - {% endblock %} 8 + <title>{{ title }}</title>
  9 +
  10 + <meta http-equiv="Cache-Control" content="no-cache, no-store" />
  11 + <link href="{% static 'img/favicon.ico' %}" rel="shortcut icon" />
  12 + <!-- Roboto font -->
  13 + <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
  14 + <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  15 +
  16 + <!-- jQuery & jQuery UI -->
  17 + <script type="text/javascript" src="{% static 'js/vendor/jquery-3.1.0.min.js' %}"></script>
  18 + <script type="text/javascript" src="{% static 'js/vendor/jquery-ui.js' %}"></script>
  19 +
  20 + <!-- Bootstrap and themes (material) -->
  21 + <link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/css/bootstrap.css' %}">
  22 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/material.min.css' %}">
  23 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/ripples.min.css' %}">
  24 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/datepicker.css' %}">
  25 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/alertify.min.css' %}">
  26 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/themes/bootstrap.css' %}">
  27 + <script type="text/javascript" src="{% static 'bootstrap-3.3.7/js/bootstrap.js' %}"></script>
  28 + <script type="text/javascript" src="{% static 'js/vendor/bootstrap-acessibility.min.js' %}"></script>
  29 + <script type="text/javascript" src="{% static 'js/vendor/material.min.js' %}"></script>
  30 + <script type="text/javascript" src="{% static 'js/vendor/ripples.min.js' %}"></script>
  31 + <script type="text/javascript" src="{% static 'js/vendor/bootstrap-datepicker.js' %}"></script>
  32 + <script type="text/javascript" src="{% static 'js/vendor/alertify.min.js' %}"></script>
  33 +
  34 + <!-- Font awesome -->
  35 + <link rel="stylesheet" type="text/css" href="{% static 'font-awesome-4.6.3/css/font-awesome.min.css' %}">
  36 +
  37 + <!-- Custom styles -->
  38 + <link rel="stylesheet" type="text/css" href="{% static 'css/base/amadeus.css' %}">
  39 +
  40 + <!-- Init material Bootstrap -->
  41 + <script type="text/javascript">$.material.init()</script>
  42 +
  43 + <!--Javascript block for specific-app ones -->
  44 + <script src="{% static 'js/base/amadeus.js' %}"></script>
  45 + {% block style %}
  46 + {% endblock %}
  47 + {% block javascript %}
  48 + <script type="text/javascript" src="{% static 'js/course.js' %}"></script>
  49 + {% endblock %}
50 </head> 50 </head>
51 <body> 51 <body>
52 - {% block nav %}  
53 - <div class="navbar navbar-default">  
54 - <div class="navbar-header">  
55 - <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">  
56 - <span class="icon-bar"></span>  
57 - <span class="icon-bar"></span>  
58 - <span class="icon-bar"></span>  
59 - </button>  
60 - <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a>  
61 - </div>  
62 - <div class="navbar-collapse collapse navbar-responsive-collapse">  
63 - <ul class="nav navbar-nav navbar-right notifications">  
64 - <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications"> 52 + {% block nav %}
  53 + <div class="navbar navbar-default">
  54 + <div class="navbar-header">
  55 + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
  56 + <span class="icon-bar"></span>
  57 + <span class="icon-bar"></span>
  58 + <span class="icon-bar"></span>
  59 + </button>
  60 + <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a>
  61 + </div>
  62 + <div class="navbar-collapse collapse navbar-responsive-collapse">
  63 + <ul class="nav navbar-nav navbar-right notifications">
  64 + <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
65 <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a> 65 <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a>
66 <ul id="notification-dropdown" class="dropdown-menu"> 66 <ul id="notification-dropdown" class="dropdown-menu">
67 <li class="dropdown-header">Notifications</li> 67 <li class="dropdown-header">Notifications</li>
68 - {% include "notifications.html" %} 68 + {% include "notifications.html" %}
69 69
70 - <li>  
71 - <a onclick="getNotifications(5)">  
72 - <div id="notification-see-more" class="list-group-item"> 70 + <li>
  71 + <a onclick="getNotifications(5)">
  72 + <div id="notification-see-more" class="list-group-item">
73 <div class="row-content"> 73 <div class="row-content">
74 <p class="list-group-item-text">See More</p> 74 <p class="list-group-item-text">See More</p>
75 </div> 75 </div>
76 </a> 76 </a>
77 - </li> 77 + </li>
78 </ul> 78 </ul>
79 </li> 79 </li>
80 -  
81 <li data-toggle="tooltip" data-placement="bottom" title data-original-title="{% trans 'messages' %}"> <a href="#"><i class="fa fa-comments" aria-hidden="true"></i></a> </li> 80 <li data-toggle="tooltip" data-placement="bottom" title data-original-title="{% trans 'messages' %}"> <a href="#"><i class="fa fa-comments" aria-hidden="true"></i></a> </li>
82 <li > <a class="link" href="{% url 'app:index' %}">{{ user }}</a></li> 81 <li > <a class="link" href="{% url 'app:index' %}">{{ user }}</a></li>
83 -  
84 </ul> 82 </ul>
85 </div> 83 </div>
86 </div> 84 </div>
@@ -90,7 +88,7 @@ @@ -90,7 +88,7 @@
90 88
91 <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2"> 89 <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2">
92 {% block sidebar %} 90 {% block sidebar %}
93 - <div class="panel panel-primary navigation"> 91 + <div class="panel panel-primary">
94 <div class="panel-heading"> 92 <div class="panel-heading">
95 <h4>Menu</h4> 93 <h4>Menu</h4>
96 </div> 94 </div>
@@ -119,7 +117,7 @@ @@ -119,7 +117,7 @@
119 </form> 117 </form>
120 </div> 118 </div>
121 119
122 - <div class="col-md-12"> 120 + <div class="col-md-10">
123 <div class="btn-group btn-group-justified btn-group-raised"> 121 <div class="btn-group btn-group-justified btn-group-raised">
124 <a href="?category=all" class="btn btn-raised btn-info">Todos</a> 122 <a href="?category=all" class="btn btn-raised btn-info">Todos</a>
125 {% for category in categories %} 123 {% for category in categories %}
@@ -132,7 +130,7 @@ @@ -132,7 +130,7 @@
132 {% block render_breadcrumbs %}{% endblock %} 130 {% block render_breadcrumbs %}{% endblock %}
133 <div> 131 <div>
134 </div> 132 </div>
135 - <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12"> 133 + <div class="col-xs-12 col-sm-12 col-md-10 col-lg-10 col-xl-12">
136 {% block content %} 134 {% block content %}
137 {% for course in courses %} 135 {% for course in courses %}
138 <div class="panel panel-info panel_{{ course.id }}"> 136 <div class="panel panel-info panel_{{ course.id }}">
@@ -142,7 +140,7 @@ @@ -142,7 +140,7 @@
142 <a onclick="subscribe($(this), '{% url 'course:subscribe' course.slug %}', {{ course.id}}, '{% trans 'Are you sure you want to subscribe to this course?' %}')" class="btn btn-sm btn-primary btn-raised pull-right" style="margin-top:-4px">{% trans 'Subscribe' %}</a> 140 <a onclick="subscribe($(this), '{% url 'course:subscribe' course.slug %}', {{ course.id}}, '{% trans 'Are you sure you want to subscribe to this course?' %}')" class="btn btn-sm btn-primary btn-raised pull-right" style="margin-top:-4px">{% trans 'Subscribe' %}</a>
143 {% endif %} 141 {% endif %}
144 </div> 142 </div>
145 - 143 +
146 <div class="panel-body"> 144 <div class="panel-body">
147 <p><b>Course Name: </b>{{course.name}}</p> 145 <p><b>Course Name: </b>{{course.name}}</p>
148 <p><b>Begining: </b>{{course.init_date}}</p> 146 <p><b>Begining: </b>{{course.init_date}}</p>
core/templates/lembrar_senha.html
@@ -37,7 +37,7 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título @@ -37,7 +37,7 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título
37 37
38 38
39 39
40 - <title>Projeto Amadeus</title> 40 + <title>{% trans 'Amadeus Project' %}</title>
41 41
42 <meta http-equiv="Cache-Control" content="no-cache, no-store" /> 42 <meta http-equiv="Cache-Control" content="no-cache, no-store" />
43 43
@@ -62,7 +62,7 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título @@ -62,7 +62,7 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título
62 <form name="logonForm" method="post" action="/amadeuslms/validateLogin.do"> 62 <form name="logonForm" method="post" action="/amadeuslms/validateLogin.do">
63 <dt><input type="text" name="login" maxlength="15" size="15" value="" class="inputlogin"> </dt> 63 <dt><input type="text" name="login" maxlength="15" size="15" value="" class="inputlogin"> </dt>
64 <dt><input type="password" name="password" maxlength="15" size="15" value="" class="inputlogin">&nbsp; 64 <dt><input type="password" name="password" maxlength="15" size="15" value="" class="inputlogin">&nbsp;
65 - <br /><a href="{% url 'index' %}" name="logonForm" class="button">Entrar</a></dt> 65 + <br /><a href="{% url 'index' %}" name="logonForm" class="button">{% trans 'Enter' %}</a></dt>
66 </form> 66 </form>
67 <script type="text/javascript" language="JavaScript"> 67 <script type="text/javascript" language="JavaScript">
68 <!-- 68 <!--
@@ -98,23 +98,23 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título @@ -98,23 +98,23 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título
98 98
99 <div id="institutional_menu"> 99 <div id="institutional_menu">
100 100
101 - <span><a href="/amadeuslms/fProject.do" target="_blank">O Projeto</a></span> 101 + <span><a href="/amadeuslms/fProject.do" target="_blank">{% trans 'O Projeto' %}</a></span>
102 <span>&nbsp;|&nbsp;</span> 102 <span>&nbsp;|&nbsp;</span>
103 - <span><a href="/amadeuslms/fCCTE.do" target="_blank">Grupo CCTE</a></span> 103 + <span><a href="/amadeuslms/fCCTE.do" target="_blank">{% trans 'Grupo CCTE' %}</a></span>
104 </div> 104 </div>
105 <div id="pTitle" class="pTitle"> 105 <div id="pTitle" class="pTitle">
106 - <h2>Lembrar senha</h2> 106 + <h2>{% trans 'Lembrar senha' %}</h2>
107 </div> 107 </div>
108 <div id="pBreadCrumbs" class="pBreadCrumbs"> 108 <div id="pBreadCrumbs" class="pBreadCrumbs">
109 <ul id="breadcrumb"> 109 <ul id="breadcrumb">
110 - <li><a href="{% url 'home' %}">Página Inicial</a></li>  
111 - <li>Lembrar senha</li> 110 + <li><a href="{% url 'home' %}">{% trans 'Página Inicial' %}</a></li>
  111 + <li>{%trans 'Lembrar senha' %}</li>
112 </ul> 112 </ul>
113 </div> 113 </div>
114 <div id="pLeftMenu" class="pLeftMenu"> 114 <div id="pLeftMenu" class="pLeftMenu">
115 <div id="side_menu_1"> 115 <div id="side_menu_1">
116 <ul id="menu_sessoes"> 116 <ul id="menu_sessoes">
117 - <li><a href="{% url 'create_account' %}" class="insert">Nova conta</a></li> 117 + <li><a href="{% url 'create_account' %}" class="insert">{% trans 'Nova conta' %}</a></li>
118 </ul> 118 </ul>
119 </div> 119 </div>
120 </div> 120 </div>
@@ -123,9 +123,9 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título @@ -123,9 +123,9 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título
123 123
124 124
125 <form name="remindPasswordForm" method="post" action="/amadeuslms/remindPassword.do"> 125 <form name="remindPasswordForm" method="post" action="/amadeuslms/remindPassword.do">
126 - <dt>Endereço de e-mail</dt> 126 + <dt>{% trans 'Endereço de e-mail' %}</dt>
127 <dd><input type="text" name="email" value="" class="formfield2" id="username"></dd> 127 <dd><input type="text" name="email" value="" class="formfield2" id="username"></dd>
128 - <dd class="description">Seu endereço de e-mail (exemplo@mail.com)</dd> 128 + <dd class="description">{% trans 'Seu endereço de e-mail (exemplo@mail.com)' %}</dd>
129 <dt class="field"><input type="submit" name="remindPassword" value="Enviar e-mail" class="button"></dt> 129 <dt class="field"><input type="submit" name="remindPassword" value="Enviar e-mail" class="button"></dt>
130 </form> 130 </form>
131 <script type="text/javascript" language="JavaScript"> 131 <script type="text/javascript" language="JavaScript">
@@ -160,7 +160,7 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título @@ -160,7 +160,7 @@ Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título
160 160
161 161
162 <div id="footnote"> 162 <div id="footnote">
163 - <dl><dd>Copyright Amadeus. Todos os direitos reservados<dd></dl> 163 + <dl><dd>{% trans 'Copyright Amadeus. Todos os direitos reservados' %}<dd></dl>
164 </div> 164 </div>
165 165
166 </div> 166 </div>
core/templates/register_user.html
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 </div> 27 </div>
28 28
29 <div class="row"> 29 <div class="row">
30 - <div class="col-md-8 col-md-offset-3 col-sm-10 col-sm-offset-2 col-xs-12 col-xs-offset-1 col-lg-10 col-lg-offset-2 col-xl-8 col-xl-offset-3"> 30 + <div class="col-md-6 col-md-offset-4 col-sm-6 col-sm-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-3">
31 <div class="card"> 31 <div class="card">
32 <div class="card-content"> 32 <div class="card-content">
33 <div class="card-body"> 33 <div class="card-body">
@@ -44,7 +44,8 @@ @@ -44,7 +44,8 @@
44 {% else %} 44 {% else %}
45 <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label> 45 <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label>
46 {% endif %} 46 {% endif %}
47 - <div class="col-md-8 col-lg-10 col-lg-offset-2"> 47 + <div class="col-md-10 col-md-offset-2 col-lg-10 col-lg-offset-2 col-sm-10
  48 + col-sm-offset-2 col-xs-10 col-xs-offset-2">
48 {% if field.auto_id == 'id_birth_date' %} 49 {% if field.auto_id == 'id_birth_date' %}
49 {% render_field field class='form-control input-sm date-picker' %} 50 {% render_field field class='form-control input-sm date-picker' %}
50 <span id="helpBlock" class="help-block">{{ field.help_text }}</span> 51 <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
core/templates/registration/passwor_reset_email.html
1 -To initiate the password reset process for your {{ user.get_username }} TestSite Account,  
2 -click the link below: 1 +{% trans 'To initiate the password reset process for your {{ user.get_username }} TestSite Account,
  2 +click the link below:' %}
3 3
4 {% block reset_link %} 4 {% block reset_link %}
5 {{ protocol }}://{{ domain }}{% url 'core:password_reset_confirm' uidb64=uid token=token %} 5 {{ protocol }}://{{ domain }}{% url 'core:password_reset_confirm' uidb64=uid token=token %}
6 6
7 {% endblock %} 7 {% endblock %}
8 8
9 -If clicking the link above doesn't work, please copy and paste the URL in a new browser 9 +{% trans 'If clicking the link above doesnt work, please copy and paste the URL in a new browser
10 window instead. 10 window instead.
11 11
12 12
13 Sincerely, 13 Sincerely,
14 -Amadeus. 14 +Amadeus.' %}
core/templates/registration/password_reset_subject.txt
1 {% load i18n %}{% autoescape off %} 1 {% load i18n %}{% autoescape off %}
2 -{% blocktrans %}Password reset on {{ site_name }}{% endblocktrans %} 2 +{% blocktrans %}{% trans 'Password reset on' %} {{ site_name }}{% endblocktrans %}
3 {% endautoescape %} 3 {% endautoescape %}
courses/permissions.py
@@ -2,6 +2,19 @@ from rolepermissions.permissions import register_object_checker @@ -2,6 +2,19 @@ from rolepermissions.permissions import register_object_checker
2 from amadeus.roles import SystemAdmin 2 from amadeus.roles import SystemAdmin
3 3
4 @register_object_checker() 4 @register_object_checker()
  5 +def view_topic(role, user, topic):
  6 + if (role == SystemAdmin):
  7 + return True
  8 +
  9 + if (user in topic.subject.course.professors.all() and user in topic.subject.professors.all()):
  10 + return True
  11 +
  12 + if (user in topic.subject.course.students.all() and user in topic.subject.students.all()):
  13 + return True
  14 +
  15 + return False
  16 +
  17 +@register_object_checker()
5 def edit_topic(role, user, topic): 18 def edit_topic(role, user, topic):
6 if (role == SystemAdmin): 19 if (role == SystemAdmin):
7 return True 20 return True
@@ -12,6 +25,19 @@ def edit_topic(role, user, topic): @@ -12,6 +25,19 @@ def edit_topic(role, user, topic):
12 return False 25 return False
13 26
14 @register_object_checker() 27 @register_object_checker()
  28 +def view_subject(role, user, subject):
  29 + if (role == SystemAdmin):
  30 + return True
  31 +
  32 + if (user in subject.course.professors.all() and user in subject.professors.all()):
  33 + return True
  34 +
  35 + if (user in subject.course.students.all() and user in subject.students.all()):
  36 + return True
  37 +
  38 + return False
  39 +
  40 +@register_object_checker()
15 def edit_subject(role, user, subject): 41 def edit_subject(role, user, subject):
16 if (role == SystemAdmin): 42 if (role == SystemAdmin):
17 return True 43 return True
courses/static/js/course.js
@@ -49,13 +49,13 @@ function subscribe(elem, url, id, confirm_message) { @@ -49,13 +49,13 @@ function subscribe(elem, url, id, confirm_message) {
49 function delete_course(url, course, message, return_url) { 49 function delete_course(url, course, message, return_url) {
50 alertify.confirm(message, function(){ 50 alertify.confirm(message, function(){
51 var csrftoken = getCookie('csrftoken'); 51 var csrftoken = getCookie('csrftoken');
52 - 52 +
53 $.ajax({ 53 $.ajax({
54 method: 'post', 54 method: 'post',
55 beforeSend: function (request) { 55 beforeSend: function (request) {
56 request.setRequestHeader('X-CSRFToken', csrftoken); 56 request.setRequestHeader('X-CSRFToken', csrftoken);
57 }, 57 },
58 - url: url, 58 + url: url,
59 success: function(data) { 59 success: function(data) {
60 alertify.alert('Remove Course', 'Course removed successfully!', function(){ 60 alertify.alert('Remove Course', 'Course removed successfully!', function(){
61 window.location.href = return_url; 61 window.location.href = return_url;
@@ -71,7 +71,7 @@ function delete_course(url, course, message, return_url) { @@ -71,7 +71,7 @@ function delete_course(url, course, message, return_url) {
71 */ 71 */
72 function replicate_course(url, course) { 72 function replicate_course(url, course) {
73 $.ajax({ 73 $.ajax({
74 - url: url, 74 + url: url,
75 data: {'form': course}, 75 data: {'form': course},
76 success: function(data) { 76 success: function(data) {
77 $(".course_replicate_form").html(data); 77 $(".course_replicate_form").html(data);
courses/static/js/modal_category.js
@@ -6,6 +6,7 @@ var Submite = { @@ -6,6 +6,7 @@ var Submite = {
6 $(id_li_link).remove(); 6 $(id_li_link).remove();
7 $("#modal_category").empty(); 7 $("#modal_category").empty();
8 $("#accordion").remove(); 8 $("#accordion").remove();
  9 + $(".modal-backdrop.in").remove();
9 alertify.success("Category removed successfully!"); 10 alertify.success("Category removed successfully!");
10 }).fail(function(){ 11 }).fail(function(){
11 $("#modal_category").empty(); 12 $("#modal_category").empty();
courses/templates/category/create.html
@@ -27,25 +27,25 @@ @@ -27,25 +27,25 @@
27 27
28 <div class="panel panel-primary navigation"> 28 <div class="panel panel-primary navigation">
29 <div class="panel-heading"> 29 <div class="panel-heading">
30 - <h3 class="panel-title">Actions</h3> 30 + <h3 class="panel-title">{% trans 'Actions' %}</h3>
31 </div> 31 </div>
32 <div class="panel-body"> 32 <div class="panel-body">
33 <ul class="nav nav-pills nav-stacked"> 33 <ul class="nav nav-pills nav-stacked">
34 - <li><a href="javascript:void(0)">Replicate Course</a></li>  
35 - <li><a href="{% url 'course:create' %}">Create Course</a></li>  
36 - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li> 34 + <li><a href="javascript:void(0)">{% trans 'Replicate Course' %}</a></li>
  35 + <li><a href="{% url 'course:create' %}">{% trans 'Create Course' %}</a></li>
  36 + <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li>
37 </ul> 37 </ul>
38 </div> 38 </div>
39 </div> 39 </div>
40 40
41 <div class="panel panel-primary navigation"> 41 <div class="panel panel-primary navigation">
42 <div class="panel-heading"> 42 <div class="panel-heading">
43 - <h3 class="panel-title">Category</h3> 43 + <h3 class="panel-title">{% trans 'Category' %}</h3>
44 </div> 44 </div>
45 <div class="panel-body"> 45 <div class="panel-body">
46 <ul class="nav nav-pills nav-stacked"> 46 <ul class="nav nav-pills nav-stacked">
47 - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li>  
48 - <li><a href="{% url 'course:manage_cat' %}">List Category</a></li> 47 + <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li>
  48 + <li><a href="{% url 'course:manage_cat' %}">{% trans 'List Category' %}</a></li>
49 </ul> 49 </ul>
50 </div> 50 </div>
51 </div> 51 </div>
courses/templates/category/index.html
@@ -28,25 +28,25 @@ @@ -28,25 +28,25 @@
28 28
29 <div class="panel panel-primary navigation"> 29 <div class="panel panel-primary navigation">
30 <div class="panel-heading"> 30 <div class="panel-heading">
31 - <h3 class="panel-title">Actions</h3> 31 + <h3 class="panel-title">{% trans 'Actions' %}</h3>
32 </div> 32 </div>
33 <div class="panel-body"> 33 <div class="panel-body">
34 <ul class="nav nav-pills nav-stacked"> 34 <ul class="nav nav-pills nav-stacked">
35 - <li><a href="javascript:void(0)">Replicate Course</a></li>  
36 - <li><a href="{% url 'course:create' %}">Create Course</a></li>  
37 - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li> 35 + <li><a href="javascript:void(0)">{% trans 'Replicate Course' %}</a></li>
  36 + <li><a href="{% url 'course:create' %}">{% trans 'Create Course' %}</a></li>
  37 + <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li>
38 </ul> 38 </ul>
39 </div> 39 </div>
40 </div> 40 </div>
41 41
42 <div class="panel panel-primary navigation"> 42 <div class="panel panel-primary navigation">
43 <div class="panel-heading"> 43 <div class="panel-heading">
44 - <h3 class="panel-title">Category</h3> 44 + <h3 class="panel-title">{% trans 'Category' %}</h3>
45 </div> 45 </div>
46 <div class="panel-body"> 46 <div class="panel-body">
47 <ul class="nav nav-pills nav-stacked"> 47 <ul class="nav nav-pills nav-stacked">
48 - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li>  
49 - <li><a href="{% url 'course:manage_cat' %}">List Category</a></li> 48 + <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li>
  49 + <li><a href="{% url 'course:manage_cat' %}">{% trans 'List Category' %}</a></li>
50 </ul> 50 </ul>
51 </div> 51 </div>
52 </div> 52 </div>
courses/templates/category/update.html
@@ -28,24 +28,24 @@ @@ -28,24 +28,24 @@
28 28
29 <div class="panel panel-primary navigation"> 29 <div class="panel panel-primary navigation">
30 <div class="panel-heading"> 30 <div class="panel-heading">
31 - <h3 class="panel-title">Actions</h3> 31 + <h3 class="panel-title">{% trans 'Actions' %}</h3>
32 </div> 32 </div>
33 <div class="panel-body"> 33 <div class="panel-body">
34 <ul class="nav nav-pills nav-stacked"> 34 <ul class="nav nav-pills nav-stacked">
35 - <li><a href="javascript:void(0)">Replicate Course</a></li>  
36 - <li><a href="{% url 'course:create' %}">Create Course</a></li>  
37 - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li> 35 + <li><a href="javascript:void(0)">{% trans 'Replicate Course' %}</a></li>
  36 + <li><a href="{% url 'course:create' %}">{% trans 'Create Course' %}</a></li>
  37 + <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li>
38 </ul> 38 </ul>
39 </div> 39 </div>
40 </div> 40 </div>
41 <div class="panel panel-primary navigation"> 41 <div class="panel panel-primary navigation">
42 <div class="panel-heading"> 42 <div class="panel-heading">
43 - <h3 class="panel-title">Category</h3> 43 + <h3 class="panel-title">{% trans 'Category' %}</h3>
44 </div> 44 </div>
45 <div class="panel-body"> 45 <div class="panel-body">
46 <ul class="nav nav-pills nav-stacked"> 46 <ul class="nav nav-pills nav-stacked">
47 - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li>  
48 - <li><a href="{% url 'course:manage_cat' %}">List Category</a></li> 47 + <li><a href="{% url 'course:create_cat' %}">{% trans 'Create Category' %}</a></li>
  48 + <li><a href="{% url 'course:manage_cat' %}">{% trans 'List Category' %}</a></li>
49 </ul> 49 </ul>
50 </div> 50 </div>
51 </div> 51 </div>
courses/templates/course/course_card.html
1 {% load static i18n permission_tags %} 1 {% load static i18n permission_tags %}
2 {% load django_bootstrap_breadcrumbs %} 2 {% load django_bootstrap_breadcrumbs %}
3 -  
4 -<div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion-{{course.slug}}" role="tablist" aria-multiselectable="false">  
5 - <div class="group">  
6 - <div class="panel panel-info">  
7 - <div class="panel-heading" role="tab">  
8 - <div class="row">  
9 - <div class="col-xs-9 col-md-10 titleTopic">  
10 - <a role="button" data-toggle="collapse" data-parent="#accordion-{{course.slug}}" href=".collapseOne-{{course.slug}}" aria-expanded="false" aria-controls="collapseOne-{{course.slug}}" class="collapsed">  
11 - <h4 style="color:white">{{course.name}}</h4>  
12 - </a>  
13 - </div>  
14 - {% if user|has_role:'professor' or user|has_role:'system_admin' %}  
15 - <div class="col-xs-4 col-md-2" id="divMoreActions">  
16 - <div class="btn-group">  
17 - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">  
18 - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>  
19 - </button>  
20 - <ul class="dropdown-menu" aria-labelledby="moreActions">  
21 - <li><a href="{% url 'course:replicate_course' course.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>{% trans 'Replicate' %}</a></li>  
22 - <li><a href="javascript:delete_course('{% url 'course:delete' course.slug %}', '{{ course.slug }}', '{% trans "Are you sure you want to delete this course?" %}', '{% url 'course:manage' %}')"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>{% trans 'Remove' %}</a></li>  
23 - </ul>  
24 - </div>  
25 - </div>  
26 - {% endif %}  
27 - </div>  
28 - </div>  
29 - <div class="panel-collapse collapseOne-{{course.slug}} collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0">  
30 - <div class="panel-body">  
31 - <p><b>Course Name: </b>{{course.name}}</p>  
32 - <p><b>Coordinator: </b>{{course.professors.all.0}}</p>  
33 - <p>  
34 - <b>Description:</b>  
35 - <i>  
36 - {{course.content}}  
37 - </i>  
38 - </p>  
39 - <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Course' %}<div class="ripple-container"></div></a>  
40 - </div>  
41 - </div>  
42 - </div>  
43 - </div> 3 +<div class="group">
  4 + <div class="panel panel-info">
  5 + <div class="panel-heading course">
  6 + <div class="row">
  7 + <div class="col-md-1 moreAccordion" data-toggle="collapse" data-parent="#accordion-{{course.slug}}" href=".collapseOne-{{course.slug}}" aria-expanded="false" aria-controls="collapseOne-{{course.slug}}">
  8 + <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button>
  9 + </div>
  10 + <div class="col-xs-9 col-md-4 titleTopic">
  11 + <a role="button" href="{% url 'course:view' course.slug %}">
  12 + <h4>{{course.name}}</h4>
  13 + </a>
  14 + </div>
  15 + {% if user|has_role:'professor' or user|has_role:'system_admin' %}
  16 + <div class="col-xs-4 col-md-6 divMoreActions" >
  17 + <div class="btn-group">
  18 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  19 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  20 + </button>
  21 + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions">
  22 + <li><a href="{% url 'course:replicate_course' course.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>{% trans 'Replicate' %}</a></li>
  23 + <li><a href="javascript:delete_course('{% url 'course:delete' course.slug %}', '{{ course.slug }}', '{% trans "Are you sure you want to delete this course?" %}', '{% url 'course:manage' %}')"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp;{% trans 'Remove' %}</a></li>
  24 + </ul>
  25 + </div>
  26 + </div>
  27 + {% endif %}
  28 + </div>
  29 + </div>
  30 + <div class="panel-collapse collapseOne-{{course.slug}} collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0">
  31 + <div class="panel-body">
  32 + <p><b>Course Name: </b>{{course.name}}</p>
  33 + <p><b>Coordinator: </b>{{course.professors.all.0}}</p>
  34 + <p>
  35 + <b>Description:</b>
  36 + <i>
  37 + {{course.content}}
  38 + </i>
  39 + </p>
  40 + </div>
  41 + </div>
  42 + </div>
44 </div> 43 </div>
45 44
46 <div class="modal fade" id="replicateCourse" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> 45 <div class="modal fade" id="replicateCourse" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
courses/templates/course/create.html
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."/> 26 <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."/>
27 <span class="input-group-btn input-group-sm"> 27 <span class="input-group-btn input-group-sm">
28 <button type="button" class="btn btn-fab btn-fab-mini"> 28 <button type="button" class="btn btn-fab btn-fab-mini">
29 - <i class="material-icons">attach_file</i> 29 + <i class="material-icons">{% trans 'attach_file' %}</i>
30 </button> 30 </button>
31 </span> 31 </span>
32 </div> 32 </div>
courses/templates/course/index.html
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 {% endblock %} 11 {% endblock %}
12 12
13 {% block sidebar %} 13 {% block sidebar %}
14 - <div class="panel panel-primary navigation"> 14 + <div class="panel panel-primary">
15 <div class="panel-heading"> 15 <div class="panel-heading">
16 <h4>Menu</h4> 16 <h4>Menu</h4>
17 </div> 17 </div>
@@ -42,89 +42,67 @@ @@ -42,89 +42,67 @@
42 </div> 42 </div>
43 </div> 43 </div>
44 44
45 - {% if user|has_role:'professor' or user|has_role:'system_admin' %} 45 + {% if user|has_role:'professor' or user|has_role:'system_admin' %}
  46 + <div class="panel panel-primary">
  47 + <div class="panel-heading">
  48 + <h3 class="panel-title">Category</h3>
  49 + </div>
  50 + <div class="panel-body">
  51 + <ul class="nav nav-pills nav-stacked">
  52 + <li><a href="{% url 'course:create_cat' %}">Create Category</a></li>
  53 + <li><a href="{% url 'course:manage_cat' %}">List Category</a></li>
  54 + </ul>
  55 + </div>
  56 + </div>
  57 + {% endif %}
46 58
47 - <div class="panel panel-primary navigation">  
48 - <div class="panel-heading">  
49 - <h3 class="panel-title">Category</h3>  
50 - </div>  
51 - <div class="panel-body">  
52 - <ul class="nav nav-pills nav-stacked">  
53 - <li><a href="{% url 'course:create_cat' %}">Create Category</a></li>  
54 - <li><a href="{% url 'course:manage_cat' %}">List Category</a></li>  
55 - </ul>  
56 - </div>  
57 - </div>  
58 - {% endif %}  
59 {% endblock %} 59 {% endblock %}
60 60
61 {% block content %} 61 {% block content %}
62 - {% if messages %}  
63 - {% for message in messages %}  
64 - <div class="alert alert-success alert-dismissible" role="alert">  
65 - <button type="button" class="close" data-dismiss="alert" aria-label="Close">  
66 - <span aria-hidden="true">&times;</span>  
67 - </button>  
68 - <p>{{ message }}</p>  
69 - </div>  
70 - {% endfor %}  
71 - {% endif %} 62 + {% if messages %}
  63 + {% for message in messages %}
  64 + <div class="alert alert-success alert-dismissible" role="alert">
  65 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  66 + <span aria-hidden="true">&times;</span>
  67 + </button>
  68 + <p>{{ message }}</p>
  69 + </div>
  70 + {% endfor %}
  71 + {% endif %}
72 72
73 -<div class="col-md-12">  
74 - <form id="searchform" action="{% url 'course:manage' %}" method="get" accept-charset="utf-8">  
75 - <div class="input-group">  
76 - <div class="form-group is-empty">  
77 - <input type="search" class="form-control" placeholder="Search Courses" name="q" id="searchbox"></div>  
78 - <span class="input-group-btn input-group-sm">  
79 - <button type="button" class="btn btn-fab btn-fab-mini">  
80 - <i class="material-icons">search</i>  
81 - </button>  
82 - </span>  
83 - </div>  
84 - </form> 73 +<div class="col-md-12 cards-content">
  74 + <form id="searchform" action="{% url 'course:manage' %}" method="get" accept-charset="utf-8">
  75 + <div class="input-group">
  76 + <div class="form-group is-empty">
  77 + <input type="search" class="form-control" placeholder="Search Courses" name="q" id="searchbox"></div>
  78 + <span class="input-group-btn input-group-sm">
  79 + <button type="button" class="btn btn-fab btn-fab-mini">
  80 + <i class="material-icons">search</i>
  81 + </button>
  82 + </span>
  83 + </div>
  84 + </form>
85 </div> 85 </div>
86 -  
87 86
88 -</fieldset>  
89 - <div class="col-md-12">  
90 - {% if courses|length > 0 %}  
91 - {% if request.GET.category == 'all' or none or request.GET.category == '' %}  
92 - {% for course in list_courses %}  
93 - {% include "course/course_card.html" %}  
94 - {% endfor %}  
95 - {% else %}  
96 - {% for course in courses_category %}  
97 - {% if course.category.name == request.GET.category %}  
98 - <!-- Put your content here! -->  
99 - {% include "course/course_card.html" %}  
100 - {% endif %}  
101 - {% endfor %}  
102 - {% endif %}  
103 - {% else %}  
104 - {% trans 'No courses found' %}  
105 - {% endif %}  
106 - </div>  
107 - <div class="col-md-12">  
108 - <nav aria-label="Page navigation">  
109 - <ul class="pagination">  
110 - {% if page_obj.has_previous %}  
111 - <li>  
112 - <a href="?page={{ page_obj.previous_page_number }}"><span><<</span></a>  
113 - </li>  
114 - {% endif %}  
115 - {% for page_number in paginator.page_range %}  
116 - <li{% if page_obj.number == page_number %} class="active"{% endif %}>  
117 - <a href="?page={{ page_number }}">{{ page_number }}</a>  
118 - </li>  
119 - {% endfor %}  
120 - {% if page_obj.has_next %}  
121 - <li>  
122 - <a href="?page={{ page_obj.next_page_number }}"><span>>></span></a>  
123 - </li>  
124 - {% endif %}  
125 - </ul>  
126 - </nav>  
127 - </div>  
128 87
129 - <script type="text/javascript" src="{% static 'js/course.js' %}"></script> 88 +</fieldset>
  89 + <div class="col-md-12 cards-content">
  90 + {% if courses|length > 0 %}
  91 + {% if request.GET.category == 'all' or none or request.GET.category == '' %}
  92 + {% for course in list_courses %}
  93 + {% include "course/course_card.html" %}
  94 + {% endfor %}
  95 + {% else %}
  96 + {% for course in courses_category %}
  97 + {% if course.category.name == request.GET.category %}
  98 + <!-- Put your content here! -->
  99 + {% include "course/course_card.html" %}
  100 + {% endif %}
  101 + {% endfor %}
  102 + {% endif %}
  103 + {% else %}
  104 + {% trans 'No courses found' %}
  105 + {% endif %}
  106 + </div>
  107 + <script type="text/javascript" src="{% static 'js/course.js' %}"></script>
130 {% endblock %} 108 {% endblock %}
courses/templates/course/replicate.html
@@ -15,86 +15,86 @@ @@ -15,86 +15,86 @@
15 <div class="card-body"> 15 <div class="card-body">
16 <form method="post" action="" enctype="multipart/form-data">{% csrf_token %} 16 <form method="post" action="" enctype="multipart/form-data">{% csrf_token %}
17 <div class="form-group is-fileinput"> 17 <div class="form-group is-fileinput">
18 - <label for="id_name">Name</label> 18 + <label for="id_name">{% trans 'Name' %}</label>
19 19
20 20
21 <input class="form-control" id="id_name" maxlength="100" name="name" type="text" required="" value="{{course.name}}"> 21 <input class="form-control" id="id_name" maxlength="100" name="name" type="text" required="" value="{{course.name}}">
22 22
23 - <span class="help-block">Course name</span> 23 + <span class="help-block">{% trans 'Course name' %}</span>
24 24
25 </div> 25 </div>
26 26
27 <div class="form-group is-fileinput"> 27 <div class="form-group is-fileinput">
28 - <label for="id_objectivies">Objectives</label> 28 + <label for="id_objectivies">{% trans 'Objectives' %}</label>
29 29
30 <textarea class="form-control" cols="80" id="id_objectivies" name="objectivies" rows="5">{{course.objectivies}}</textarea> 30 <textarea class="form-control" cols="80" id="id_objectivies" name="objectivies" rows="5">{{course.objectivies}}</textarea>
31 31
32 - <span class="help-block">Course objective</span> 32 + <span class="help-block">{% trans 'Course objective' %}</span>
33 33
34 </div> 34 </div>
35 35
36 <div class="form-group is-fileinput"> 36 <div class="form-group is-fileinput">
37 - <label for="id_content">Content</label> 37 + <label for="id_content">{% trans 'Content' %}</label>
38 38
39 39
40 <textarea class="form-control" cols="80" id="id_content" name="content" rows="5">{{course.content}}</textarea> 40 <textarea class="form-control" cols="80" id="id_content" name="content" rows="5">{{course.content}}</textarea>
41 41
42 - <span class="help-block">Course modules</span> 42 + <span class="help-block">{% trans 'Course modules' %}</span>
43 43
44 </div> 44 </div>
45 45
46 <div class="form-group is-fileinput"> 46 <div class="form-group is-fileinput">
47 - <label for="id_max_students">Number of studets maximum</label> 47 + <label for="id_max_students">{% trans 'Number of studets maximum' %}</label>
48 48
49 49
50 <input class="form-control" id="id_max_students" min="0" name="max_students" type="number" value="{{course.max_students}}"> 50 <input class="form-control" id="id_max_students" min="0" name="max_students" type="number" value="{{course.max_students}}">
51 51
52 - <span class="help-block">Max number of students that a class can have</span> 52 + <span class="help-block">{% trans 'Max number of students that a class can have' %}</span>
53 53
54 </div> 54 </div>
55 55
56 <div class="form-group is-fileinput"> 56 <div class="form-group is-fileinput">
57 - <label for="id_init_register_date">Course registration start date</label> 57 + <label for="id_init_register_date">{% trans 'Course registration start date' %}</label>
58 58
59 59
60 <input type="date" class="form-control" name="init_register_date" value="None" min="2016-10-24"> 60 <input type="date" class="form-control" name="init_register_date" value="None" min="2016-10-24">
61 61
62 - <span class="help-block">Date that starts the registration period of the course (dd/mm/yyyy)</span> 62 + <span class="help-block">{% trans 'Date that starts the registration period of the course (dd/mm/yyyy)' %}</span>
63 63
64 </div> 64 </div>
65 65
66 <div class="form-group is-fileinput"> 66 <div class="form-group is-fileinput">
67 - <label for="id_end_register_date">Course registration end date</label> 67 + <label for="id_end_register_date">{% trans 'Course registration end date' %}</label>
68 68
69 69
70 <input type="date" class="form-control" name="end_register_date" value="None" min="2016-10-24"> 70 <input type="date" class="form-control" name="end_register_date" value="None" min="2016-10-24">
71 71
72 - <span class="help-block">Date that ends the registration period of the course (dd/mm/yyyy)</span> 72 + <span class="help-block">{% trans 'Date that ends the registration period of the course (dd/mm/yyyy)' %}</span>
73 73
74 </div> 74 </div>
75 75
76 <div class="form-group is-fileinput"> 76 <div class="form-group is-fileinput">
77 - <label for="id_init_date">Course start date</label> 77 + <label for="id_init_date">{% trans 'Course start date' %}</label>
78 78
79 79
80 <input type="date" class="form-control" name="init_date" value="None" min="2016-10-24"> 80 <input type="date" class="form-control" name="init_date" value="None" min="2016-10-24">
81 81
82 - <span class="help-block">Date that the course starts (dd/mm/yyyy)</span> 82 + <span class="help-block">{% trans 'Date that the course starts (dd/mm/yyyy)' %}</span>
83 83
84 </div> 84 </div>
85 85
86 <div class="form-group is-fileinput"> 86 <div class="form-group is-fileinput">
87 - <label for="id_end_date">Course end date</label> 87 + <label for="id_end_date">{% trans 'Course end date' %}</label>
88 88
89 89
90 <input type="date" class="form-control" name="end_date" value="None" min="2016-10-24"> 90 <input type="date" class="form-control" name="end_date" value="None" min="2016-10-24">
91 91
92 - <span class="help-block">Date that the course ends (dd/mm/yyyy)</span> 92 + <span class="help-block">{% trans 'Date that the course ends (dd/mm/yyyy)' %}</span>
93 93
94 </div> 94 </div>
95 95
96 <div class="form-group is-fileinput"> 96 <div class="form-group is-fileinput">
97 - <label for="id_image">Imagem</label> 97 + <label for="id_image">{% trans 'Imagem' %}</label>
98 98
99 99
100 <input class="form-control" id="id_image" name="image" type="file"> 100 <input class="form-control" id="id_image" name="image" type="file">
@@ -102,17 +102,17 @@ @@ -102,17 +102,17 @@
102 <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."> 102 <input type="text" readonly="" class="form-control" placeholder="Choose your photo...">
103 <span class="input-group-btn input-group-sm"> 103 <span class="input-group-btn input-group-sm">
104 <button type="button" class="btn btn-fab btn-fab-mini"> 104 <button type="button" class="btn btn-fab btn-fab-mini">
105 - <i class="material-icons">attach_file</i> 105 + <i class="material-icons">{% trans 'attach_file' %}</i>
106 </button> 106 </button>
107 </span> 107 </span>
108 </div> 108 </div>
109 109
110 - <span class="help-block">Representative image of the course</span> 110 + <span class="help-block">{% trans 'Representative image of the course' %}</span>
111 111
112 </div> 112 </div>
113 113
114 <div class="form-group is-fileinput"> 114 <div class="form-group is-fileinput">
115 - <label for="id_category">CourseCategory</label> 115 + <label for="id_category">{% trans 'CourseCategory' %}</label>
116 116
117 117
118 <select class="form-control" id="id_category" name="category" required=""> 118 <select class="form-control" id="id_category" name="category" required="">
@@ -121,7 +121,7 @@ @@ -121,7 +121,7 @@
121 {% endfor %} 121 {% endfor %}
122 </select> 122 </select>
123 123
124 - <span class="help-block">CourseCategory which the course belongs</span> 124 + <span class="help-block">{% trans 'CourseCategory which the course belongs' %}</span>
125 125
126 </div> 126 </div>
127 127
courses/templates/course/update.html
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."/> 25 <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."/>
26 <span class="input-group-btn input-group-sm"> 26 <span class="input-group-btn input-group-sm">
27 <button type="button" class="btn btn-fab btn-fab-mini"> 27 <button type="button" class="btn btn-fab btn-fab-mini">
28 - <i class="material-icons">attach_file</i> 28 + <i class="material-icons">{% trans 'attach_file' %}</i>
29 </button> 29 </button>
30 </span> 30 </span>
31 </div> 31 </div>
courses/templates/course/view.html
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 {% endblock %} 19 {% endblock %}
20 20
21 {% block sidebar %} 21 {% block sidebar %}
22 - <div class="panel panel-primary navigation"> 22 + <div class="panel panel-primary">
23 <div class="panel-heading"> 23 <div class="panel-heading">
24 <h5>{% trans 'Menu' %}</h5> 24 <h5>{% trans 'Menu' %}</h5>
25 </div> 25 </div>
@@ -38,15 +38,15 @@ @@ -38,15 +38,15 @@
38 38
39 {% block content %} 39 {% block content %}
40 40
41 - <div class="col-md-12"> 41 + <div class="col-md-12 cards-content">
42 <div class="panel panel-info"> 42 <div class="panel panel-info">
43 - <div class="panel-heading headingOne"> 43 + <div class="panel-heading course-detail">
44 <div class="row"> 44 <div class="row">
45 - <div class="col-xs-8 col-md-10 titleTopic">  
46 - <h4>{{course}}</h4> 45 + <div class="col-xs-8 col-md-4 .titleTopic-detail">
  46 + <h4>{{course.name}}</h4>
47 </div> 47 </div>
48 {% if user|has_role:'professor' and user in course.professors or user|has_role:'system_admin' %} 48 {% if user|has_role:'professor' and user in course.professors or user|has_role:'system_admin' %}
49 - <div class="col-xs-4 col-md-2" id="divMoreActions"> 49 + <div class="col-xs-4 col-md-8" id="divMoreActions">
50 <div class="btn-group"> 50 <div class="btn-group">
51 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 51 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
52 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> 52 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 74
75 </div> 75 </div>
76 </div> 76 </div>
77 - 77 +
78 <!-- MODAL CREATE SUBJECT --> 78 <!-- MODAL CREATE SUBJECT -->
79 <div class="modal" tabindex="-1" role="dialog " id="createSubject"> 79 <div class="modal" tabindex="-1" role="dialog " id="createSubject">
80 <div class="modal-dialog"> 80 <div class="modal-dialog">
@@ -121,19 +121,22 @@ @@ -121,19 +121,22 @@
121 </div> 121 </div>
122 </div> 122 </div>
123 </div> 123 </div>
124 -<div> 124 +<div class="cards-detail">
125 {% if request.GET.category == 'all' or none or request.GET.category == '' %} 125 {% if request.GET.category == 'all' or none or request.GET.category == '' %}
126 {% for subject in subjects %} 126 {% for subject in subjects %}
127 - <div class="panel panel-info panel_{{ subject.id }}">  
128 - <div class="panel-heading headingTwo ui-sortable-handle" role="tab"> 127 + <div class="panel panel-default panel_{{ subject.id }}">
  128 + <div class="panel-heading heading_{{subject.id}} subject ui-sortable-handle">
129 <div class="row"> 129 <div class="row">
130 - <div class="col-xs-9 col-md-10 titleTopic">  
131 - <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseTwo" aria-expanded="true" aria-controls="collapseTwo">  
132 - <h4 style="color:white">{{subject.name}}</h4> 130 + <div class="col-md-1 moreAccordion" data-toggle="collapse" data-parent="#accordion-{{subject.slug}}" href=".collapseSubject-{{subject.slug}}" aria-expanded="false" aria-controls="collapseSubject-{{subject.slug}}">
  131 + <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button>
  132 + </div>
  133 + <div class="col-xs-9 col-md-4 titleTopic">
  134 + <a role="button" href="{% url 'course:view_subject' subject.slug %}">
  135 + <h4>{{subject.name}}</h4>
133 </a> 136 </a>
134 </div> 137 </div>
135 {% if user|has_role:'professor' and user in subject.professors or user|has_role:'system_admin' %} 138 {% if user|has_role:'professor' and user in subject.professors or user|has_role:'system_admin' %}
136 - <div class="col-xs-3 col-md-2" id="divMoreActions"> 139 + <div class="col-xs-3 col-md-6" id="divMoreActions">
137 <div class="btn-group"> 140 <div class="btn-group">
138 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 141 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
139 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> 142 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
@@ -153,40 +156,44 @@ @@ -153,40 +156,44 @@
153 {% endif %} 156 {% endif %}
154 </div> 157 </div>
155 </div> 158 </div>
156 - <div class="panel-body">  
157 - <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %}  
158 - {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p>  
159 - <p>  
160 - <b>{% trans "Description" %}: </b>  
161 - <i>  
162 - {{subject.description}}  
163 - </i>  
164 - </p>  
165 - <div class="row">  
166 - <div class="col-xs-6 col-md-6">  
167 - <p><b>{% trans "Begining" %}: </b>{{subject.init_date}}</p>  
168 - </div>  
169 - <div class="col-xs-6 col-md-6">  
170 - <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p>  
171 - </div> 159 + <div class="panel-collapse collapseSubject-{{subject.slug}} collapse in" aria-labelledby="heading_{{subject.id}}" aria-expanded="true" aria-hidden="false">
  160 + <div class="panel-body">
  161 + <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %}
  162 + {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p>
  163 + <p>
  164 + <b>{% trans "Description" %}: </b>
  165 + <i>
  166 + {{subject.description}}
  167 + </i>
  168 + </p>
  169 + <div class="row">
  170 + <div class="col-xs-6 col-md-6">
  171 + <p><b>{% trans "Begining" %}: </b>{{subject.init_date}}</p>
172 </div> 172 </div>
173 - <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block view_btn" {% if user|show_subject_subscribe:subject %}style="display:none"{% endif %}>{% trans 'View Subject' %}<div class="ripple-container"></div></a>  
174 - </div> 173 + <div class="col-xs-6 col-md-6">
  174 + <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p>
  175 + </div>
  176 + </div>
  177 + </div>
  178 + </div>
175 </div> 179 </div>
176 {% endfor %} 180 {% endfor %}
177 {% else %} 181 {% else %}
178 {% for subject in subjects_category %} 182 {% for subject in subjects_category %}
179 {% if subject.category.name == request.GET.category %} 183 {% if subject.category.name == request.GET.category %}
180 <div class="panel panel-info panel_{{ subject.id }}"> 184 <div class="panel panel-info panel_{{ subject.id }}">
181 - <div class="panel-heading headingTwo ui-sortable-handle" role="tab">  
182 - <div class="row">  
183 - <div class="col-xs-9 col-md-10 titleTopic">  
184 - <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseTwo" aria-expanded="true" aria-controls="collapseTwo">  
185 - <h4 style="color:white">{{subject.name}}</h4>  
186 - </a>  
187 - </div> 185 + <div class="panel-heading heading_{{subject.id}} subject ui-sortable-handle" role="tab">
  186 + <div class="row">
  187 + <div class="col-md-1 moreAccordion" data-toggle="collapse" data-parent="#accordion-{{subject.slug}}" href=".collapseSubject-{{subject.slug}}" aria-expanded="false" aria-controls="collapseSubject-{{subject.slug}}">
  188 + <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button>
  189 + </div>
  190 + <div class="col-xs-9 col-md-4 titleTopic">
  191 + <a role="button" href="{% url 'course:view_subject' subject.slug %}">
  192 + <h4>{{subject.name}}</h4>
  193 + </a>
  194 + </div>
188 {% if user|has_role:'professor' and user in subject.professors or user|has_role:'system_admin' %} 195 {% if user|has_role:'professor' and user in subject.professors or user|has_role:'system_admin' %}
189 - <div class="col-xs-3 col-md-2" id="divMoreActions"> 196 + <div class="col-xs-3 col-md-6" id="divMoreActions">
190 <div class="btn-group"> 197 <div class="btn-group">
191 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 198 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
192 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> 199 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
@@ -205,7 +212,8 @@ @@ -205,7 +212,8 @@
205 {% endif %} 212 {% endif %}
206 </div> 213 </div>
207 </div> 214 </div>
208 - <div class="panel-body"> 215 + <div class="panel-collapse collapseSubject-{{subject.slug}} collapse in" aria-labelledby="heading_{{subject.id}}" aria-expanded="true" aria-hidden="false">
  216 + <div class="panel-body">
209 <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} 217 <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %}
210 {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p> 218 {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p>
211 <p> 219 <p>
@@ -222,8 +230,8 @@ @@ -222,8 +230,8 @@
222 <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p> 230 <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p>
223 </div> 231 </div>
224 </div> 232 </div>
225 - <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block view_btn" {% if user|show_subject_subscribe:subject %}style="display:none"{% endif %}>{% trans 'View Subject' %}<div class="ripple-container"></div></a>  
226 </div> 233 </div>
  234 + </div>
227 </div> 235 </div>
228 {% endif %} 236 {% endif %}
229 {% endfor %} 237 {% endfor %}
courses/templates/subject/form_view_student.html
1 -{% load static i18n list_topic_foruns %} 1 + {% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access%}
2 2
3 -{% block javascript %}  
4 - <script type="text/javascript" src="{% static 'js/forum.js' %}"></script>  
5 -{% endblock %}  
6 -  
7 -<div class="panel panel-default">  
8 - <a href="{% url 'course:view_topic' topic.slug %}">  
9 - <div class="panel-heading">  
10 - <div class="row">  
11 - <div class="col-md-9 col-sm-9">  
12 - <h3>{{topic}}</h3>  
13 - </div>  
14 - </div> 3 + {% block javascript %}
  4 + <script type="text/javascript" src="{% static 'js/forum.js' %}"></script>
  5 + <script src="{% static 'js/file.js' %}"></script>
  6 + <script type="text/javascript" src="{% static 'js/material.js' %}"></script>
  7 + <script type = "text/javascript" src="{% static 'links.js' %}"></script>
  8 + {% endblock %}
  9 +<div class="cards-detail">
  10 + <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false">
  11 + <div class="group"><div class="panel panel-default">
  12 + <div class="panel-heading topic ui-sortable-handle" role="tab">
  13 + <div class="row">
  14 + <div class="col-md-1 moreAccordion" data-toggle="collapse" data-parent="#accordion-{{topic.slug}}" href=".collapseTopic-{{topic.slug}}" aria-expanded="false" aria-controls="collapseTopic-{{topic.slug}}">
  15 + <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button>
15 </div> 16 </div>
16 - </a>  
17 -</div>  
18 -<div class="panel-body">  
19 - <p>{{topic.description|linebreaks}}</p>  
20 - {% list_topic_foruns request topic %}  
21 - {% list_topic_poll request topic %}  
22 -</div> 17 + <div class="col-xs-9 col-md-9 titleTopic">
  18 + <a role="button">
  19 + <h4>{{topic}}</h4>
  20 + </a>
  21 + </div>
  22 + </div>
  23 + </div>
  24 + <div class="panel-collapse collapseTopic-{{topic.slug}} collapse in" role="tabpanel" aria-labelledby="heading_{{topic.id}}" aria-expanded="true" aria-hidden="false">
  25 + <div class="panel-body">
  26 + <div class="presentation">
  27 + <p>
  28 + <i>
  29 + {{topic.description|linebreaks}}
  30 + </i>
  31 + </p>
  32 + <div class="row">
  33 + <div class="col-xs-6 col-md-6">
  34 + <div class="resource_inline">
  35 + <h4>Material</h4>
  36 + </div>
  37 + <ul id="list-materials">
  38 + {% list_topic_file request topic %}
  39 + {% list_topic_link request topic%}
23 40
24 -<div class="modal fade" id="forumModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">  
25 - <div class="modal-dialog" role="document">  
26 - <div class="modal-content">  
27 - <div class="modal-header">  
28 - <h4 class="modal-title" id="myModalLabel">{% trans 'Forum' %}</h4> 41 + </ul>
29 </div> 42 </div>
30 - <div class="modal-body">  
31 - <section>  
32 - <div class="forum_topics"></div>  
33 - </section>  
34 - </div>  
35 - <div class="modal-footer">  
36 - <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans 'Close' %}</button>  
37 - <button type="button" class="btn btn-primary btn-raised">{% trans 'Save changes' %}</button> 43 + <div class="col-xs-4 col-md-4">
  44 + <div class="resource_inline">
  45 + <h4>Activities</h4>
  46 + </div>
  47 + <ul>
  48 +
  49 + <div class="foruns_list">
  50 + {% list_topic_foruns request topic %}
  51 + </div>
  52 + </ul>
38 </div> 53 </div>
  54 + {% list_topic_poll request topic %}
  55 + </div>
39 </div> 56 </div>
  57 + </div>
  58 + </div>
  59 + </div>
  60 +
  61 + </div>
  62 +
  63 + {% professor_subject topic.subject user as professor_links %}
  64 + {% if professor_links%}
  65 + {% include "links/create_link.html" %}
  66 + {% include "links/delete_link.html" %}
  67 + {% endif %}
  68 +
  69 +
  70 + <!-- MODAL LINK EDIT-->
  71 + {% professor_subject topic.subject user as links_update %}
  72 + {% if links_update%}
  73 + {% include "links/update_link.html" %}
  74 + {% endif %}
40 </div> 75 </div>
41 -</div> 76 + </div>
42 \ No newline at end of file 77 \ No newline at end of file
courses/templates/subject/form_view_teacher.html
1 - {% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access%} 1 +{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access%}
2 2
3 - {% block javascript %}  
4 - <script type="text/javascript" src="{% static 'js/forum.js' %}"></script>  
5 - <script src="{% static 'js/file.js' %}"></script>  
6 - <script type="text/javascript" src="{% static 'js/material.js' %}"></script>  
7 - <script type = "text/javascript" src="{% static 'links.js' %}"></script>  
8 - {% endblock %}  
9 -  
10 - <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false">  
11 - <div class="group"><div class="panel panel-default">  
12 - <div class="panel-heading headingOne ui-sortable-handle" role="tab">  
13 - <div class="row">  
14 - <div class="col-xs-9 col-md-10 titleTopic">  
15 - <a role="button" data-toggle="collapse" data-parent=".accordion" href=".collapseOne" aria-expanded="false" aria-controls="collapseOne" class="" aria-selected="false" tabindex="-1">  
16 - {{topic}}  
17 - </a>  
18 - </div>  
19 - <div class="col-xs-3 col-md-2 divMoreActions">  
20 - <div class="btn-group">  
21 - <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible">  
22 - <i class="fa fa-eye fa-2x" aria-hidden="true"></i>  
23 - </button> 3 +{% block javascript %}
  4 + <script type="text/javascript" src="{% static 'js/forum.js' %}"></script>
  5 + <script src="{% static 'js/file.js' %}"></script>
  6 + <script type="text/javascript" src="{% static 'js/material.js' %}"></script>
  7 + <script type = "text/javascript" src="{% static 'links.js' %}"></script>
  8 +{% endblock %}
  9 +<div class="cards-detail">
  10 + <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false">
  11 + <div class="group">
  12 + <div class="panel panel-default">
  13 + <div class="panel-heading topic ui-sortable-handle" role="tab">
  14 + <div class="row">
  15 + <div class="col-md-1 moreAccordion" data-toggle="collapse" data-parent="#accordion-{{topic.slug}}" href=".collapseTopic-{{topic.slug}}" aria-expanded="false" aria-controls="collapseTopic-{{topic.slug}}">
  16 + <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button>
24 </div> 17 </div>
25 - <div class="btn-group">  
26 - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">  
27 - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>  
28 - </button>  
29 - {% professor_subject topic.subject user as dropdown_topic %}  
30 - {% if dropdown_topic %}  
31 - <ul class="dropdown-menu pull-right" aria-labelledby="moreActions">  
32 - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Replicate" %}</a></li>  
33 - <li><a href="javascript:void(0)" class="edit_card"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Edit" %}</a></li>  
34 - <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeTopic"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Remove" %}</a></li>  
35 - </ul>  
36 - {% endif %} 18 + <div class="col-xs-9 col-md-9 titleTopic">
  19 + <a role="button">
  20 + <h4>{{topic}}</h4>
  21 + </a>
  22 + </div>
  23 + <div class="col-xs-3 col-md-2 divMoreActions">
  24 + <div class="btn-group">
  25 + <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible">
  26 + <i class="fa fa-eye fa-2x" aria-hidden="true"></i>
  27 + </button>
  28 + </div>
  29 + <div class="btn-group">
  30 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  31 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  32 + </button>
  33 + {% professor_subject topic.subject user as dropdown_topic %}
  34 + {% if dropdown_topic %}
  35 + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions">
  36 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Replicate" %}</a></li>
  37 + <li><a href="javascript:void(0)" class="edit_card"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Edit" %}</a></li>
  38 + <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeTopic"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Remove" %}</a></li>
  39 + </ul>
  40 + {% endif %}
  41 + </div>
37 </div> 42 </div>
38 </div> 43 </div>
39 </div> 44 </div>
40 - </div>  
41 - <div class="panel-collapse collapseOne collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="false" aria-hidden="true" tabindex="-1" aria-selected="false">  
42 - <div class="panel-body">  
43 - <div class="presentation">  
44 - <p>  
45 - <i>  
46 - {{topic.description|linebreaks}}  
47 - </i>  
48 - </p>  
49 - <div class="row">  
50 - <div class="col-xs-6 col-md-6">  
51 - <div class="resource_inline">  
52 - <h4>Material</h4> 45 + <div class="panel-collapse collapseOne collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="false" aria-hidden="true" tabindex="-1" aria-selected="false">
  46 + <div class="panel-body">
  47 + <div class="presentation">
  48 + <p>
  49 + <i>
  50 + {{topic.description|linebreaks}}
  51 + </i>
  52 + </p>
  53 + <div class="row">
  54 + <div class="col-xs-6 col-md-6">
  55 + <div class="resource_inline">
  56 + <h4>{% trans 'Material' %}</h4>
  57 + </div>
  58 + <div class="resource_inline">
  59 + <div class="dropdown">
  60 + <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>
  61 + <ul class="dropdown-menu" aria-labelledby="dLabel">
  62 + <li><a href=" javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink') ">{% trans 'Create a Link' %}<div class="ripple-container"><div class="ripple ripple-on ripple-out" style="left: 54.5312px; top: 22px; background-color: rgb(0, 150, 136); transform: scale(20);"></div></div></a></li>
  63 + <li>
  64 + <a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')">
  65 + {% trans "Create a file" %}
  66 + <div class="ripple-container">
  67 + <div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);">
  68 + </div>
  69 + </div>
  70 + </a>
  71 + </li>
  72 + </ul>
  73 + </div>
  74 + </div>
  75 + <ul id="list-materials">
  76 + {% list_topic_file request topic %}
  77 + {% list_topic_link request topic%}
  78 +
  79 + </ul>
53 </div> 80 </div>
54 - <div class="resource_inline">  
55 - <div class="dropdown">  
56 - <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>  
57 - <ul class="dropdown-menu" aria-labelledby="dLabel">  
58 - <li><a href=" javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink') ">Create a Link<div class="ripple-container"><div class="ripple ripple-on ripple-out" style="left: 54.5312px; top: 22px; background-color: rgb(0, 150, 136); transform: scale(20);"></div></div></a></li>  
59 - <li>  
60 - <a href="javascript:get_modal_file('{% url 'course:file:create_file' topic.slug %}', '#fileModal', '#divModalFile')">  
61 - {% trans "Create a file" %}  
62 - <div class="ripple-container">  
63 - <div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);">  
64 - </div>  
65 - </div>  
66 - </a>  
67 - </li>  
68 - </ul> 81 + <div class="col-xs-4 col-md-4">
  82 + <div class="resource_inline">
  83 + <h4>{% trans 'Activities' %}</h4>
69 </div> 84 </div>
70 </div> 85 </div>
71 <ul id="list-materials"> 86 <ul id="list-materials">
72 {% list_topic_file request topic %} 87 {% list_topic_file request topic %}
73 {% list_topic_link request topic%} 88 {% list_topic_link request topic%}
74 - 89 +
75 </ul> 90 </ul>
76 </div> 91 </div>
77 <div class="col-xs-4 col-md-4"> 92 <div class="col-xs-4 col-md-4">
@@ -89,7 +104,7 @@ @@ -89,7 +104,7 @@
89 </div> 104 </div>
90 </div> 105 </div>
91 <ul> 106 <ul>
92 - 107 +
93 <div class="foruns_list"> 108 <div class="foruns_list">
94 {% list_topic_foruns request topic %} 109 {% list_topic_foruns request topic %}
95 </div> 110 </div>
@@ -97,74 +112,84 @@ @@ -97,74 +112,84 @@
97 </div> 112 </div>
98 {% list_topic_poll request topic %} 113 {% list_topic_poll request topic %}
99 </div> 114 </div>
100 - </div>  
101 - <div class="editation" style="display: none">  
102 - <div class="form-group">  
103 - <label class="control-label" for="focusedInput2">Name Topic</label>  
104 - <input type="text" class="form-control" value="Topic 1">  
105 - </div>  
106 - <div class="form-group is-empty">  
107 - <label class="control-label" for="focusedInput2">Description</label>  
108 - <textarea class="form-control" rows="3" id="textArea"></textarea>  
109 - </div>  
110 - <div class="row">  
111 - <div class=" col-xs-6 col-md-4">  
112 - <div class="resource_inline">  
113 - <h4>Material</h4>  
114 - </div>  
115 - <div class="resource_inline">  
116 - <div class="dropdown">  
117 - <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>  
118 - <ul class="dropdown-menu" aria-labelledby="dLabel">  
119 - <li><a href="javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink')">Create a Link</a></li>  
120 - <li>  
121 - <a href="#">  
122 - {% trans "Create a file" %}  
123 - <div class="ripple-container">  
124 - <div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);">  
125 - </div>  
126 - </div>  
127 - </a>  
128 - </li>  
129 - </ul>  
130 - </div>  
131 - </div>  
132 - <ul id="list-materials-edit">  
133 - {% list_topic_link_edit request topic%}  
134 - {% list_topic_file_edit request topic %}  
135 - </ul> 115 + <div class="editation" style="display: none">
  116 + <div class="form-group">
  117 + <label class="control-label" for="focusedInput2">Name Topic</label>
  118 + <input type="text" class="form-control" value="Topic 1">
136 </div> 119 </div>
137 - <div class="col-xs-4 col-md-offset-1 col-md-4">  
138 - <div class="resource_inline">  
139 - <h4>Activities</h4>  
140 - </div>  
141 - <div class="resource_inline">  
142 - <div class="dropdown">  
143 - <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>  
144 - <ul class="dropdown-menu" aria-labelledby="dLabel">  
145 - <li>Qualquer coisa</li>  
146 - </ul> 120 + <div class="form-group is-empty">
  121 + <label class="control-label" for="focusedInput2">Description</label>
  122 + <textarea class="form-control" rows="3" id="textArea"></textarea>
  123 + </div>
  124 + <div class="row">
  125 + <div class=" col-xs-6 col-md-4">
  126 + <div class="resource_inline">
  127 + <h4>Material</h4>
147 </div> 128 </div>
  129 + <div class="resource_inline">
  130 + <div class="dropdown">
  131 + <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>
  132 + <ul class="dropdown-menu" aria-labelledby="dLabel">
  133 + <li><a href="javascript:get_modal_link('{% url 'course:links:create_link' topic.slug %}', '#createLinksModal','#divModalLink')">Create a Link</a></li>
  134 + <li>
  135 + <a href="#">
  136 + {% trans "Create a file" %}
  137 + <div class="ripple-container">
  138 + <div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);">
  139 + </div>
  140 + </div>
  141 + </a>
  142 + </li>
  143 + </ul>
  144 + </div>
  145 + </div>
  146 + <ul id="list-materials-edit">
  147 + {% list_topic_link_edit request topic%}
  148 + {% list_topic_file_edit request topic %}
  149 + </ul>
148 </div> 150 </div>
149 - <ul>  
150 - <li class="icon_edit_remove"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i> <i class="fa fa-trash fa-lg" aria-hidden="true"></i></li>  
151 -  
152 - <li class="icon_edit_remove"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i> <i class="fa fa-trash fa-lg" aria-hidden="true"></i></li> 151 + <div class="col-xs-4 col-md-offset-1 col-md-4">
  152 + <div class="resource_inline">
  153 + <h4>Activities</h4>
  154 + </div>
  155 + <div class="resource_inline">
  156 + <div class="dropdown">
  157 + <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>
  158 + <ul class="dropdown-menu" aria-labelledby="dLabel">
  159 + <li>Qualquer coisa</li>
  160 + </ul>
  161 + </div>
  162 + </div>
  163 + <ul>
  164 + <li class="icon_edit_remove"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i> <i class="fa fa-trash fa-lg" aria-hidden="true"></i></li>
153 165
154 - </ul> 166 + <li class="icon_edit_remove"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i> <i class="fa fa-trash fa-lg" aria-hidden="true"></i></li>
  167 +
  168 + </ul>
  169 + </div>
155 </div> 170 </div>
156 - </div>  
157 - <div class="form-group">  
158 - <div class="col-md-10">  
159 - <button type="button" class="btn btn-raised btn-default edit_card_end">Cancel</button>  
160 - <button type="submit" class="btn btn-raised btn-primary edit_card_end">Submit</button> 171 + <div class="form-group">
  172 + <div class="col-md-10">
  173 + <button type="button" class="btn btn-raised btn-default edit_card_end">Cancel</button>
  174 + <button type="submit" class="btn btn-raised btn-primary edit_card_end">Submit</button>
  175 + </div>
161 </div> 176 </div>
162 </div> 177 </div>
163 </div> 178 </div>
164 </div> 179 </div>
165 - </div>  
166 -  
167 </div> 180 </div>
  181 + {% professor_subject topic.subject user as professor_links %}
  182 + {% if professor_links%}
  183 + {% include "links/create_link.html" %}
  184 + {% include "links/delete_link.html" %}
  185 + {% endif %}
  186 + </div>
  187 +</div>
  188 +</div>
  189 +
  190 +<!-- MODALs -->
  191 +
  192 +
168 <!-- MODAL REMOVE TOPIC --> 193 <!-- MODAL REMOVE TOPIC -->
169 <div class="modal" id="removeTopic"> 194 <div class="modal" id="removeTopic">
170 <div class="modal-dialog"> 195 <div class="modal-dialog">
@@ -174,22 +199,17 @@ @@ -174,22 +199,17 @@
174 <h4 class="modal-title"></h4> 199 <h4 class="modal-title"></h4>
175 </div> 200 </div>
176 <div class="modal-body"> 201 <div class="modal-body">
177 - <p>Delete your Topic?</p> 202 + <p>{% trans 'Delete your Topic?' %}</p>
178 </div> 203 </div>
179 <div class="modal-footer"> 204 <div class="modal-footer">
180 205
181 - <a href="" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a> 206 + <a href="" target="_self"><button type="button" class="btn btn-primary">{% trans 'Confirm' %}</button></a>
182 207
183 </div> 208 </div>
184 </div> 209 </div>
185 </div> 210 </div>
186 </div> 211 </div>
187 <!-- END --> 212 <!-- END -->
188 - {% professor_subject topic.subject user as professor_links %}  
189 - {% if professor_links%}  
190 - {% include "links/create_link.html" %}  
191 - {% include "links/delete_link.html" %}  
192 - {% endif %}  
193 213
194 <!-- MODAL EMBEED--> 214 <!-- MODAL EMBEED-->
195 <div class="modal fade" id="embedModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> 215 <div class="modal fade" id="embedModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
@@ -197,32 +217,32 @@ @@ -197,32 +217,32 @@
197 <div class="modal-content"> 217 <div class="modal-content">
198 <div class="modal-header"> 218 <div class="modal-header">
199 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> 219 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
200 - <h4 class="modal-title" id="myModalLabel">Material EMBED</h4> 220 + <h4 class="modal-title" id="myModalLabel">{% trans 'Material EMBED' %}</h4>
201 </div> 221 </div>
202 <div class="modal-body"> 222 <div class="modal-body">
203 <div class="form-group is-empty"> 223 <div class="form-group is-empty">
204 - <label for="inputEmail" class="col-md-2 control-label">Name:</label> 224 + <label for="inputEmail" class="col-md-2 control-label">{% trans 'Name' %}:</label>
205 <div class="col-md-10"> 225 <div class="col-md-10">
206 <input type="text" class="form-control" id="inputEmail" placeholder="Name"> 226 <input type="text" class="form-control" id="inputEmail" placeholder="Name">
207 </div> 227 </div>
208 </div> 228 </div>
209 <form class="form-horizontal"> 229 <form class="form-horizontal">
210 <div class="form-group is-empty"> 230 <div class="form-group is-empty">
211 - <label for="textArea" class="col-md-2 control-label">Code:</label> 231 + <label for="textArea" class="col-md-2 control-label">{% trans 'Code' %}:</label>
212 232
213 <div class="col-md-10"> 233 <div class="col-md-10">
214 <textarea class="form-control" rows="2" id="textArea"></textarea> 234 <textarea class="form-control" rows="2" id="textArea"></textarea>
215 - <span class="help-block">Material description</span> 235 + <span class="help-block">{% trans 'Material description' %}</span>
216 </div> 236 </div>
217 </div> 237 </div>
218 <div class="form-group is-empty"> 238 <div class="form-group is-empty">
219 - <label for="number" class="col-md-2 control-label">Height</label> 239 + <label for="number" class="col-md-2 control-label">{% trans 'Height' %}</label>
220 <div class="col-md-4"> 240 <div class="col-md-4">
221 <input type="number" class="form-control" id="inputNumber" placeholder="Heiht"> 241 <input type="number" class="form-control" id="inputNumber" placeholder="Heiht">
222 </div> 242 </div>
223 </div> 243 </div>
224 <div class="form-group is-empty"> 244 <div class="form-group is-empty">
225 - <label for="number" class="col-md-2 control-label">Weight</label> 245 + <label for="number" class="col-md-2 control-label">{% trans 'Weight' %}</label>
226 <div class="col-md-4"> 246 <div class="col-md-4">
227 <input type="number" class="form-control" id="inputNumber" placeholder="Weight"> 247 <input type="number" class="form-control" id="inputNumber" placeholder="Weight">
228 </div> 248 </div>
@@ -235,7 +255,7 @@ @@ -235,7 +255,7 @@
235 <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">Close</button>--> 255 <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">Close</button>-->
236 256
237 <!-- Put curtom buttons here!!! --> 257 <!-- Put curtom buttons here!!! -->
238 - <button type="button" class="btn btn-primary btn-raised">Confirm</button> 258 + <button type="button" class="btn btn-primary btn-raised">{% trans 'Confirm' %}</button>
239 </div> 259 </div>
240 </div> 260 </div>
241 </div> 261 </div>
@@ -254,27 +274,27 @@ @@ -254,27 +274,27 @@
254 <form class="form-horizontal"> 274 <form class="form-horizontal">
255 275
256 <fieldset> 276 <fieldset>
257 - <legend>Atividade Proposta</legend> 277 + <legend>{% trans 'Atividade Proposta' %}</legend>
258 <div class="form-group is-empty"> 278 <div class="form-group is-empty">
259 - <label for="NameIn" class="col-md-2 control-label">Name:</label> 279 + <label for="NameIn" class="col-md-2 control-label">{% trans 'Name' %}:</label>
260 <div class="col-md-10"> 280 <div class="col-md-10">
261 <input type="text" id="NameIn" class="form-control"> 281 <input type="text" id="NameIn" class="form-control">
262 </div> 282 </div>
263 </div> 283 </div>
264 <div class="form-group is-empty"> 284 <div class="form-group is-empty">
265 - <label for="DescIn" class="col-md-2 control-label">Describe:</label> 285 + <label for="DescIn" class="col-md-2 control-label">{% trans 'Describe' %}:</label>
266 <div class="col-md-10"> 286 <div class="col-md-10">
267 <textarea class="form-control" id="DescIn" rows="2"></textarea> 287 <textarea class="form-control" id="DescIn" rows="2"></textarea>
268 </div> 288 </div>
269 </div> 289 </div>
270 <div class="form-group is-empty"> 290 <div class="form-group is-empty">
271 - <label for="DateIn" class="col-md-2 control-label">Opening: </label> 291 + <label for="DateIn" class="col-md-2 control-label">{% trans 'Opening' %}: </label>
272 <div class="col-md-10"> 292 <div class="col-md-10">
273 <input type="text" id="DateIn" class="form-control date-picker" requerid=""> 293 <input type="text" id="DateIn" class="form-control date-picker" requerid="">
274 </div> 294 </div>
275 </div> 295 </div>
276 <div class="form-group is-empty"> 296 <div class="form-group is-empty">
277 - <label for="DateIn" class="col-md-2 control-label">Ending: </label> 297 + <label for="DateIn" class="col-md-2 control-label">{% trans 'Ending' %}: </label>
278 <div class="col-md-10"> 298 <div class="col-md-10">
279 <input type="text" id="DateIn" class="form-control date-picker" requerid=""> 299 <input type="text" id="DateIn" class="form-control date-picker" requerid="">
280 </div> 300 </div>
@@ -283,15 +303,15 @@ @@ -283,15 +303,15 @@
283 <div class="col-md-offset-2 col-md-10"> 303 <div class="col-md-offset-2 col-md-10">
284 <div class="checkbox"> 304 <div class="checkbox">
285 <label> 305 <label>
286 - <input type="checkbox"><span class="checkbox-material"><span class="check"></span></span> Send Later 306 + <input type="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans 'Send Later' %}
287 </label> 307 </label>
288 </div> 308 </div>
289 </div> 309 </div>
290 </div> 310 </div>
291 <div class="form-group"> 311 <div class="form-group">
292 <div class="col-md-10 col-md-offset-2"> 312 <div class="col-md-10 col-md-offset-2">
293 - <button type="button" class="btn btn-default">Cancel</button>  
294 - <button type="submit" class="btn btn-primary">Submit</button> 313 + <button type="button" class="btn btn-default">{% trans 'Cancel' %}</button>
  314 + <button type="submit" class="btn btn-primary">{% trans 'Submit' %}</button>
295 </div> 315 </div>
296 </div> 316 </div>
297 317
@@ -335,3 +355,5 @@ @@ -335,3 +355,5 @@
335 </div> 355 </div>
336 </div> 356 </div>
337 </div> 357 </div>
  358 +
  359 +
courses/templates/subject/index.html
@@ -15,77 +15,95 @@ @@ -15,77 +15,95 @@
15 15
16 </ol> 16 </ol>
17 {% endblock %} 17 {% endblock %}
18 -  
19 {% block sidebar %} 18 {% block sidebar %}
20 - <div class="panel panel-primary navigation">  
21 - <div class="panel-heading">  
22 - <h5>{% trans 'Menu' %}</h5>  
23 - </div>  
24 - <div class="panel-body">  
25 - <ul class="nav nav-pills nav-stacked">  
26 - <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>  
27 - <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>  
28 - </ul>  
29 - </div> 19 +<div class="panel panel-primary">
  20 + <div class="panel-heading">
  21 + <h4>Menu</h4>
  22 + </div>
  23 + <div class="panel-body">
  24 + <ul class="nav nav-pills nav-stacked">
  25 + <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li>
  26 + <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
  27 + {% if user|has_role:'student' or not user.is_staff %}
  28 + <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
  29 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
  30 + {% endif %}
  31 + {% if user|has_role:'system_admin' %}
  32 + <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
  33 + {% endif %}
  34 + {% if user|has_role:'system_admin' or user|has_role:'professor' %}
  35 + <li>
  36 + <a href="#courses_list" class="accordion" data-toggle="collapse">{% trans 'Manage Courses' %}</a>
  37 + <div id="courses_list" class="collapse">
  38 + <ul class="nav nav-pill nav-stacked accordion_list">
  39 + {% for course in courses_list %}
  40 + <li><a href="{% url 'course:view' course.slug %}">{{ course }}</a></li>
  41 + {% endfor %}
  42 + </ul>
  43 + </div>
  44 + </li>
  45 + {% endif %}
  46 + </ul>
30 </div> 47 </div>
  48 +</div>
31 49
32 50
33 {% endblock %} 51 {% endblock %}
34 52
35 {% block content %} 53 {% block content %}
36 <div class="panel panel-info"> 54 <div class="panel panel-info">
37 - <div class="panel-heading">  
38 - <div class="row">  
39 - <div class="col-md-10 col-sm-10">  
40 - <h3>{{subject}}</h3>  
41 - </div>  
42 - {% professor_subject subject user as subject_professor%}  
43 - {% if subject_professor %}  
44 - <div class="col-xs-4 col-md-2 divMoreActions">  
45 - <div class="btn-group">  
46 - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">  
47 - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>  
48 - </button>  
49 - <ul class="dropdown-menu pull-right" aria-labelledby="moreActions">  
50 - <li><a href="javascript:void(0)"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Replicate" %}</a></li>  
51 - <li><a href="{% url 'course:update_subject' subject.slug %}" <i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Edit" %}</a></li>  
52 - <li><a href="{% url 'course:delete_subject' subject.slug %}" ><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Remove" %}</a></li>  
53 - </ul>  
54 - </div>  
55 - </div>  
56 - {% endif %}  
57 - </div>  
58 - </div>  
59 - <div class="panel-body">  
60 - <p><b>{% trans "Professor" %}:</b> {{subject.professors}}</p>  
61 - <p>  
62 - <b>{% trans "Description" %}:</b>  
63 - {{subject.description|linebreaks}}  
64 - </p>  
65 - <div class="row">  
66 - <div class="col-xs-6 col-md-6">  
67 - <p><b>{% trans "Beginning" %}:</b> {{subject.init_date}}</p>  
68 - </div>  
69 - <div class="col-xs-6 col-md-6">  
70 - <p><b>{% trans "End" %}:</b> {{subject.end_date}}</p>  
71 - </div>  
72 - </div>  
73 - </div>  
74 - </div>  
75 -  
76 - {% for topic in topics %}  
77 - {% professor_subject topic.subject user as topic_professor%}  
78 - {% if topic_professor %}  
79 - {% include "subject/form_view_teacher.html" %}  
80 - {% else %}  
81 - {% include "subject/form_view_student.html" %}  
82 - {% endif %}  
83 - {% endfor %}  
84 - {% professor_subject subject user as professor_sub %}  
85 - {% if professor_sub %}  
86 - <div class="form-group">  
87 - <a href="{% url 'course:create_topic' subject.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised" name="create_topic">{% trans "Create Topic" %}<div class="ripple-container"></div></a> 55 + <div class="panel-heading course-detail">
  56 + <div class="row">
  57 + <div class="col-md-10 col-sm-10">
  58 + <h4>{{subject}}</h4>
  59 + </div>
  60 + <div class="col-xs-4 col-md-2 divMoreActions">
  61 + {% professor_subject subject user as subject_professor%}
  62 + {% if subject_professor %}
  63 + <div class="btn-group">
  64 + <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  65 + <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
  66 + </button>
  67 + <ul class="dropdown-menu pull-right" aria-labelledby="moreActions">
  68 + <li><a href="javascript:void(0)"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Replicate" %}</a></li>
  69 + <li><a href="{% url 'course:update_subject' subject.slug %}" <i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Edit" %}</a></li>
  70 + <li><a href="{% url 'course:delete_subject' subject.slug %}" ><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Remove" %}</a></li>
  71 + </ul>
  72 + </div>
  73 + {% endif %}
  74 + </div>
  75 + </div>
  76 + </div>
  77 + <div class="panel-body">
  78 + <p><b>{% trans "Professor" %}:</b> {{subject.professors}}</p>
  79 + <p>
  80 + <b>{% trans "Description" %}:</b>
  81 + {{subject.description|linebreaks}}
  82 + </p>
  83 + <div class="row">
  84 + <div class="col-xs-6 col-md-6">
  85 + <p><b>{% trans "Beginning" %}:</b> {{subject.init_date}}</p>
  86 + </div>
  87 + <div class="col-xs-6 col-md-6">
  88 + <p><b>{% trans "End" %}:</b> {{subject.end_date}}</p>
  89 + </div>
88 </div> 90 </div>
89 - {% endif %}  
90 - 91 + </div>
  92 + </div>
  93 + {% for topic in topics %}
  94 + {% professor_subject topic.subject user as topic_professor%}
  95 + {% if topic_professor %}
  96 + {% include "subject/form_view_teacher.html" %}
  97 + {% else %}
  98 + {% include "subject/form_view_student.html" %}
  99 + {% endif %}
  100 + {% endfor %}
  101 + {% professor_subject subject user as professor_sub %}
  102 + {% if professor_sub %}
  103 + <div class="col-md-10">
  104 + <div class="form-group">
  105 + <a href="{% url 'course:create_topic' subject.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised" name="create_topic">{% trans "Create Topic" %}<div class="ripple-container"></div></a>
  106 + </div>
  107 + </div>
  108 + {% endif %}
91 {% endblock %} 109 {% endblock %}
courses/templates/subject/poll_item_actions.html
@@ -6,9 +6,9 @@ @@ -6,9 +6,9 @@
6 {% for poll in polls %} 6 {% for poll in polls %}
7 {% professor_subject poll.topic.subject request.user as permission%} 7 {% professor_subject poll.topic.subject request.user as permission%}
8 {% if permission %} 8 {% if permission %}
9 - <li id="poll_{{poll.slug}}"><i class="material-icons">poll</i> <a href="javascript:modal.get('{% url 'course:poll:update_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a><a href="javascript:modal.get('{% url 'course:poll:delete_poll' poll.slug %}','#poll','#modal_poll');"><span class="glyphicon glyphicon-remove"></span></a></li> 9 + <li id="poll_{{poll.slug}}"><i class="material-icons">{% trans 'poll' %}</i> <a href="javascript:modal.get('{% url 'course:poll:update_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a><a href="javascript:modal.get('{% url 'course:poll:delete_poll' poll.slug %}','#poll','#modal_poll');"><span class="glyphicon glyphicon-remove"></span></a></li>
10 {% else %} 10 {% else %}
11 - <li id="poll_{{poll.slug}}"><i class="material-icons">poll</i> <a href="javascript:modal.get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a></li> 11 + <li id="poll_{{poll.slug}}"><i class="material-icons">{% trans 'poll' %}</i> <a href="javascript:modal.get('{% url 'course:poll:view_poll' poll.slug %}','#poll','#modal_poll');">{{ poll.name }}</a></li>
12 {% endif %} 12 {% endif %}
13 {% endfor %} 13 {% endfor %}
14 {# <button class="btn btn-primary btn-raised" onclick="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans '+ Create Poll' %}</button> #} 14 {# <button class="btn btn-primary btn-raised" onclick="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans '+ Create Poll' %}</button> #}
courses/templates/topic/index.html
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 19
20 {% block sidebar %} 20 {% block sidebar %}
21 21
22 - <div class="panel panel-primary navigation"> 22 + <div class="panel panel-primary">
23 <div class="panel-heading"> 23 <div class="panel-heading">
24 <h5>{% trans 'Menu' %}</h5> 24 <h5>{% trans 'Menu' %}</h5>
25 </div> 25 </div>
@@ -32,22 +32,22 @@ @@ -32,22 +32,22 @@
32 </div> 32 </div>
33 33
34 {% if user|has_role:'professor' %} 34 {% if user|has_role:'professor' %}
35 - <div class="panel panel-primary navigation"> 35 + <div class="panel panel-primary ">
36 <div class="panel-heading"> 36 <div class="panel-heading">
37 - <h3 class="panel-title">Actions</h3> 37 + <h3 class="panel-title">{% trans 'Actions' %}</h3>
38 </div> 38 </div>
39 <div class="panel-body"> 39 <div class="panel-body">
40 <ul class="nav nav-pills nav-stacked"> 40 <ul class="nav nav-pills nav-stacked">
41 - <li><a href="javascript:void(0)">Participants</a></li>  
42 - <li><a href="javascript:void(0)">Replicate subject</a></li>  
43 - <li><a href="javascript:void(0)">Create subject</a></li>  
44 - <li><a href="javascript:void(0)">Edit subject</a></li>  
45 - <li><a href="javascript:void(0)">Remove subject</a></li> 41 + <li><a href="javascript:void(0)">{% trans 'Participants' %}</a></li>
  42 + <li><a href="javascript:void(0)">{% trans 'Replicate subject' %}</a></li>
  43 + <li><a href="javascript:void(0)">{% trans 'Create subject' %}</a></li>
  44 + <li><a href="javascript:void(0)">{% trans 'Edit subject' %}</a></li>
  45 + <li><a href="javascript:void(0)">{% trans 'Remove subject' %}</a></li>
46 </ul> 46 </ul>
47 </div> 47 </div>
48 </div> 48 </div>
49 {% endif %} 49 {% endif %}
50 - 50 +
51 {% endblock %} 51 {% endblock %}
52 52
53 {% block content %} 53 {% block content %}
@@ -109,12 +109,12 @@ @@ -109,12 +109,12 @@
109 <div class="panel-body"> 109 <div class="panel-body">
110 <div class="row"> 110 <div class="row">
111 <div class="col-md-4"> 111 <div class="col-md-4">
112 - <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i> 112 + <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">{% trans 'Atividade.doc' %}</i>
113 </div> 113 </div>
114 {% professor_subject subject user as permi_test%} 114 {% professor_subject subject user as permi_test%}
115 {% if permi_test %} 115 {% if permi_test %}
116 <div class="col-md-4"> 116 <div class="col-md-4">
117 - <label> Nota:</label> 117 + <label> {% trans 'Nota' %}:</label>
118 <input type="number" step="0.01"> 118 <input type="number" step="0.01">
119 </div> 119 </div>
120 {% else %} 120 {% else %}
@@ -124,7 +124,7 @@ @@ -124,7 +124,7 @@
124 <div class="form-group {% if form.pdf.errors %} has-error {% endif %}"> 124 <div class="form-group {% if form.pdf.errors %} has-error {% endif %}">
125 {{ form.as_p }} 125 {{ form.as_p }}
126 </div> 126 </div>
127 - <button type="submit" class="btn btn-success" id="send_button">Enviar</button> 127 + <button type="submit" class="btn btn-success" id="send_button">{% trans 'Enviar' %}</button>
128 </div> 128 </div>
129 {% endif %} 129 {% endif %}
130 </div> 130 </div>
courses/templatetags/custom_filters.py
@@ -4,6 +4,19 @@ from rolepermissions.verifications import has_role @@ -4,6 +4,19 @@ from rolepermissions.verifications import has_role
4 register = template.Library() 4 register = template.Library()
5 5
6 @register.filter 6 @register.filter
  7 +def hide_subscribe_view_btn(user, subject):
  8 + if not user is None:
  9 + if user.is_authenticated:
  10 + if has_role(user, 'student') and not user.is_staff:
  11 + if user in subject.course.students.all():
  12 + if not user in subject.students.all():
  13 + return True
  14 + else:
  15 + return True
  16 +
  17 + return False
  18 +
  19 +@register.filter
7 def show_subject_subscribe(user, subject): 20 def show_subject_subscribe(user, subject):
8 if not user is None: 21 if not user is None:
9 if user.is_authenticated: 22 if user.is_authenticated:
courses/views.py
@@ -210,6 +210,7 @@ class CourseView( NotificationMixin, generic.DetailView): @@ -210,6 +210,7 @@ class CourseView( NotificationMixin, generic.DetailView):
210 courses = None 210 courses = None
211 context = super(CourseView, self).get_context_data(**kwargs) 211 context = super(CourseView, self).get_context_data(**kwargs)
212 course = get_object_or_404(Course, slug = self.kwargs.get('slug')) 212 course = get_object_or_404(Course, slug = self.kwargs.get('slug'))
  213 +
213 if has_role(self.request.user,'system_admin'): 214 if has_role(self.request.user,'system_admin'):
214 subjects = course.subjects.all() 215 subjects = course.subjects.all()
215 elif has_role(self.request.user,'professor'): 216 elif has_role(self.request.user,'professor'):
@@ -381,6 +382,14 @@ class SubjectsView(LoginRequiredMixin, generic.ListView): @@ -381,6 +382,14 @@ class SubjectsView(LoginRequiredMixin, generic.ListView):
381 context_object_name = 'subjects' 382 context_object_name = 'subjects'
382 model = Subject 383 model = Subject
383 384
  385 + def dispatch(self, *args, **kwargs):
  386 + subject = get_object_or_404(Subject, slug = self.kwargs.get('slug'))
  387 +
  388 + if(not has_object_permission('view_subject', self.request.user, subject)):
  389 + return self.handle_no_permission()
  390 +
  391 + return super(SubjectsView, self).dispatch(*args, **kwargs)
  392 +
384 def get_queryset(self): 393 def get_queryset(self):
385 subject = get_object_or_404(Subject, slug = self.kwargs.get('slug')) 394 subject = get_object_or_404(Subject, slug = self.kwargs.get('slug'))
386 course = subject.course 395 course = subject.course
@@ -428,6 +437,14 @@ class TopicsView(LoginRequiredMixin, generic.ListView): @@ -428,6 +437,14 @@ class TopicsView(LoginRequiredMixin, generic.ListView):
428 context_object_name = 'topics' 437 context_object_name = 'topics'
429 model = Topic 438 model = Topic
430 439
  440 + def dispatch(self, *args, **kwargs):
  441 + topic = get_object_or_404(Topic, slug = self.kwargs.get('slug'))
  442 +
  443 + if(not has_object_permission('view_topic', self.request.user, topic)):
  444 + return self.handle_no_permission()
  445 +
  446 + return super(TopicsView, self).dispatch(*args, **kwargs)
  447 +
431 def get_queryset(self): 448 def get_queryset(self):
432 topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) 449 topic = get_object_or_404(Topic, slug = self.kwargs.get('slug'))
433 subject = topic.subject 450 subject = topic.subject
exam/templates/exam/gap_filling_question.html
1 <div class="form-group" id="gapFilling" style="display: none;"> 1 <div class="form-group" id="gapFilling" style="display: none;">
2 - <p>Gap Filling Question</p> 2 + <p>{% trans 'Gap Filling Question' %}</p>
3 </div> 3 </div>
exam/templates/exam/multiple_choice_question.html
1 <div class="form-group" id="multipleChoice"> 1 <div class="form-group" id="multipleChoice">
2 2
3 - <label for="questionName" class="col-md-2 control-label">Question</label> 3 + <label for="questionName" class="col-md-2 control-label">{% trans 'Question' %}</label>
4 4
5 5
6 <div class="col-md-10"> 6 <div class="col-md-10">
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 10
11 </div> 11 </div>
12 <div class="form-group"> 12 <div class="form-group">
13 - <label for="alternative" class="col-md-2 control-label">Alternatives</label> 13 + <label for="alternative" class="col-md-2 control-label">{% trans 'Alternatives' %}</label>
14 <div class="col-md-10" id="radios"> 14 <div class="col-md-10" id="radios">
15 <div class="radio radio-primary"> 15 <div class="radio radio-primary">
16 <label> 16 <label>
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 <!-- new alternative button --> 29 <!-- new alternative button -->
30 <div class="form-group"> 30 <div class="form-group">
31 <div class="col-md-12 col-md-offset-2"> 31 <div class="col-md-12 col-md-offset-2">
32 - <button type="button" class="btn btn-primary" id="newAlternative">New Alternative</button> 32 + <button type="button" class="btn btn-primary" id="newAlternative">{% trans 'New Alternative' %]</button>
33 </div> 33 </div>
34 </div> 34 </div>
35 <div class="form-group"> 35 <div class="form-group">
files/templates/files/create_file.html
@@ -65,14 +65,14 @@ @@ -65,14 +65,14 @@
65 65
66 <div class="form-group"> 66 <div class="form-group">
67 <div class="col-md-12 text-center"> 67 <div class="col-md-12 text-center">
68 - <p><b>The file size shouldn't exceed 10MB</b></p> 68 + <p><b>{% trans 'The file size shouldnt exceed 10MB' %}</b></p>
69 </div> 69 </div>
70 </div> 70 </div>
71 71
72 <div class="form-group"> 72 <div class="form-group">
73 <div class="col-md-12"> 73 <div class="col-md-12">
74 <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button> 74 <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
75 - <button class="btn btn-raised btn-primary" type="submit">Submit</button> 75 + <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %}</button>
76 </div> 76 </div>
77 </div> 77 </div>
78 </fieldset> 78 </fieldset>
files/templates/files/delete_file.html
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 <div class="form-group"> 32 <div class="form-group">
33 <div class="col-md-12"> 33 <div class="col-md-12">
34 <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button> 34 <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
35 - <button class="btn btn-raised btn-primary" type="submit">Delete</button> 35 + <button class="btn btn-raised btn-primary" type="submit">{% trans 'Delete' %}</button>
36 </div> 36 </div>
37 </div> 37 </div>
38 </fieldset> 38 </fieldset>
files/templates/files/update_file.html
@@ -70,14 +70,14 @@ @@ -70,14 +70,14 @@
70 70
71 <div class="form-group"> 71 <div class="form-group">
72 <div class="col-md-12 text-center"> 72 <div class="col-md-12 text-center">
73 - <p><b>The file size shouldn't exceed 10MB</b></p> 73 + <p><b>{% trans 'The file size shouldnt exceed 10MB' %}</b></p>
74 </div> 74 </div>
75 </div> 75 </div>
76 76
77 <div class="form-group"> 77 <div class="form-group">
78 <div class="col-md-12"> 78 <div class="col-md-12">
79 <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button> 79 <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">{% trans "Close" %}</button>
80 - <button class="btn btn-raised btn-primary" type="submit">Submit</button> 80 + <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %}</button>
81 </div> 81 </div>
82 </div> 82 </div>
83 </fieldset> 83 </fieldset>
forum/permissions.py 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +from rolepermissions.permissions import register_object_checker
  2 +from amadeus.roles import SystemAdmin
  3 +
  4 +@register_object_checker()
  5 +def view_forum(role, user, forum):
  6 + if (role == SystemAdmin):
  7 + return True
  8 +
  9 + if (user in forum.topic.subject.professors.all() or user in forum.topic.subject.students.all()):
  10 + return True
  11 +
  12 + return False
  13 +
  14 +@register_object_checker()
  15 +def edit_forum(role, user, forum):
  16 + if (role == SystemAdmin):
  17 + return True
  18 +
  19 + if (user in forum.topic.subject.professors.all()):
  20 + return True
  21 +
  22 + return False
  23 +
  24 +@register_object_checker()
  25 +def delete_forum(role, user, forum):
  26 + if (role == SystemAdmin):
  27 + return True
  28 +
  29 + if (user in forum.topic.subject.professors.all()):
  30 + return True
  31 +
  32 + return False
forum/static/js/forum.js
@@ -70,10 +70,9 @@ function setForumCreateFormSubmit() { @@ -70,10 +70,9 @@ function setForumCreateFormSubmit() {
70 type: frm.attr('method'), 70 type: frm.attr('method'),
71 url: frm.attr('action'), 71 url: frm.attr('action'),
72 data: frm.serialize(), 72 data: frm.serialize(),
  73 + dataType: "json",
73 success: function (data) { 74 success: function (data) {
74 - data = data.split('-');  
75 -  
76 - $('.foruns_list').append("<li><i class='fa fa-commenting' aria-hidden='true'></i> <a id='forum_"+data[1]+"' href='"+data[0]+"'> "+data[2]+"</a></li>"); 75 + $('.foruns_list').append("<li><i class='fa fa-commenting' aria-hidden='true'></i> <a id='forum_"+data.forum_id+"' href='"+data.url+"'> "+data.name+"</a></li>");
77 76
78 $("#createForum").modal('hide'); 77 $("#createForum").modal('hide');
79 }, 78 },
forum/templates/forum/forum_list.html
@@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
56 {% endif %} 56 {% endif %}
57 <span class="input-group-btn"> 57 <span class="input-group-btn">
58 <button type="submit" class="btn btn-fab btn-fab-mini"> 58 <button type="submit" class="btn btn-fab btn-fab-mini">
59 - <i class="material-icons">send</i> 59 + <i class="material-icons">{% trans 'send' %}</i>
60 </button> 60 </button>
61 </span> 61 </span>
62 </div> 62 </div>
forum/templates/forum/forum_view.html
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 </div> 34 </div>
35 </div> 35 </div>
36 36
37 - {% if request.user|has_role:'system_admin' or request.user|has_role:'professor' and request.user == post.user %} 37 + {% if request.user|has_role:'system_admin' or request.user|has_role:'professor' and request.user in forum.topic.subject.professors.all %}
38 <div class="panel panel-primary navigation"> 38 <div class="panel panel-primary navigation">
39 <div class="panel-heading"> 39 <div class="panel-heading">
40 <h3 class="panel-title">{% trans 'Actions' %}</h3> 40 <h3 class="panel-title">{% trans 'Actions' %}</h3>
@@ -88,7 +88,7 @@ @@ -88,7 +88,7 @@
88 {% endif %} 88 {% endif %}
89 <span class="input-group-btn"> 89 <span class="input-group-btn">
90 <button type="submit" class="btn btn-fab btn-fab-mini"> 90 <button type="submit" class="btn btn-fab btn-fab-mini">
91 - <i class="material-icons">send</i> 91 + <i class="material-icons">{% trans 'send' %}</i>
92 </button> 92 </button>
93 </span> 93 </span>
94 </div> 94 </div>
forum/templates/post/post_list.html
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 {{ post.user }} 8 {{ post.user }}
9 <div class="pull-right"> 9 <div class="pull-right">
10 <a href="javascript:answer('{{ post.id }}', '{% url 'course:forum:reply_post' %}');"> 10 <a href="javascript:answer('{{ post.id }}', '{% url 'course:forum:reply_post' %}');">
11 - <i class="material-icons">reply</i> 11 + <i class="material-icons">{% trans 'reply' %}</i>
12 </a> 12 </a>
13 {% if request.user|has_role:'system_admin' or request.user == post.user %} 13 {% if request.user|has_role:'system_admin' or request.user == post.user %}
14 {% csrf_token %} 14 {% csrf_token %}
forum/templates/post/post_load_more_render.html
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 {{ post.user }} 8 {{ post.user }}
9 <div class="pull-right"> 9 <div class="pull-right">
10 <a href="javascript:answer('{{ post.id }}', '{% url 'course:forum:reply_post' %}');"> 10 <a href="javascript:answer('{{ post.id }}', '{% url 'course:forum:reply_post' %}');">
11 - <i class="material-icons">reply</i> 11 + <i class="material-icons">{% trans 'reply' %}</i>
12 </a> 12 </a>
13 {% if request.user|has_role:'system_admin' or request.user == post.user %} 13 {% if request.user|has_role:'system_admin' or request.user == post.user %}
14 {% csrf_token %} 14 {% csrf_token %}
forum/templates/post/post_render.html
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 {{ post.user }} 6 {{ post.user }}
7 <div class="pull-right"> 7 <div class="pull-right">
8 <a href="javascript:answer('{{ post.id }}', '{% url 'course:forum:reply_post' %}');"> 8 <a href="javascript:answer('{{ post.id }}', '{% url 'course:forum:reply_post' %}');">
9 - <i class="material-icons">reply</i> 9 + <i class="material-icons">{% trans 'reply' %}</i>
10 </a> 10 </a>
11 {% if request.user|has_role:'system_admin' or request.user|has_role:'professor' and request.user == post.user %} 11 {% if request.user|has_role:'system_admin' or request.user|has_role:'professor' and request.user == post.user %}
12 {% csrf_token %} 12 {% csrf_token %}
forum/templates/post_answers/post_answer_form.html
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 {% else %} 35 {% else %}
36 <span class="input-group-btn"> 36 <span class="input-group-btn">
37 <button type="submit" class="btn btn-fab btn-fab-mini"> 37 <button type="submit" class="btn btn-fab btn-fab-mini">
38 - <i class="material-icons">send</i> 38 + <i class="material-icons">{% trans 'send' %}</i>
39 </button> 39 </button>
40 </span> 40 </span>
41 {% endif %} 41 {% endif %}
forum/views.py
@@ -9,6 +9,9 @@ from django.http import Http404, JsonResponse @@ -9,6 +9,9 @@ from django.http import Http404, JsonResponse
9 from django.urls import reverse 9 from django.urls import reverse
10 from django.template.loader import render_to_string 10 from django.template.loader import render_to_string
11 11
  12 +from rolepermissions.mixins import HasRoleMixin
  13 +from rolepermissions.verifications import has_object_permission
  14 +
12 from .models import Forum, Post, PostAnswer 15 from .models import Forum, Post, PostAnswer
13 from courses.models import Topic 16 from courses.models import Topic
14 from core.models import Action, Resource 17 from core.models import Action, Resource
@@ -41,7 +44,9 @@ class ForumIndex(LoginRequiredMixin, generic.ListView): @@ -41,7 +44,9 @@ class ForumIndex(LoginRequiredMixin, generic.ListView):
41 44
42 return context 45 return context
43 46
44 -class CreateForumView(LoginRequiredMixin, generic.edit.CreateView, NotificationMixin): 47 +class CreateForumView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView, NotificationMixin):
  48 + allowed_roles = ['professor', 'system_admin']
  49 +
45 login_url = reverse_lazy("core:home") 50 login_url = reverse_lazy("core:home")
46 redirect_field_name = 'next' 51 redirect_field_name = 'next'
47 52
@@ -67,9 +72,11 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView, NotificationM @@ -67,9 +72,11 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView, NotificationM
67 def render_forum(request, forum): 72 def render_forum(request, forum):
68 last_forum = get_object_or_404(Forum, id = forum) 73 last_forum = get_object_or_404(Forum, id = forum)
69 74
70 - return HttpResponse(str(reverse_lazy('course:forum:view', args = (), kwargs = {'slug': last_forum.slug})) + '-' + str(forum) + '-' + str(last_forum.name)) 75 + return JsonResponse({'url': str(reverse_lazy('course:forum:view', args = (), kwargs = {'slug': last_forum.slug})), 'forum_id': str(forum), 'name': str(last_forum.name)})
  76 +
  77 +class UpdateForumView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView):
  78 + allowed_roles = ['professor', 'system_admin']
71 79
72 -class UpdateForumView(LoginRequiredMixin, generic.UpdateView):  
73 login_url = reverse_lazy("core:home") 80 login_url = reverse_lazy("core:home")
74 redirect_field_name = 'next' 81 redirect_field_name = 'next'
75 82
@@ -77,6 +84,14 @@ class UpdateForumView(LoginRequiredMixin, generic.UpdateView): @@ -77,6 +84,14 @@ class UpdateForumView(LoginRequiredMixin, generic.UpdateView):
77 form_class = ForumForm 84 form_class = ForumForm
78 model = Forum 85 model = Forum
79 86
  87 + def dispatch(self, *args, **kwargs):
  88 + forum = get_object_or_404(Forum, id = self.kwargs.get('pk'))
  89 +
  90 + if(not has_object_permission('edit_forum', self.request.user, forum)):
  91 + return self.handle_no_permission()
  92 +
  93 + return super(UpdateForumView, self).dispatch(*args, **kwargs)
  94 +
80 def form_invalid(self, form): 95 def form_invalid(self, form):
81 return self.render_to_response(self.get_context_data(form = form), status = 400) 96 return self.render_to_response(self.get_context_data(form = form), status = 400)
82 97
@@ -93,7 +108,9 @@ def render_edit_forum(request, forum): @@ -93,7 +108,9 @@ def render_edit_forum(request, forum):
93 108
94 return render(request, 'forum/render_forum.html', context) 109 return render(request, 'forum/render_forum.html', context)
95 110
96 -class ForumDeleteView(LoginRequiredMixin, generic.DeleteView): 111 +class ForumDeleteView(LoginRequiredMixin, HasRoleMixin, generic.DeleteView):
  112 + allowed_roles = ['professor', 'system_admin']
  113 +
97 login_url = reverse_lazy("core:home") 114 login_url = reverse_lazy("core:home")
98 redirect_field_name = 'next' 115 redirect_field_name = 'next'
99 116
@@ -101,6 +118,14 @@ class ForumDeleteView(LoginRequiredMixin, generic.DeleteView): @@ -101,6 +118,14 @@ class ForumDeleteView(LoginRequiredMixin, generic.DeleteView):
101 pk_url_kwarg = 'pk' 118 pk_url_kwarg = 'pk'
102 success_url = reverse_lazy('course:forum:deleted_forum') 119 success_url = reverse_lazy('course:forum:deleted_forum')
103 120
  121 + def dispatch(self, *args, **kwargs):
  122 + forum = get_object_or_404(Forum, id = self.kwargs.get('pk'))
  123 +
  124 + if(not has_object_permission('delete_forum', self.request.user, forum)):
  125 + return self.handle_no_permission()
  126 +
  127 + return super(ForumDeleteView, self).dispatch(*args, **kwargs)
  128 +
104 def forum_deleted(request): 129 def forum_deleted(request):
105 return HttpResponse(_("Forum deleted successfully.")) 130 return HttpResponse(_("Forum deleted successfully."))
106 131
@@ -112,6 +137,14 @@ class ForumDetailView(LoginRequiredMixin, generic.DetailView): @@ -112,6 +137,14 @@ class ForumDetailView(LoginRequiredMixin, generic.DetailView):
112 template_name = 'forum/forum_view.html' 137 template_name = 'forum/forum_view.html'
113 context_object_name = 'forum' 138 context_object_name = 'forum'
114 139
  140 + def dispatch(self, *args, **kwargs):
  141 + forum = get_object_or_404(Forum, slug = self.kwargs.get('slug'))
  142 +
  143 + if(not has_object_permission('view_forum', self.request.user, forum)):
  144 + return self.handle_no_permission()
  145 +
  146 + return super(ForumDetailView, self).dispatch(*args, **kwargs)
  147 +
115 def get_context_data(self, **kwargs): 148 def get_context_data(self, **kwargs):
116 context = super(ForumDetailView, self).get_context_data(**kwargs) 149 context = super(ForumDetailView, self).get_context_data(**kwargs)
117 forum = get_object_or_404(Forum, slug = self.kwargs.get('slug')) 150 forum = get_object_or_404(Forum, slug = self.kwargs.get('slug'))
links/templates/links/create_link.html
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <div class="modal-content"> 6 <div class="modal-content">
7 <div class="modal-header"> 7 <div class="modal-header">
8 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> 8 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
9 - <h4 class="modal-title" id="createLink">Create a New Link</h4> 9 + <h4 class="modal-title" id="createLink">{% trans 'Create a New Link' %}</h4>
10 </div> 10 </div>
11 <div class="modal-body"> 11 <div class="modal-body">
12 <!-- Card --> 12 <!-- Card -->
@@ -31,8 +31,8 @@ @@ -31,8 +31,8 @@
31 {% render_field field class='form-control' %} 31 {% render_field field class='form-control' %}
32 {% endfor %} 32 {% endfor %}
33 <div class="form-group"> 33 <div class="form-group">
34 - <a href="javascript:void(0)" class="btn btn-raised btn-default" data-dismiss="modal">Cancel</a>  
35 - <button class="btn btn-raised btn-primary" type="submit">Submit</button> 34 + <a href="javascript:void(0)" class="btn btn-raised btn-default" data-dismiss="modal">{% trans 'Cancel' %}</a>
  35 + <button class="btn btn-raised btn-primary" type="submit">{% trans 'Submit' %]</button>
36 </div> 36 </div>
37 <!-- .end Card --> 37 <!-- .end Card -->
38 </div> 38 </div>
links/templates/links/delete_link.html
  1 +{% load widget_tweaks i18n %}
1 <!-- MODAL REMOVE LINK --> 2 <!-- MODAL REMOVE LINK -->
2 <div class="modal" id="removeLink"> 3 <div class="modal" id="removeLink">
3 <div class="modal-dialog"> 4 <div class="modal-dialog">
@@ -7,12 +8,12 @@ @@ -7,12 +8,12 @@
7 <h4 class="modal-title"></h4> 8 <h4 class="modal-title"></h4>
8 </div> 9 </div>
9 <div class="modal-body"> 10 <div class="modal-body">
10 - <p>Do you really want to delete this link?</p> 11 + <p>{% trans 'Do you really want to delete this link?' %}</p>
11 </div> 12 </div>
12 <div class="modal-footer"> 13 <div class="modal-footer">
13 <!-- --> 14 <!-- -->
14 - <button type="button" class="btn btn-primary btn-default" data-dismiss="modal">Cancel</button>  
15 - <a href="http://www.google.com" target="_self"><button type="button" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Confirm</button></a> 15 + <button type="button" class="btn btn-primary btn-default" data-dismiss="modal">{% trans 'Cancel' %}</button>
  16 + <a href="http://www.google.com" target="_self"><button type="button" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">{% trans 'Confirm' %}</button></a>
16 17
17 </div> 18 </div>
18 </div> 19 </div>
links/templates/links/update_link.html
  1 +{% load widget_tweaks i18n %}
1 <!-- MODAL LINK EDIT--> 2 <!-- MODAL LINK EDIT-->
2 <div class="modal fade" id="linksModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> 3 <div class="modal fade" id="linksModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
3 <div class="modal-dialog" role="document"> 4 <div class="modal-dialog" role="document">
4 <div class="modal-content"> 5 <div class="modal-content">
5 <div class="modal-header"> 6 <div class="modal-header">
6 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> 7 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
7 - <h4 class="modal-title" id="myModalLabel">Links</h4> 8 + <h4 class="modal-title" id="myModalLabel">{% trans 'Links' %}</h4>
8 </div> 9 </div>
9 <div class="modal-body"> 10 <div class="modal-body">
10 <!-- Card --> 11 <!-- Card -->
11 <div class="form-group"> 12 <div class="form-group">
12 - <label class="control-label" for="inputDefault">Name</label> 13 + <label class="control-label" for="inputDefault">{% trans 'Name' %}</label>
13 <input value="Python" type="text" class="form-control" id="inputDefault"> 14 <input value="Python" type="text" class="form-control" id="inputDefault">
14 </div> 15 </div>
15 <div class="form-group"> 16 <div class="form-group">
16 - <label class="control-label" for="inputDefault">Url</label> 17 + <label class="control-label" for="inputDefault">{% trans 'URL' %}</label>
17 <input value="https://www.python.org/" type="text" class="form-control" id="inputDefault"> 18 <input value="https://www.python.org/" type="text" class="form-control" id="inputDefault">
18 </div> 19 </div>
19 <div class="form-group is-empty"> 20 <div class="form-group is-empty">
20 - <label class="control-label" for="inputDefault">Descrição</label> 21 + <label class="control-label" for="inputDefault">{% trans 'Descrição' %}</label>
21 <textarea class="form-control" rows="3"></textarea> 22 <textarea class="form-control" rows="3"></textarea>
22 </div> 23 </div>
23 <div class="form-group"> 24 <div class="form-group">
24 - <a href="javascript:void(0)" class="btn btn-raised btn-default" data-dismiss="modal">Cancel</a>  
25 - <a href="javascript:void(0)" class="btn btn-raised btn-primary">Submit</a> 25 + <a href="javascript:void(0)" class="btn btn-raised btn-default" data-dismiss="modal">{% trans 'Cancel' %}</a>
  26 + <a href="javascript:void(0)" class="btn btn-raised btn-primary">{% trans 'Submit' %}</a>
26 </div> 27 </div>
27 <!-- .end Card --> 28 <!-- .end Card -->
28 </div> 29 </div>
links/templates/links/view_link.html
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <div class="modal-content"> 5 <div class="modal-content">
6 <div class="modal-header"> 6 <div class="modal-header">
7 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> 7 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
8 - <h4 class="modal-title" id="myModalLabel">Link</h4> 8 + <h4 class="modal-title" id="myModalLabel">{% trans 'Link' %}</h4>
9 </div> 9 </div>
10 <div class="modal-body"> 10 <div class="modal-body">
11 <!-- Card --> 11 <!-- Card -->
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <div class="card-block"> 14 <div class="card-block">
15 <b class="card-title">{{link.name}}</b><p></p> 15 <b class="card-title">{{link.name}}</b><p></p>
16 <p class="card-text"> </p><p>{{link.link_description}}</p> 16 <p class="card-text"> </p><p>{{link.link_description}}</p>
17 - <a href="{{ link.link_url }}" class="btn btn-primary">Read more</a> 17 + <a href="{{ link.link_url }}" class="btn btn-primary">{% trans 'Read more' %}</a>
18 </div> 18 </div>
19 </article> 19 </article>
20 <!-- .end Card --> 20 <!-- .end Card -->
users/forms.py
@@ -30,7 +30,9 @@ class AdminUserForm(forms.ModelForm): @@ -30,7 +30,9 @@ class AdminUserForm(forms.ModelForm):
30 30
31 class Meta: 31 class Meta:
32 model = User 32 model = User
33 - fields = ['username', 'name', 'email', 'password', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'is_staff', 'is_active'] 33 + fields = ['username', 'name', 'email', 'password',
  34 + 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone',
  35 + 'image', 'titration', 'year_titration', 'institution', 'curriculum', 'is_staff', 'is_active']
34 widgets = { 36 widgets = {
35 'password':forms.PasswordInput 37 'password':forms.PasswordInput
36 } 38 }
@@ -39,7 +41,9 @@ class UserForm(RegisterUserForm): @@ -39,7 +41,9 @@ class UserForm(RegisterUserForm):
39 41
40 class Meta: 42 class Meta:
41 model = User 43 model = User
42 - fields = ['username', 'name', 'email', 'birth_date', 'city', 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'titration', 'year_titration', 'institution', 'curriculum', 'is_staff', 'is_active'] 44 + fields = ['username', 'name', 'email', 'birth_date', 'city',
  45 + 'state', 'gender', 'type_profile', 'cpf', 'phone', 'image', 'titration',
  46 + 'year_titration', 'institution', 'curriculum', 'is_staff', 'is_active']
43 47
44 class UpdateUserForm(forms.ModelForm): 48 class UpdateUserForm(forms.ModelForm):
45 49
users/models.py
@@ -34,7 +34,7 @@ class User(AbstractBaseUser, PermissionsMixin): @@ -34,7 +34,7 @@ class User(AbstractBaseUser, PermissionsMixin):
34 is_active = models.BooleanField(_('Active'), default = True) 34 is_active = models.BooleanField(_('Active'), default = True)
35 35
36 USERNAME_FIELD = 'username' 36 USERNAME_FIELD = 'username'
37 - REQUIRED_FIELDS = ['email'] 37 + REQUIRED_FIELDS = ['email', 'cpf']
38 38
39 objects = UserManager() 39 objects = UserManager()
40 40
users/templates/list_users.html
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 {% block sidebar %} 12 {% block sidebar %}
13 <div class="panel panel-primary navigation"> 13 <div class="panel panel-primary navigation">
14 <div class="panel-heading"> 14 <div class="panel-heading">
15 - <h5>Menu</h5> 15 + <h5>{% trans 'Menu' %}</h5>
16 </div> 16 </div>
17 <div class="panel-body"> 17 <div class="panel-body">
18 <ul class="nav nav-pills nav-stacked"> 18 <ul class="nav nav-pills nav-stacked">
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 </div> 42 </div>
43 <div class="col-md-1 col-sm-1 col-xs-1"> 43 <div class="col-md-1 col-sm-1 col-xs-1">
44 <button type="submit" class="btn btn-fab btn-fab-mini"> 44 <button type="submit" class="btn btn-fab btn-fab-mini">
45 - <i class="material-icons">search</i> 45 + <i class="material-icons">Search</i>
46 </button> 46 </button>
47 </div> 47 </div>
48 </div> 48 </div>
@@ -81,14 +81,14 @@ @@ -81,14 +81,14 @@
81 <div class="modal-content"> 81 <div class="modal-content">
82 <div class="modal-header"> 82 <div class="modal-header">
83 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> 83 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
84 - <h4 class="modal-title" id="DeleteModalLabel">Confirm delete</h4> 84 + <h4 class="modal-title" id="DeleteModalLabel">{% trans 'Confirm delete' %}</h4>
85 </div> 85 </div>
86 <div class="modal-body"> 86 <div class="modal-body">
87 - Are you sure you want to delete the user <b>{{acc.name}}</b>? 87 + {% trans 'Are you sure you want to delete the user' %} <b>{{acc.name}}</b>?
88 </div> 88 </div>
89 <div class="modal-footer"> 89 <div class="modal-footer">
90 - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>  
91 - <button type="button" class="btn btn-primary"> <a href="{% url 'users:delete' acc.username %}">Delete</a></button> 90 + <button type="button" class="btn btn-default" data-dismiss="modal">{% trans 'Cancel' %}</button>
  91 + <button type="button" class="btn btn-primary"> <a href="{% url 'users:delete' acc.username %}">{% trans 'Delete' %}</a></button>
92 </div> 92 </div>
93 </div> 93 </div>
94 </div> 94 </div>
users/templates/users/profile.html
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 {% block sidebar %} 14 {% block sidebar %}
15 <div class="panel panel-primary navigation"> 15 <div class="panel panel-primary navigation">
16 <div class="panel-heading"> 16 <div class="panel-heading">
17 - <h4>Menu</h4> 17 + <h4>{% trans "Menu" %}</h4>
18 </div> 18 </div>
19 <div class="panel-body"> 19 <div class="panel-body">
20 <ul class="nav nav-pills nav-stacked"> 20 <ul class="nav nav-pills nav-stacked">
@@ -50,19 +50,19 @@ @@ -50,19 +50,19 @@
50 <table class="table table-hover table-edited"> 50 <table class="table table-hover table-edited">
51 <tbody> 51 <tbody>
52 <tr> 52 <tr>
53 - <td>Status:</td>  
54 - <td>Offline</td> 53 + <td>{% trans "Status" %}:</td>
  54 + <td></td>
55 </tr> 55 </tr>
56 <tr> 56 <tr>
57 - <td>Nome:</td> 57 + <td>{% trans "Nome" %}:</td>
58 <td>{{user}}</td> 58 <td>{{user}}</td>
59 </tr> 59 </tr>
60 <tr> 60 <tr>
61 - <td>Login:</td> 61 + <td>{% trans "Login" %}</td>
62 <td>{{user.username}}</td> 62 <td>{{user.username}}</td>
63 </tr> 63 </tr>
64 <tr> 64 <tr>
65 - <td>Email:</td> 65 + <td>{% trans "Email" %}:</td>
66 <td>{{user.email}}</td> 66 <td>{{user.email}}</td>
67 </tr> 67 </tr>
68 </tbody> 68 </tbody>
@@ -74,44 +74,71 @@ @@ -74,44 +74,71 @@
74 <table class="table table-hover table-edited"> 74 <table class="table table-hover table-edited">
75 <tbody> 75 <tbody>
76 <tr> 76 <tr>
77 - <td>Tipo de usuário:</td>  
78 - <td>{{use.type_profile}}</td> 77 + <td>{% trans "Tipo de Usuário" %}:</td>
  78 + {% if user.type_profile == 1 %}
  79 + <td>{% trans "Teacher" %}</td>
  80 + {% else %}
  81 + <td>{% trans "Student" %}</td>
  82 + {% endif %}
  83 +
79 </tr> 84 </tr>
80 <tr> 85 <tr>
81 - <td>CPF:</td>  
82 - <td>{{user.cpf}}</td> 86 + <td>{% trans "CPF" %}:</td>
  87 + {% if user.cpf %}
  88 + <td>{{user.cpf}}</td>
  89 +
  90 + {% else %}
  91 + <td>{% trans "doesn't posssess CPF" %}</td>
  92 + {% endif %}
  93 +
83 </tr> 94 </tr>
84 <tr> 95 <tr>
85 - <td>Número de telefone:</td>  
86 - <td>{{user.phone}}</td> 96 + <td>{% trans "Phone Number" %}:</td>
  97 + {% if user.phone %}
  98 + <td>{{user.phone}}</td>
  99 + {% else %}
  100 + <td>{% trans "doesn't posssess Phone" %}</td>
  101 + {% endif %}
  102 +
87 </tr> 103 </tr>
88 <tr> 104 <tr>
89 - <td>Sexo:</td> 105 + <td>{% trans "Gender" %}:</td>
90 <td>{{user.gender}}</td> 106 <td>{{user.gender}}</td>
91 </tr> 107 </tr>
92 <tr> 108 <tr>
93 - <td>Data de Nascimento:</td> 109 + <td>{% trans "Birth Date" %}:</td>
94 <td>{{user.birth_date}}</td> 110 <td>{{user.birth_date}}</td>
95 </tr> 111 </tr>
96 <tr> 112 <tr>
97 - <td>Estado e Cidade:</td> 113 + <td>{% trans "State and City" %}:</td>
98 <td>{{user.state}} - {{user.city}}</td> 114 <td>{{user.state}} - {{user.city}}</td>
99 </tr> 115 </tr>
100 <tr> 116 <tr>
101 - <td>Titulação:</td>  
102 - <td>Mestrado</td> 117 + <td>{% trans "Title" %}:</td>
  118 + <td>{{user.titration}}</td>
103 </tr> 119 </tr>
104 <tr> 120 <tr>
105 - <td>Ano:</td>  
106 - <td>2012</td> 121 + <td>{% trans "Year" %}:</td>
  122 + <td>{{user.year_titration}}</td>
107 </tr> 123 </tr>
108 <tr> 124 <tr>
109 - <td>Instituição:</td>  
110 - <td>UFPE</td> 125 + <td>{% trans "Institution" %}:</td>
  126 + {% if user.institution %}
  127 + <td>{{user.institution}}</td>
  128 + {% else %}
  129 + <td>{% trans "Didn't inform institution" %}</td>
  130 + {% endif %}
  131 +
  132 +
111 </tr> 133 </tr>
112 <tr> 134 <tr>
113 - <td>Currículo:</td>  
114 - <td>-</td> 135 + <td>{% trans "Curriculum" %}:</td>
  136 + {% if user.curriculum %}
  137 + <td>{{user.curriculum}}</td>
  138 + {% else %}
  139 + <td>{% trans "Didn't upload any curriculum" %}</td>
  140 + {% endif %}
  141 +
115 </tr> 142 </tr>
116 </tbody> 143 </tbody>
117 </table> 144 </table>
users/templates/users/remove_account.html
@@ -25,8 +25,8 @@ @@ -25,8 +25,8 @@
25 <div class="row"> 25 <div class="row">
26 <div class="col-md-12"> 26 <div class="col-md-12">
27 <div class="well well-lg"> 27 <div class="well well-lg">
28 - <h2>Voce tem certeza que deseja remover esta conta?</h2>  
29 - <p>Todos os seus dados serão removidos e não haverá como recupera-los posteriormente.</p> 28 + <h2>{% trans 'Voce tem certeza que deseja remover esta conta?' %}</h2>
  29 + <p>{% trans 'Todos os seus dados serão removidos e não haverá como recupera-los posteriormente.' %}</p>
30 <div class="row"> 30 <div class="row">
31 <div class="col-md-3 col-sm-2 col-xs-2"> 31 <div class="col-md-3 col-sm-2 col-xs-2">
32 <a href="#" class="btn btn-raised btn-block btn-success" >{% trans 'Remove' %}</a> 32 <a href="#" class="btn btn-raised btn-block btn-success" >{% trans 'Remove' %}</a>