Commit f49006dba5217fbebf384e06e5cb3f1d308b9d84

Authored by juliotoscano
1 parent 96cf48d1

modifying css cards #250

app/static/js/home.js 0 → 100644
@@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
  1 +// loadOnScroll handler
  2 +var loadOnScroll = function() {
  3 + // If the current scroll position is past out cutoff point...
  4 + if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
  5 + // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row
  6 + $(window).unbind();
  7 + // execute the load function below that will visit the view and return the content
  8 + loadItems();
  9 + }
  10 +};
  11 +
  12 +var loadItems = function() {
  13 + // Check if page is equal to the number of pages
  14 + if (pageNum == numberPages) {
  15 + return false
  16 + }
  17 + // Update the page number
  18 + pageNum = pageNum + 1;
  19 +
  20 + $("#loading").show();
  21 + // Configure the url we're about to hit
  22 + setTimeout(function (){
  23 + $.ajax({
  24 + url: baseUrl,
  25 + data: {'page': pageNum},
  26 + success: function(data) {
  27 + $("#loading").hide();
  28 +
  29 + $("#timeline").append(data);
  30 + },
  31 + complete: function(data, textStatus){
  32 + // Turn the scroll monitor back on
  33 + $(window).bind('scroll', loadOnScroll);
  34 + }
  35 + });
  36 + }, 1000)
  37 +};
  38 +
  39 +$(document).ready(function(){
  40 + $(window).bind('scroll', loadOnScroll);
  41 + $.material.init();
  42 +});
0 \ No newline at end of file 43 \ No newline at end of file
app/templates/home.html
@@ -5,59 +5,16 @@ @@ -5,59 +5,16 @@
5 {% block javascript %} 5 {% block javascript %}
6 {% if page_obj %} 6 {% if page_obj %}
7 <script type="text/javascript"> 7 <script type="text/javascript">
8 - {% if page_obj and paginator %}  
9 - var pageNum = {{ page_obj.number }}; // The latest page loaded  
10 - var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages  
11 - {% else %}  
12 - var pageNum = 0 ; // The latest page loaded  
13 - var numberPages = 0 ; // Indicates the number of pages  
14 - {% endif %}  
15 -  
16 - var baseUrl = '{% url "app:index" %}';  
17 -  
18 - // loadOnScroll handler  
19 - var loadOnScroll = function() {  
20 - // If the current scroll position is past out cutoff point...  
21 - if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {  
22 - // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row  
23 - $(window).unbind();  
24 - // execute the load function below that will visit the view and return the content  
25 - loadItems();  
26 - }  
27 - };  
28 -  
29 - var loadItems = function() {  
30 - // Check if page is equal to the number of pages  
31 - if (pageNum == numberPages) {  
32 - return false  
33 - }  
34 - // Update the page number  
35 - pageNum = pageNum + 1;  
36 -  
37 - $("#loading").show();  
38 - // Configure the url we're about to hit  
39 - setTimeout(function (){  
40 - $.ajax({  
41 - url: baseUrl,  
42 - data: {'page': pageNum},  
43 - success: function(data) {  
44 - $("#loading").hide();  
45 -  
46 - $("#timeline").append(data);  
47 - },  
48 - complete: function(data, textStatus){  
49 - // Turn the scroll monitor back on  
50 - $(window).bind('scroll', loadOnScroll);  
51 - }  
52 - });  
53 - }, 1000)  
54 - };  
55 -  
56 - $(document).ready(function(){  
57 - $(window).bind('scroll', loadOnScroll);  
58 - $.material.init();  
59 - }); 8 + {% if page_obj and paginator %}
  9 + var pageNum = {{ page_obj.number }}; // The latest page loaded
  10 + var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages
  11 + {% else %}
  12 + var pageNum = 0 ; // The latest page loaded
  13 + var numberPages = 0 ; // Indicates the number of pages
  14 + {% endif %}
  15 + var baseUrl = '{% url "app:index" %}';
