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 139  
140 140 USE_I18N = True
141 141  
142   -USE_L10N = True
  142 +USE_L10N = False
143 143  
144 144 USE_TZ = True
145 145  
... ...
amadeus/staticfiles/css/base/amadeus.css
... ... @@ -18,9 +18,6 @@
18 18 padding-bottom: 1%;
19 19 width: 15%;
20 20 }
21   -.navigation{
22   - margin: 10% 10% 5% 5%;
23   -}
24 21 .breadcrumb{
25 22 margin-bottom: 5px;
26 23 }
... ... @@ -320,4 +317,4 @@ body .container .jumbotron-inverse, body .container .well-inverse, body .contain
320 317  
321 318 .notification-count {
322 319 background-color: #FF0000;
323 320 -}
  321 +}
324 322 \ No newline at end of file
... ...
app/templates/home.html
... ... @@ -3,55 +3,55 @@
3 3 {% load static i18n django_bootstrap_breadcrumbs permission_tags %}
4 4  
5 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 55 {% endblock %}
56 56  
57 57 {% block breadcrumbs %}
... ... @@ -64,7 +64,7 @@
64 64 {% endblock %}
65 65  
66 66 {% block sidebar %}
67   - <div class="panel panel-primary navigation">
  67 + <div class="panel panel-primary">
68 68 <div class="panel-heading">
69 69 <h4>Menu</h4>
70 70 </div>
... ... @@ -97,19 +97,19 @@
97 97 {% endblock %}
98 98  
99 99 {% block content %}
100   - {% if user|has_role:'system_admin' %}
  100 + {% if user|has_role:'system_admin' %}
101 101 <h3>{% trans 'Courses' %}</h3>
102 102 <div id="timeline">
103   - {% include page_template %}
  103 + {% include page_template %}
104 104 </div>
105   - {% else %}
  105 + {% else %}
106 106 <div id="timeline">
107 107 {% include page_template %}
108 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 115 {% endblock %}
... ...
app/templates/home_professor.html
... ... @@ -15,7 +15,7 @@
15 15 {% endblock %}
16 16  
17 17 {% block sidebar %}
18   - <div class="panel panel-primary navigation">
  18 + <div class="panel panel-primary">
19 19 <div class="panel-heading">
20 20 <h5>{% trans 'Menu' %}</h5>
21 21 </div>
... ... @@ -32,9 +32,9 @@
32 32 {% block content %}
33 33  
34 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 38 <div class="panel panel-default courseHome">
39 39 <div class="panel-body">
40 40 <p>{{ course }}</p>
... ... @@ -48,9 +48,9 @@
48 48 </div>
49 49 </div>
50 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 55 {% endblock %}
56 56  
... ...
app/templates/home_student.html
... ... @@ -16,23 +16,23 @@
16 16  
17 17  
18 18 {% block sidebar %}
19   - <div class="panel panel-primary navigation">
  19 + <div class="panel panel-primary">
20 20 <div class="panel-heading">
21 21 <h4>{% trans 'Menu' %}</h4>
22 22 </div>
23 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 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 29 </ul>
30 30 </div>
31 31 </div>
32 32 {% endblock %}
33 33  
34 34 {% block content %}
35   - <h3>{% trans 'Notifications' %}</h3>
  35 + <h3>{% trans 'Notifications' %}</h3>
36 36 {% if messages %}
37 37 {% for message in messages %}
38 38 <div class="alert alert-success alert-dismissible" role="alert">
... ... @@ -44,27 +44,27 @@
44 44 {% endfor %}
45 45 {% endif %}
46 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 53 </div>
54 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 61 </div>
62 62 <div class="panel panel-default">
63   - <div class="panel-body">
  63 + <div class="panel-body">