60 </script> 16 </script>
  17 + <script type="text/javascript" src="{% static 'js/home.js' %}"></script>
61 {% endif %} 18 {% endif %}
62 {% endblock %} 19 {% endblock %}
63 20
@@ -96,7 +53,7 @@ @@ -96,7 +53,7 @@
96 53
97 {% endblock %} 54 {% endblock %}
98 {% if user|has_role:'system_admin' %} 55 {% if user|has_role:'system_admin' %}
99 - 56 +
100 <li> 57 <li>
101 <a href="#menu_users" class="accordion" data-toggle="collapse">{% trans 'Users' %}<span class="pull-right glyphicon glyphicon-chevron-down"></span></a> 58 <a href="#menu_users" class="accordion" data-toggle="collapse">{% trans 'Users' %}<span class="pull-right glyphicon glyphicon-chevron-down"></span></a>
102 <div id="menu_users" class="collapse"> 59 <div id="menu_users" class="collapse">
@@ -104,9 +61,9 @@ @@ -104,9 +61,9 @@
104 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> 61 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
105 <li> <a href="{% url 'users:create' %}">{% trans 'Create User' %}</a></li> 62 <li> <a href="{% url 'users:create' %}">{% trans 'Create User' %}</a></li>
106 </ul> 63 </ul>
107 - </div> 64 + </div>
108 </li> 65 </li>
109 - <li> 66 + <li>
110 <a href="#menu_settings" class="accordion" data-toggle="collapse">{% trans 'Settings' %}<span class="pull-right glyphicon glyphicon-chevron-down"></span></a> 67 <a href="#menu_settings" class="accordion" data-toggle="collapse">{% trans 'Settings' %}<span class="pull-right glyphicon glyphicon-chevron-down"></span></a>
111 <div id="menu_settings" class="collapse"> 68 <div id="menu_settings" class="collapse">
112 <ul class="nav nav-pill nav-stacked accordion_list"> 69 <ul class="nav nav-pill nav-stacked accordion_list">
core/static/css/base/amadeus.css
@@ -77,9 +77,6 @@ @@ -77,9 +77,6 @@
77 .end{ 77 .end{
78 text-align: right; 78 text-align: right;
79 } 79 }
80 -h5{  
81 - text-align: center;  
82 -}  
83 #img { 80 #img {
84 81
85 display: block; 82 display: block;
@@ -406,16 +403,19 @@ ul, li { @@ -406,16 +403,19 @@ ul, li {
406 -webkit-animation-timing-function: ease-in-out; 403 -webkit-animation-timing-function: ease-in-out;
407 } 404 }
408 /* Icon Topic */ 405 /* Icon Topic */
409 -.divMoreActions {text-align: right; height: 39px; float: right;}  
410 -.divMoreActions div button {padding-left: 10px; padding-right: 10px; padding-bottom: 10px; margin-bottom: 4px; height: 31px;}  
411 -.titleTopic {padding-top: 18px; padding-left: 0px;}  
412 -.titleTopic-detail {padding-top: 8px; color: white;}  
413 -.titleTopic a h4 {margin-top: 0px; color: black; cursor:pointer;} 406 +.divMoreActions {text-align: right; height: 59px; float: right;}
  407 +.moreAccordion {height: 59px;}
  408 +/*.divMoreActions div button {padding-left: 10px; padding-right: 10px; padding-bottom: 10px; margin-bottom: 4px; height: 31px;}*/
  409 +.divMoreActions , .moreAccordion{padding-top: 5px; padding-bottom: 5px;}
  410 +.moreAccordion button{margin-bottom: 0px; margin-top: 8px;}
  411 +.titleTopic {padding-top: 10px; padding-bottom: 10px;}
  412 +.titleTopic a h4, .titleTopic h4{color: white;}
  413 +.titleTopic a:hover{text-decoration: none;}
  414 +.Topic-detail a h4{color: black;}
  415 +/* .titleTopic a h4 {margin-top: 0px; color: black; cursor:pointer;}*/
414 .dropdown-menu .pull-right { 416 .dropdown-menu .pull-right {
415 right: 0; 417 right: 0;
416 } 418 }
417 -.moreAccordion{ padding-left: 0px; padding-right: 0px;}  
418 -.moreAccordion div button{ padding-left: 0px; padding-right: 0px;}  
419 .cards-content{ padding-left: 0px; padding-right: 0px; } 419 .cards-content{ padding-left: 0px; padding-right: 0px; }
420 .cards-detail{margin-left: 4%;} 420 .cards-detail{margin-left: 4%;}
421 .cards-detail .panel .panel-heading{/*background-color:;*/} 421 .cards-detail .panel .panel-heading{/*background-color:;*/}
courses/static/js/topic.js
@@ -20,7 +20,7 @@ function openTopic(url, topic, btn) { @@ -20,7 +20,7 @@ function openTopic(url, topic, btn) {
20 dataType: 'json', 20 dataType: 'json',
21 success: function (data) { 21 success: function (data) {
22 if (action == 'open') { 22 if (action == 'open') {
23 - $(".topic_" + topic).find(".log_id").val(data.log_id); 23 + $(".topic_" + topic).find(".log_id").val(data.log_id);
24 } 24 }
25 }, 25 },
26 error: function(data) { 26 error: function(data) {
courses/templates/course/course_card.html
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <div class="panel panel-info"> 3 <div class="panel panel-info">
4 <div class="panel-heading course"> 4 <div class="panel-heading course">
5 <div class="row"> 5 <div class="row">
6 - <div class="col-xs-5 col-md-5 titleTopic"> 6 + <div class="col-xs-6 col-md-6 titleTopic">
7 <a role="button" href="{% url 'course:view' course.slug %}"> 7 <a role="button" href="{% url 'course:view' course.slug %}">
8 <h4>{{course.name}}</h4> 8 <h4>{{course.name}}</h4>
9 </a> 9 </a>
courses/templates/course/view.html
@@ -23,30 +23,36 @@ @@ -23,30 +23,36 @@
23 {% block content %} 23 {% block content %}
24 24
25 <div class="col-md-12 cards-content"> 25 <div class="col-md-12 cards-content">
26 - <div class="panel panel-info">  
27 - <div class="panel-heading course-detail">  
28 - <div class="row">  
29 - <div class="col-xs-8 col-md-11 .titleTopic-detail">  
30 - <h4>{{course.name}}</h4>  
31 - </div>  
32 - {% if user|has_role:'professor' or user|has_role:'system_admin' %}  
33 - <div class="col-xs-4 col-md-1" id="divMoreActions"> 26 + <div class="group course-card ">
  27 + <div class="panel panel-info">
  28 + <div class="panel-heading course">
  29 + <div class="row">
  30 + <div class="col-xs-6 col-md-6 titleTopic">
  31 + <h4>{{course.name}}</h4>
  32 + </div>
  33 + {% if user|has_role:'professor' or user|has_role:'system_admin' %}
  34 + <div class="col-xs-6 col-md-6 divMoreActions" >
34 <div class="btn-group"> 35 <div class="btn-group">
35 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 36 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
36 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> 37 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
37 - <div class="ripple-container"></div></button> 38 + </button>
38 <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> 39 <ul class="dropdown-menu pull-right" aria-labelledby="moreActions">
39 - <li><a href="{% url 'course:replicate_course' course.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Replicate" %}</a></li>  
40 - <li><a href="{% url 'course:update' course.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Edit" %}</a></li>  
41 - <li><a href="javascript:javascript:delete_course('{% url 'course:delete' course.slug %}', '{{ course.slug }}', '{% trans "Are you sure you want to delete this course?" %}', '{% url 'course:manage' %}')" data-toggle="modal" data-target="#myModal2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp; {% trans "Remove" %}</a></li> 40 + <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>
  41 + <li><a href="{% url 'course:update' course.slug %}"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i>{% trans 'Edit' %}</a></li>
  42 + <li><a href="javascript:delete_course.get('{% url 'course:delete' course.slug %}','#course','#modal_course')"><i class="fa fa-trash fa-fw" aria-hidden="true"></i>&nbsp;{% trans 'Remove' %}</a></li>
42 </ul> 43 </ul>
43 </div> 44 </div>
44 </div> 45 </div>
  46 + {% elif user|has_role:'student' %}
  47 + {% if not request.user in course.students.all %}
  48 + <a onclick="subscribe($(this), '{% url 'course:subscribe' course.slug %}', {{ course.id}}, '{% trans 'Are you sure you want to subscribe to this course?' %}')"><button class="btn btn-sm btn-primary btn-raised pull-right">{% trans 'Subscribe' %}</button></a>
  49 + {% endif %}
45 {% endif %} 50 {% endif %}
  51 + </div>
  52 + </div>
  53 + <div class="panel-body">
  54 + <p><b>{% trans 'Coordinator' %}: </b>{{course.coordenator}}</p>
46 </div> 55 </div>
47 - </div>  
48 - <div class="panel-body">  
49 - <p><b>{% trans 'Coordinator' %}: </b>{{course.coordenator}}</p>  
50 </div> 56 </div>
51 </div> 57 </div>
52 58
@@ -70,18 +76,18 @@ @@ -70,18 +76,18 @@
70 </div> 76 </div>
71 77
72 <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false"></div> 78 <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false"></div>
73 -<div class="cards-detail"> 79 + <div class="cards-detail">
74 {% for subject in subjects %} 80 {% for subject in subjects %}
75 <div class="panel panel-default panel_{{ subject.id }}"> 81 <div class="panel panel-default panel_{{ subject.id }}">
76 <div class="panel-heading heading_{{subject.id}} subject ui-sortable-handle"> 82 <div class="panel-heading heading_{{subject.id}} subject ui-sortable-handle">
77 <div class="row"> 83 <div class="row">
78 - <div class="col-xs-9 col-md-10 titleTopic"> 84 + <div class="col-xs-9 col-md-6 titleTopic">
79 <a role="button" href="{% url 'course:view_subject' subject.slug %}"> 85 <a role="button" href="{% url 'course:view_subject' subject.slug %}">
80 <h4>{{subject.name}}</h4> 86 <h4>{{subject.name}}</h4>
81 </a> 87 </a>
82 </div> 88 </div>
83 {% if user|has_role:'professor' or user|has_role:'system_admin' %} 89 {% if user|has_role:'professor' or user|has_role:'system_admin' %}
84 - <div class="col-xs-3 col-md-1" id="divMoreActions"> 90 + <div class="col-xs-3 col-md-6 divMoreActions">
85 <div class="btn-group"> 91 <div class="btn-group">
86 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 92 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
87 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> 93 <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i>
courses/templates/subject/form_view_student.html
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </p> 33 </p>
34 34
35 </div> 35 </div>
36 - 36 +
37 37
38 {% if not professor_links %} 38 {% if not professor_links %}
39 <div class="row"> 39 <div class="row">
courses/templates/subject/form_view_teacher.html
@@ -6,9 +6,9 @@ @@ -6,9 +6,9 @@
6 <div class="panel-heading topic"> 6 <div class="panel-heading topic">
7 <div class="row"> 7 <div class="row">
8 <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}}"> 8 <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}}">
9 - <button class="btn btn-default btn-sm caret-square" onclick="openTopic('{% url 'course:topic_log' topic.id %}', '{{topic.id}}', $(this));"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button> 9 + <button class="btn btn-default btn-sm caret-square" onclick="openTopic('{% url 'course:topic_log' topic.id %}', '{{topic.id}}', $(this));"><i class="fa fa-angle-down fa-2x" aria-hidden="true"></i></button>
10 </div> 10 </div>
11 - <div class="col-xs-9 col-md-9 titleTopic"> 11 + <div class="col-xs-9 col-md-9 titleTopic Topic-detail">
12 <a href="{% url 'course:view_topic' topic.slug %}" role="button"> 12 <a href="{% url 'course:view_topic' topic.slug %}" role="button">
13 <h4>{{topic}}</h4> 13 <h4>{{topic}}</h4>
14 </a> 14 </a>
courses/templates/subject/index.html
@@ -19,14 +19,13 @@ @@ -19,14 +19,13 @@
19 19
20 {% block content %} 20 {% block content %}
21 <div class="panel panel-info"> 21 <div class="panel panel-info">
22 - <div class="panel-heading course-detail"> 22 + <div class="panel-heading course">
23 <div class="row"> 23 <div class="row">
24 - <div class="col-md-10 col-sm-10"> 24 + <div class="col-xs-6 col-md-6 titleTopic">
25 <h4>{{subject}}</h4> 25 <h4>{{subject}}</h4>
26 </div> 26 </div>
27 -  
28 {# dropdown de subject com as opções de replicar, editar e deletar #} 27 {# dropdown de subject com as opções de replicar, editar e deletar #}
29 - <div class="col-xs-4 col-md-2 divMoreActions"> 28 + <div class="col-xs-6 col-md-6 divMoreActions">
30 {% professor_subject subject user as subject_professor%} 29 {% professor_subject subject user as subject_professor%}
31 {% if subject_professor %} 30 {% if subject_professor %}
32 <div class="btn-group"> 31 <div class="btn-group">
@@ -41,10 +40,8 @@ @@ -41,10 +40,8 @@
41 </div> 40 </div>
42 {% endif %} 41 {% endif %}
43 </div> 42 </div>
44 -  
45 </div> 43 </div>
46 </div> 44 </div>
47 -  
48 {# informações do subject(professor, descrição etc) #} 45 {# informações do subject(professor, descrição etc) #}
49 <div class="panel-body"> 46 <div class="panel-body">
50 <p><b>{% trans "Professor" %}:</b> {% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} 47 <p><b>{% trans "Professor" %}:</b> {% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %}
@@ -62,7 +59,6 @@ @@ -62,7 +59,6 @@
62 </div> 59 </div>
63 </div> 60 </div>
64 </div> 61 </div>
65 -  
66 </div> 62 </div>
67 63
68 {# lista de tópicos #} 64 {# lista de tópicos #}
courses/templates/topic/index.html
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 <div class="panel-heading"> 22 <div class="panel-heading">
23 <div class="row"> 23 <div class="row">
24 <div class="col-md-10 col-sm-7"> 24 <div class="col-md-10 col-sm-7">
25 - <h3> {{topic.name}} </h3> 25 + <h3> {{topic.name}}</h3>
26 </div> 26 </div>
27 <div class="col-xs-4 col-md-2 divMoreActions"> 27 <div class="col-xs-4 col-md-2 divMoreActions">
28 {% professor_subject subject user as permissions%} 28 {% professor_subject subject user as permissions%}
@@ -110,8 +110,8 @@ @@ -110,8 +110,8 @@
110 </div> 110 </div>
111 </div> 111 </div>
112 <div class="col-md-6"> 112 <div class="col-md-6">
113 - <h3>{% trans 'Students - Specific Exercises' %}</h3>  
114 - <br/> 113 + <h3>{% trans 'Students - Specific Exercises' %}</h3>
  114 + <br/>
115 </div> 115 </div>
116 {# mostra a lista de usuários caso seja um professor ou admin #} 116 {# mostra a lista de usuários caso seja um professor ou admin #}
117 {% if user|has_role:'professor' or user|has_role:'system_admin' %} 117 {% if user|has_role:'professor' or user|has_role:'system_admin' %}