64 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 69 </div>
70 70 {% endblock %}
... ...
app/templates/home_teacher_student_content.html
... ... @@ -11,7 +11,7 @@
11 11 </div>
12 12 <div class="col-xs-10 col-md-11">
13 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 15 <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p>
16 16 </div>
17 17 </div>
... ...
core/static/css/base/amadeus.css
... ... @@ -30,7 +30,7 @@
30 30 margin: 10% 10% 5% 5%;
31 31 }
32 32 .breadcrumb{
33   - margin-bottom: 5px;
  33 + margin-bottom: 25px;
34 34 }
35 35 .courseHome{
36 36 text-align: center;
... ... @@ -394,4 +394,21 @@ ul, li {
394 394 -webkit-animation-duration: 900ms;
395 395 -webkit-animation-iteration-count: 3;
396 396 -webkit-animation-timing-function: ease-in-out;
397   -}
398 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 416 \ No newline at end of file
... ...
core/templates/base.html
1 1 <!DOCTYPE html>
2 2  
3 3 {% load static i18n %}
  4 +{% load static i18n permission_tags %}
4 5 {% get_current_language as LANGUAGE_CODE %}
5 6  
6 7 <html>
... ... @@ -69,14 +70,14 @@
69 70 <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
70 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 72 <ul id="notification-dropdown" class="dropdown-menu">
72   - <li class="dropdown-header">Notifications</li>
  73 + <li class="dropdown-header"> {% trans 'Notifications' %}</li>
73 74 {% include "notifications.html" %}
74 75  
75 76 <li>
76 77 <a onclick="getNotifications(5)">
77 78 <div id="notification-see-more" class="list-group-item">
78 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 81 </div>
81 82 </a>
82 83 </li>
... ... @@ -93,7 +94,54 @@
93 94 <div class="container-fluid">
94 95 <div class="row">
95 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 145 </div>
98 146 <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10">
99 147 {% block breadcrumbs %}{% endblock %}
... ...
core/templates/guest.html
... ... @@ -5,82 +5,80 @@
5 5  
6 6 <html>
7 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 50 </head>
51 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 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 66 <ul id="notification-dropdown" class="dropdown-menu">
67 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 73 <div class="row-content">
74 74 <p class="list-group-item-text">See More</p>
75 75 </div>
76 76 </a>
77   - </li>
  77 + </li>
78 78 </ul>
79 79 </li>
80   -
81 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 81 <li > <a class="link" href="{% url 'app:index' %}">{{ user }}</a></li>
83   -
84 82 </ul>
85 83 </div>
86 84 </div>
... ... @@ -90,7 +88,7 @@
90 88  
91 89 <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2">
92 90 {% block sidebar %}
93   - <div class="panel panel-primary navigation">
  91 + <div class="panel panel-primary">
94 92 <div class="panel-heading">
95 93 <h4>Menu</h4>
96 94 </div>
... ... @@ -119,7 +117,7 @@
119 117 </form>
120 118 </div>
121 119  
122   - <div class="col-md-12">
  120 + <div class="col-md-10">
123 121 <div class="btn-group btn-group-justified btn-group-raised">
124 122 <a href="?category=all" class="btn btn-raised btn-info">Todos</a>
125 123 {% for category in categories %}
... ... @@ -132,7 +130,7 @@
132 130 {% block render_breadcrumbs %}{% endblock %}
133 131 <div>
134 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 134 {% block content %}
137 135 {% for course in courses %}
138 136 <div class="panel panel-info panel_{{ course.id }}">
... ... @@ -142,7 +140,7 @@
142 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 141 {% endif %}
144 142 </div>
145   -
  143 +
146 144 <div class="panel-body">
147 145 <p><b>Course Name: </b>{{course.name}}</p>
148 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 37  
38 38  
39 39  
40   - <title>Projeto Amadeus</title>
  40 + <title>{% trans 'Amadeus Project' %}</title>
41 41  
42 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 62 <form name="logonForm" method="post" action="/amadeuslms/validateLogin.do">
63 63 <dt><input type="text" name="login" maxlength="15" size="15" value="" class="inputlogin"> </dt>
64 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 66 </form>
67 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 98  
99 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 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 104 </div>
105 105 <div id="pTitle" class="pTitle">
106   - <h2>Lembrar senha</h2>
  106 + <h2>{% trans 'Lembrar senha' %}</h2>
107 107 </div>
108 108 <div id="pBreadCrumbs" class="pBreadCrumbs">
109 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 112 </ul>
113 113 </div>
114 114 <div id="pLeftMenu" class="pLeftMenu">
115 115 <div id="side_menu_1">
116 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 118 </ul>
119 119 </div>
120 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 123  
124 124  
125 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 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 129 <dt class="field"><input type="submit" name="remindPassword" value="Enviar e-mail" class="button"></dt>
130 130 </form>
131 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 160  
161 161  
162 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 164 </div>
165 165  
166 166 </div>
... ...
core/templates/register_user.html
... ... @@ -27,7 +27,7 @@
27 27 </div>
28 28  
29 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 31 <div class="card">
32 32 <div class="card-content">
33 33 <div class="card-body">
... ... @@ -44,7 +44,8 @@
44 44 {% else %}
45 45 <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label>
46 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 49 {% if field.auto_id == 'id_birth_date' %}
49 50 {% render_field field class='form-control input-sm date-picker' %}
50 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 4 {% block reset_link %}
5 5 {{ protocol }}://{{ domain }}{% url 'core:password_reset_confirm' uidb64=uid token=token %}
6 6  
7 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 10 window instead.
11 11  
12 12  
13 13 Sincerely,
14   -Amadeus.
  14 +Amadeus.' %}
... ...
core/templates/registration/password_reset_subject.txt
1 1 {% load i18n %}{% autoescape off %}
2   -{% blocktrans %}Password reset on {{ site_name }}{% endblocktrans %}
  2 +{% blocktrans %}{% trans 'Password reset on' %} {{ site_name }}{% endblocktrans %}
3 3 {% endautoescape %}
... ...
courses/permissions.py
... ... @@ -2,6 +2,19 @@ from rolepermissions.permissions import register_object_checker
2 2 from amadeus.roles import SystemAdmin
3 3  
4 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 18 def edit_topic(role, user, topic):
6 19 if (role == SystemAdmin):
7 20 return True
... ... @@ -12,6 +25,19 @@ def edit_topic(role, user, topic):
12 25 return False
13 26  
14 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 41 def edit_subject(role, user, subject):
16 42 if (role == SystemAdmin):
17 43 return True
... ...
courses/static/js/course.js
... ... @@ -49,13 +49,13 @@ function subscribe(elem, url, id, confirm_message) {
49 49 function delete_course(url, course, message, return_url) {
50 50 alertify.confirm(message, function(){
51 51 var csrftoken = getCookie('csrftoken');
52   -
  52 +
53 53 $.ajax({
54 54 method: 'post',
55 55 beforeSend: function (request) {
56 56 request.setRequestHeader('X-CSRFToken', csrftoken);
57 57 },
58   - url: url,
  58 + url: url,
59 59 success: function(data) {
60 60 alertify.alert('Remove Course', 'Course removed successfully!', function(){
61 61 window.location.href = return_url;
... ... @@ -71,7 +71,7 @@ function delete_course(url, course, message, return_url) {
71 71 */
72 72 function replicate_course(url, course) {
73 73 $.ajax({
74   - url: url,
  74 + url: url,
75 75 data: {'form': course},
76 76 success: function(data) {
77 77 $(".course_replicate_form").html(data);
... ...
courses/static/js/modal_category.js
... ... @@ -6,6 +6,7 @@ var Submite = {
6 6 $(id_li_link).remove();
7 7 $("#modal_category").empty();
8 8 $("#accordion").remove();
  9 + $(".modal-backdrop.in").remove();
9 10 alertify.success("Category removed successfully!");
10 11 }).fail(function(){
11 12 $("#modal_category").empty();
... ...
courses/templates/category/create.html
... ... @@ -27,25 +27,25 @@
27 27  
28 28 <div class="panel panel-primary navigation">
29 29 <div class="panel-heading">
30   - <h3 class="panel-title">Actions</h3>
  30 + <h3 class="panel-title">{% trans 'Actions' %}</h3>
31 31 </div>
32 32 <div class="panel-body">
33 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 37 </ul>
38 38 </div>
39 39 </div>
40 40  
41 41 <div class="panel panel-primary navigation">
42 42 <div class="panel-heading">
43   - <h3 class="panel-title">Category</h3>
  43 + <h3 class="panel-title">{% trans 'Category' %}</h3>
44 44 </div>
45 45 <div class="panel-body">
46 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 49 </ul>
50 50 </div>
51 51 </div>
... ...
courses/templates/category/index.html
... ... @@ -28,25 +28,25 @@
28 28  
29 29 <div class="panel panel-primary navigation">
30 30 <div class="panel-heading">
31   - <h3 class="panel-title">Actions</h3>
  31 + <h3 class="panel-title">{% trans 'Actions' %}</h3>
32 32 </div>
33 33 <div class="panel-body">
34 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 38 </ul>
39 39 </div>
40 40 </div>
41 41  
42 42 <div class="panel panel-primary navigation">
43 43 <div class="panel-heading">
44   - <h3 class="panel-title">Category</h3>
  44 + <h3 class="panel-title">{% trans 'Category' %}</h3>
45 45 </div>
46 46 <div class="panel-body">
47 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 50 </ul>
51 51 </div>
52 52 </div>
... ...
courses/templates/category/update.html
... ... @@ -28,24 +28,24 @@
28 28  
29 29 <div class="panel panel-primary navigation">
30 30 <div class="panel-heading">
31   - <h3 class="panel-title">Actions</h3>
  31 + <h3 class="panel-title">{% trans 'Actions' %}</h3>
32 32 </div>
33 33 <div class="panel-body">
34 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 38 </ul>
39 39 </div>
40 40 </div>
41 41 <div class="panel panel-primary navigation">
42 42 <div class="panel-heading">
43   - <h3 class="panel-title">Category</h3>
  43 + <h3 class="panel-title">{% trans 'Category' %}</h3>
44 44 </div>
45 45 <div class="panel-body">
46 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 49 </ul>
50 50 </div>
51 51 </div>
... ...
courses/templates/course/course_card.html
1 1 {% load static i18n permission_tags %}
2 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 43 </div>
45 44  
46 45 <div class="modal fade" id="replicateCourse" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
... ...
courses/templates/course/create.html
... ... @@ -26,7 +26,7 @@
26 26 <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."/>
27 27 <span class="input-group-btn input-group-sm">
28 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 30 </button>
31 31 </span>
32 32 </div>
... ...
courses/templates/course/index.html
... ... @@ -11,7 +11,7 @@
11 11 {% endblock %}
12 12  
13 13 {% block sidebar %}
14   - <div class="panel panel-primary navigation">
  14 + <div class="panel panel-primary">
15 15 <div class="panel-heading">
16 16 <h4>Menu</h4>
17 17 </div>
... ... @@ -42,89 +42,67 @@
42 42 </div>
43 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 59 {% endblock %}
60 60  
61 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 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 108 {% endblock %}
... ...
courses/templates/course/replicate.html
... ... @@ -15,86 +15,86 @@
15 15 <div class="card-body">
16 16 <form method="post" action="" enctype="multipart/form-data">{% csrf_token %}
17 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 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 25 </div>
26 26  
27 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 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 34 </div>
35 35  
36 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 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 44 </div>
45 45  
46 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 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 54 </div>
55 55  
56 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 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 64 </div>
65 65  
66 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 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 74 </div>
75 75  
76 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 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 84 </div>
85 85  
86 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 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 94 </div>
95 95  
96 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 100 <input class="form-control" id="id_image" name="image" type="file">
... ... @@ -102,17 +102,17 @@
102 102 <input type="text" readonly="" class="form-control" placeholder="Choose your photo...">
103 103 <span class="input-group-btn input-group-sm">
104 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 106 </button>
107 107 </span>
108 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 112 </div>
113 113  
114 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 118 <select class="form-control" id="id_category" name="category" required="">
... ... @@ -121,7 +121,7 @@
121 121 {% endfor %}
122 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 126 </div>
127 127  
... ...
courses/templates/course/update.html
... ... @@ -25,7 +25,7 @@
25 25 <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."/>
26 26 <span class="input-group-btn input-group-sm">
27 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 29 </button>
30 30 </span>
31 31 </div>
... ...
courses/templates/course/view.html
... ... @@ -19,7 +19,7 @@
19 19 {% endblock %}
20 20  
21 21 {% block sidebar %}
22   - <div class="panel panel-primary navigation">
  22 + <div class="panel panel-primary">
23 23 <div class="panel-heading">
24 24 <h5>{% trans 'Menu' %}</h5>
25 25 </div>
... ... @@ -38,15 +38,15 @@
38 38  
39 39 {% block content %}
40 40  
41   - <div class="col-md-12">
  41 + <div class="col-md-12 cards-content">
42 42 <div class="panel panel-info">
43   - <div class="panel-heading headingOne">
  43 + <div class="panel-heading course-detail">
44 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 47 </div>
48 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 50 <div class="btn-group">
51 51 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
52 52 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
... ... @@ -74,7 +74,7 @@
74 74  
75 75 </div>
76 76 </div>
77   -
  77 +
78 78 <!-- MODAL CREATE SUBJECT -->
79 79 <div class="modal" tabindex="-1" role="dialog " id="createSubject">
80 80 <div class="modal-dialog">
... ... @@ -121,19 +121,22 @@
121 121 </div>
122 122 </div>
123 123 </div>
124   -<div>
  124 +<div class="cards-detail">
125 125 {% if request.GET.category == 'all' or none or request.GET.category == '' %}
126 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 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 136 </a>
134 137 </div>
135 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 140 <div class="btn-group">
138 141 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
139 142 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
... ... @@ -153,40 +156,44 @@
153 156 {% endif %}
154 157 </div>
155 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 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 179 </div>
176 180 {% endfor %}
177 181 {% else %}
178 182 {% for subject in subjects_category %}
179 183 {% if subject.category.name == request.GET.category %}
180 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 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 197 <div class="btn-group">
191 198 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
192 199 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
... ... @@ -205,7 +212,8 @@
205 212 {% endif %}
206 213 </div>
207 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 217 <p><b>{% trans "Professor" %}: </b>{% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %}
210 218 {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p>
211 219 <p>
... ... @@ -222,8 +230,8 @@
222 230 <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p>
223 231 </div>
224 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 233 </div>
  234 + </div>
227 235 </div>
228 236 {% endif %}
229 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 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 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 53 </div>
  54 + {% list_topic_poll request topic %}
  55 + </div>
39 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 75 </div>
41   -</div>
  76 + </div>
42 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 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 42 </div>
38 43 </div>
39 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 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 84 </div>
70 85 </div>
71 86 <ul id="list-materials">
72 87 {% list_topic_file request topic %}
73 88 {% list_topic_link request topic%}
74   -
  89 +
75 90 </ul>
76 91 </div>
77 92 <div class="col-xs-4 col-md-4">
... ... @@ -89,7 +104,7 @@
89 104 </div>
90 105 </div>
91 106 <ul>
92   -
  107 +
93 108 <div class="foruns_list">
94 109 {% list_topic_foruns request topic %}
95 110 </div>
... ... @@ -97,74 +112,84 @@
97 112 </div>
98 113 {% list_topic_poll request topic %}
99 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 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 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 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 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 176 </div>
162 177 </div>
163 178 </div>
164 179 </div>
165   - </div>
166   -
167 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 193 <!-- MODAL REMOVE TOPIC -->
169 194 <div class="modal" id="removeTopic">
170 195 <div class="modal-dialog">
... ... @@ -174,22 +199,17 @@
174 199 <h4 class="modal-title"></h4>
175 200 </div>
176 201 <div class="modal-body">
177   - <p>Delete your Topic?</p>
  202 + <p>{% trans 'Delete your Topic?' %}</p>
178 203 </div>
179 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 208 </div>
184 209 </div>
185 210 </div>
186 211 </div>
187 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 214 <!-- MODAL EMBEED-->
195 215 <div class="modal fade" id="embedModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
... ... @@ -197,32 +217,32 @@
197 217 <div class="modal-content">
198 218 <div class="modal-header">
199 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 221 </div>
202 222 <div class="modal-body">
203 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 225 <div class="col-md-10">
206 226 <input type="text" class="form-control" id="inputEmail" placeholder="Name">
207 227 </div>
208 228 </div>
209 229 <form class="form-horizontal">
210 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 233 <div class="col-md-10">
214 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 236 </div>
217 237 </div>
218 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 240 <div class="col-md-4">
221 241 <input type="number" class="form-control" id="inputNumber" placeholder="Heiht">
222 242 </div>
223 243 </div>
224 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 246 <div class="col-md-4">
227 247 <input type="number" class="form-control" id="inputNumber" placeholder="Weight">
228 248 </div>
... ... @@ -235,7 +255,7 @@
235 255 <button type="button" class="btn btn-danger btn-raised" data-dismiss="modal">Close</button>-->
236 256  
237 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 259 </div>
240 260 </div>
241 261 </div>
... ... @@ -254,27 +274,27 @@
254 274 <form class="form-horizontal">
255 275  
256 276 <fieldset>
257   - <legend>Atividade Proposta</legend>
  277 + <legend>{% trans 'Atividade Proposta' %}</legend>
258 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 280 <div class="col-md-10">
261 281 <input type="text" id="NameIn" class="form-control">
262 282 </div>
263 283 </div>
264 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 286 <div class="col-md-10">
267 287 <textarea class="form-control" id="DescIn" rows="2"></textarea>
268 288 </div>
269 289 </div>
270 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 292 <div class="col-md-10">
273 293 <input type="text" id="DateIn" class="form-control date-picker" requerid="">
274 294 </div>
275 295 </div>
276 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 298 <div class="col-md-10">
279 299 <input type="text" id="DateIn" class="form-control date-picker" requerid="">
280 300 </div>
... ... @@ -283,15 +303,15 @@
283 303 <div class="col-md-offset-2 col-md-10">
284 304 <div class="checkbox">
285 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 307 </label>
288 308 </div>
289 309 </div>
290 310 </div>
291 311 <div class="form-group">
292 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 315 </div>
296 316 </div>
297 317  
... ... @@ -335,3 +355,5 @@
335 355 </div>
336 356 </div>
337 357 </div>
  358 +
  359 +
... ...
courses/templates/subject/index.html
... ... @@ -15,77 +15,95 @@
15 15  
16 16 </ol>
17 17 {% endblock %}
18   -
19 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 47 </div>
  48 +</div>
31 49  
32 50  
33 51 {% endblock %}
34 52  
35 53 {% block content %}
36 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 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 109 {% endblock %}
... ...
courses/templates/subject/poll_item_actions.html
... ... @@ -6,9 +6,9 @@
6 6 {% for poll in polls %}
7 7 {% professor_subject poll.topic.subject request.user as permission%}
8 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 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 12 {% endif %}
13 13 {% endfor %}
14 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 19  
20 20 {% block sidebar %}
21 21  
22   - <div class="panel panel-primary navigation">
  22 + <div class="panel panel-primary">
23 23 <div class="panel-heading">
24 24 <h5>{% trans 'Menu' %}</h5>
25 25 </div>
... ... @@ -32,22 +32,22 @@
32 32 </div>
33 33  
34 34 {% if user|has_role:'professor' %}
35   - <div class="panel panel-primary navigation">
  35 + <div class="panel panel-primary ">
36 36 <div class="panel-heading">
37   - <h3 class="panel-title">Actions</h3>
  37 + <h3 class="panel-title">{% trans 'Actions' %}</h3>
38 38 </div>
39 39 <div class="panel-body">
40 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 46 </ul>
47 47 </div>
48 48 </div>
49 49 {% endif %}
50   -
  50 +
51 51 {% endblock %}
52 52  
53 53 {% block content %}
... ... @@ -109,12 +109,12 @@
109 109 <div class="panel-body">
110 110 <div class="row">
111 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 113 </div>
114 114 {% professor_subject subject user as permi_test%}
115 115 {% if permi_test %}
116 116 <div class="col-md-4">
117   - <label> Nota:</label>
  117 + <label> {% trans 'Nota' %}:</label>
118 118 <input type="number" step="0.01">
119 119 </div>
120 120 {% else %}
... ... @@ -124,7 +124,7 @@
124 124 <div class="form-group {% if form.pdf.errors %} has-error {% endif %}">
125 125 {{ form.as_p }}
126 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 128 </div>
129 129 {% endif %}
130 130 </div>
... ...
courses/templatetags/custom_filters.py
... ... @@ -4,6 +4,19 @@ from rolepermissions.verifications import has_role
4 4 register = template.Library()
5 5  
6 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 20 def show_subject_subscribe(user, subject):
8 21 if not user is None:
9 22 if user.is_authenticated:
... ...
courses/views.py
... ... @@ -210,6 +210,7 @@ class CourseView( NotificationMixin, generic.DetailView):
210 210 courses = None
211 211 context = super(CourseView, self).get_context_data(**kwargs)
212 212 course = get_object_or_404(Course, slug = self.kwargs.get('slug'))
  213 +
213 214 if has_role(self.request.user,'system_admin'):
214 215 subjects = course.subjects.all()
215 216 elif has_role(self.request.user,'professor'):
... ... @@ -381,6 +382,14 @@ class SubjectsView(LoginRequiredMixin, generic.ListView):
381 382 context_object_name = 'subjects'
382 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 393 def get_queryset(self):
385 394 subject = get_object_or_404(Subject, slug = self.kwargs.get('slug'))
386 395 course = subject.course
... ... @@ -428,6 +437,14 @@ class TopicsView(LoginRequiredMixin, generic.ListView):
428 437 context_object_name = 'topics'
429 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 448 def get_queryset(self):
432 449 topic = get_object_or_404(Topic, slug = self.kwargs.get('slug'))
433 450 subject = topic.subject
... ...
exam/templates/exam/gap_filling_question.html
1 1 <div class="form-group" id="gapFilling" style="display: none;">
2   - <p>Gap Filling Question</p>
  2 + <p>{% trans 'Gap Filling Question' %}</p>
3 3 </div>
... ...
exam/templates/exam/multiple_choice_question.html
1 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 6 <div class="col-md-10">
... ... @@ -10,7 +10,7 @@
10 10  
11 11 </div>
12 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 14 <div class="col-md-10" id="radios">
15 15 <div class="radio radio-primary">
16 16 <label>
... ... @@ -29,7 +29,7 @@
29 29 <!-- new alternative button -->
30 30 <div class="form-group">
31 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 33 </div>
34 34 </div>
35 35 <div class="form-group">
... ...
files/templates/files/create_file.html
... ... @@ -65,14 +65,14 @@
65 65  
66 66 <div class="form-group">
67 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 69 </div>
70 70 </div>
71 71  
72 72 <div class="form-group">
73 73 <div class="col-md-12">
74 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 76 </div>
77 77 </div>
78 78 </fieldset>
... ...
files/templates/files/delete_file.html
... ... @@ -32,7 +32,7 @@
32 32 <div class="form-group">
33 33 <div class="col-md-12">
34 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 36 </div>
37 37 </div>
38 38 </fieldset>
... ...
files/templates/files/update_file.html
... ... @@ -70,14 +70,14 @@
70 70  
71 71 <div class="form-group">
72 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 74 </div>
75 75 </div>
76 76  
77 77 <div class="form-group">
78 78 <div class="col-md-12">
79 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 81 </div>
82 82 </div>
83 83 </fieldset>
... ...
forum/permissions.py 0 → 100644
... ... @@ -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 70 type: frm.attr('method'),
71 71 url: frm.attr('action'),
72 72 data: frm.serialize(),
  73 + dataType: "json",
73 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 77 $("#createForum").modal('hide');
79 78 },
... ...
forum/templates/forum/forum_list.html
... ... @@ -56,7 +56,7 @@
56 56 {% endif %}
57 57 <span class="input-group-btn">
58 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 60 </button>
61 61 </span>
62 62 </div>
... ...
forum/templates/forum/forum_view.html
... ... @@ -34,7 +34,7 @@
34 34 </div>
35 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 38 <div class="panel panel-primary navigation">
39 39 <div class="panel-heading">
40 40 <h3 class="panel-title">{% trans 'Actions' %}</h3>
... ... @@ -88,7 +88,7 @@
88 88 {% endif %}
89 89 <span class="input-group-btn">
90 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 92 </button>
93 93 </span>
94 94 </div>
... ...
forum/templates/post/post_list.html
... ... @@ -8,7 +8,7 @@
8 8 {{ post.user }}
9 9 <div class="pull-right">
10 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 12 </a>
13 13 {% if request.user|has_role:'system_admin' or request.user == post.user %}
14 14 {% csrf_token %}
... ...
forum/templates/post/post_load_more_render.html
... ... @@ -8,7 +8,7 @@
8 8 {{ post.user }}
9 9 <div class="pull-right">
10 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 12 </a>
13 13 {% if request.user|has_role:'system_admin' or request.user == post.user %}
14 14 {% csrf_token %}
... ...
forum/templates/post/post_render.html
... ... @@ -6,7 +6,7 @@
6 6 {{ post.user }}
7 7 <div class="pull-right">
8 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 10 </a>
11 11 {% if request.user|has_role:'system_admin' or request.user|has_role:'professor' and request.user == post.user %}
12 12 {% csrf_token %}
... ...
forum/templates/post_answers/post_answer_form.html
... ... @@ -35,7 +35,7 @@
35 35 {% else %}
36 36 <span class="input-group-btn">
37 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 39 </button>
40 40 </span>
41 41 {% endif %}
... ...
forum/views.py
... ... @@ -9,6 +9,9 @@ from django.http import Http404, JsonResponse
9 9 from django.urls import reverse
10 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 15 from .models import Forum, Post, PostAnswer
13 16 from courses.models import Topic
14 17 from core.models import Action, Resource
... ... @@ -41,7 +44,9 @@ class ForumIndex(LoginRequiredMixin, generic.ListView):
41 44  
42 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 50 login_url = reverse_lazy("core:home")
46 51 redirect_field_name = 'next'
47 52  
... ... @@ -67,9 +72,11 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView, NotificationM
67 72 def render_forum(request, forum):
68 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 80 login_url = reverse_lazy("core:home")
74 81 redirect_field_name = 'next'
75 82  
... ... @@ -77,6 +84,14 @@ class UpdateForumView(LoginRequiredMixin, generic.UpdateView):
77 84 form_class = ForumForm
78 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 95 def form_invalid(self, form):
81 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 108  
94 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 114 login_url = reverse_lazy("core:home")
98 115 redirect_field_name = 'next'
99 116  
... ... @@ -101,6 +118,14 @@ class ForumDeleteView(LoginRequiredMixin, generic.DeleteView):
101 118 pk_url_kwarg = 'pk'
102 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 129 def forum_deleted(request):
105 130 return HttpResponse(_("Forum deleted successfully."))
106 131  
... ... @@ -112,6 +137,14 @@ class ForumDetailView(LoginRequiredMixin, generic.DetailView):
112 137 template_name = 'forum/forum_view.html'
113 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 148 def get_context_data(self, **kwargs):
116 149 context = super(ForumDetailView, self).get_context_data(**kwargs)
117 150 forum = get_object_or_404(Forum, slug = self.kwargs.get('slug'))
... ...
links/templates/links/create_link.html
... ... @@ -6,7 +6,7 @@
6 6 <div class="modal-content">
7 7 <div class="modal-header">
8 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 10 </div>
11 11 <div class="modal-body">
12 12 <!-- Card -->
... ... @@ -31,8 +31,8 @@
31 31 {% render_field field class='form-control' %}
32 32 {% endfor %}
33 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 36 </div>
37 37 <!-- .end Card -->
38 38 </div>
... ...
links/templates/links/delete_link.html
  1 +{% load widget_tweaks i18n %}
1 2 <!-- MODAL REMOVE LINK -->
2 3 <div class="modal" id="removeLink">
3 4 <div class="modal-dialog">
... ... @@ -7,12 +8,12 @@
7 8 <h4 class="modal-title"></h4>
8 9 </div>
9 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 12 </div>
12 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 18 </div>
18 19 </div>
... ...
links/templates/links/update_link.html
  1 +{% load widget_tweaks i18n %}
1 2 <!-- MODAL LINK EDIT-->
2 3 <div class="modal fade" id="linksModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
3 4 <div class="modal-dialog" role="document">
4 5 <div class="modal-content">
5 6 <div class="modal-header">
6 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 9 </div>
9 10 <div class="modal-body">
10 11 <!-- Card -->
11 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 14 <input value="Python" type="text" class="form-control" id="inputDefault">
14 15 </div>
15 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 18 <input value="https://www.python.org/" type="text" class="form-control" id="inputDefault">
18 19 </div>
19 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 22 <textarea class="form-control" rows="3"></textarea>
22 23 </div>
23 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 27 </div>
27 28 <!-- .end Card -->
28 29 </div>
... ...
links/templates/links/view_link.html
... ... @@ -5,7 +5,7 @@
5 5 <div class="modal-content">
6 6 <div class="modal-header">
7 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 9 </div>
10 10 <div class="modal-body">
11 11 <!-- Card -->
... ... @@ -14,7 +14,7 @@
14 14 <div class="card-block">
15 15 <b class="card-title">{{link.name}}</b><p></p>
16 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 18 </div>
19 19 </article>
20 20 <!-- .end Card -->
... ...
users/forms.py
... ... @@ -30,7 +30,9 @@ class AdminUserForm(forms.ModelForm):
30 30  
31 31 class Meta:
32 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 36 widgets = {
35 37 'password':forms.PasswordInput
36 38 }
... ... @@ -39,7 +41,9 @@ class UserForm(RegisterUserForm):
39 41  
40 42 class Meta:
41 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 48 class UpdateUserForm(forms.ModelForm):
45 49  
... ...
users/models.py
... ... @@ -34,7 +34,7 @@ class User(AbstractBaseUser, PermissionsMixin):
34 34 is_active = models.BooleanField(_('Active'), default = True)
35 35  
36 36 USERNAME_FIELD = 'username'
37   - REQUIRED_FIELDS = ['email']
  37 + REQUIRED_FIELDS = ['email', 'cpf']
38 38  
39 39 objects = UserManager()
40 40  
... ...
users/templates/list_users.html
... ... @@ -12,7 +12,7 @@
12 12 {% block sidebar %}
13 13 <div class="panel panel-primary navigation">
14 14 <div class="panel-heading">
15   - <h5>Menu</h5>
  15 + <h5>{% trans 'Menu' %}</h5>
16 16 </div>
17 17 <div class="panel-body">
18 18 <ul class="nav nav-pills nav-stacked">
... ... @@ -42,7 +42,7 @@
42 42 </div>
43 43 <div class="col-md-1 col-sm-1 col-xs-1">
44 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 46 </button>
47 47 </div>
48 48 </div>
... ... @@ -81,14 +81,14 @@
81 81 <div class="modal-content">
82 82 <div class="modal-header">
83 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 85 </div>
86 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 88 </div>
89 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 92 </div>
93 93 </div>
94 94 </div>
... ...
users/templates/users/profile.html
... ... @@ -14,7 +14,7 @@
14 14 {% block sidebar %}
15 15 <div class="panel panel-primary navigation">
16 16 <div class="panel-heading">
17   - <h4>Menu</h4>
  17 + <h4>{% trans "Menu" %}</h4>
18 18 </div>
19 19 <div class="panel-body">
20 20 <ul class="nav nav-pills nav-stacked">
... ... @@ -50,19 +50,19 @@
50 50 <table class="table table-hover table-edited">
51 51 <tbody>
52 52 <tr>
53   - <td>Status:</td>
54   - <td>Offline</td>
  53 + <td>{% trans "Status" %}:</td>
  54 + <td></td>
55 55 </tr>
56 56 <tr>
57   - <td>Nome:</td>
  57 + <td>{% trans "Nome" %}:</td>
58 58 <td>{{user}}</td>
59 59 </tr>
60 60 <tr>
61   - <td>Login:</td>
  61 + <td>{% trans "Login" %}</td>
62 62 <td>{{user.username}}</td>
63 63 </tr>
64 64 <tr>
65   - <td>Email:</td>
  65 + <td>{% trans "Email" %}:</td>
66 66 <td>{{user.email}}</td>
67 67 </tr>
68 68 </tbody>
... ... @@ -74,44 +74,71 @@
74 74 <table class="table table-hover table-edited">
75 75 <tbody>
76 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 84 </tr>
80 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 94 </tr>
84 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 103 </tr>
88 104 <tr>
89   - <td>Sexo:</td>
  105 + <td>{% trans "Gender" %}:</td>
90 106 <td>{{user.gender}}</td>
91 107 </tr>
92 108 <tr>
93   - <td>Data de Nascimento:</td>
  109 + <td>{% trans "Birth Date" %}:</td>
94 110 <td>{{user.birth_date}}</td>
95 111 </tr>
96 112 <tr>
97   - <td>Estado e Cidade:</td>
  113 + <td>{% trans "State and City" %}:</td>
98 114 <td>{{user.state}} - {{user.city}}</td>
99 115 </tr>
100 116 <tr>
101   - <td>Titulação:</td>
102   - <td>Mestrado</td>
  117 + <td>{% trans "Title" %}:</td>
  118 + <td>{{user.titration}}</td>
103 119 </tr>
104 120 <tr>
105   - <td>Ano:</td>
106   - <td>2012</td>
  121 + <td>{% trans "Year" %}:</td>
  122 + <td>{{user.year_titration}}</td>
107 123 </tr>
108 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 133 </tr>
112 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 142 </tr>
116 143 </tbody>
117 144 </table>
... ...
users/templates/users/remove_account.html
... ... @@ -25,8 +25,8 @@
25 25 <div class="row">
26 26 <div class="col-md-12">
27 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 30 <div class="row">
31 31 <div class="col-md-3 col-sm-2 col-xs-2">
32 32 <a href="#" class="btn btn-raised btn-block btn-success" >{% trans 'Remove' %}</a>
... ...