Commit 74e082e13997b8e03e49b909d5ee5509564e14e5

Authored by Jailson Dias
2 parents 0967b82c eda3e645

Merge branch 'refactoring' of https://github.com/amadeusproject/amadeuslms into refactoring

amadeus/templates/base.html
@@ -145,7 +145,7 @@ @@ -145,7 +145,7 @@
145 </ul> 145 </ul>
146 </li> 146 </li>
147 <li style="width:40px;"> 147 <li style="width:40px;">
148 - <a href="" id="contrast_button"> 148 + <a href="{% url 'themes:contrast' %}" id="contrast_button">
149 <i style="font-size:15px;right: 150%;" class="glyphicon glyphicon-adjust"></i> 149 <i style="font-size:15px;right: 150%;" class="glyphicon glyphicon-adjust"></i>
150 </a> 150 </a>
151 151
@@ -209,11 +209,11 @@ @@ -209,11 +209,11 @@
209 $("#contrast_button" ).click(function() { 209 $("#contrast_button" ).click(function() {
210 if (Cookies.get('contrast_check')) { 210 if (Cookies.get('contrast_check')) {
211 Cookies.remove('contrast_check') 211 Cookies.remove('contrast_check')
212 - location.reload() 212 + //location.reload()
213 } 213 }
214 else { 214 else {
215 Cookies.set('contrast_check','contrast') 215 Cookies.set('contrast_check','contrast')
216 - location.reload() 216 + //location.reload()
217 } 217 }
218 218
219 }); 219 });
analytics/static/.sass-cache/01cecb7b42e56765f6ed49ed3c70281ebdc742c7/general.sassc 0 → 100644
No preview for this file type
analytics/static/analytics/general.css
@@ -3,7 +3,8 @@ @@ -3,7 +3,8 @@
3 border-radius: 20px; 3 border-radius: 20px;
4 padding: 10px; 4 padding: 10px;
5 overflow: auto; 5 overflow: auto;
6 - width: 100%; } 6 + width: 100%;
  7 + background-color: #ffffff; }
7 8
8 #general-report-header { 9 #general-report-header {
9 height: 10%; 10 height: 10%;
@@ -14,21 +15,22 @@ @@ -14,21 +15,22 @@
14 float: right; 15 float: right;
15 display: inline-flex; 16 display: inline-flex;
16 width: 50%; 17 width: 50%;
17 - height: 15%; } 18 + margin-bottom: 0px; }
18 #general-report-header ul li { 19 #general-report-header ul li {
19 margin-right: 2%; 20 margin-right: 2%;
20 width: 50%; 21 width: 50%;
21 - color: white; }  
22 - #general-report-header ul li div.selected {  
23 - background-color: #4dcfbd;  
24 - width: 100%;  
25 - text-align: center;  
26 - border-radius: 20px; }  
27 - #general-report-header ul li div {  
28 - background-color: #0f8a9a;  
29 - width: 100%;  
30 - text-align: center;  
31 - border-radius: 20px; } 22 + color: white;
  23 + font-size: 20px;
  24 + background-color: #0f8a9a;
  25 + width: 100%;
  26 + text-align: center;
  27 + border-radius: 20px;
  28 + height: 30px; }
  29 + #general-report-header ul li.selected {
  30 + background-color: #4dcfbd;
  31 + width: 100%;
  32 + text-align: center;
  33 + border-radius: 20px; }
32 34
33 #most-used-tags-header { 35 #most-used-tags-header {
34 background: linear-gradient(to right, #0e8999, #6bf0ce); 36 background: linear-gradient(to right, #0e8999, #6bf0ce);
@@ -40,21 +42,19 @@ @@ -40,21 +42,19 @@
40 #most-used-tags-header h4 { 42 #most-used-tags-header h4 {
41 margin-left: 1%; } 43 margin-left: 1%; }
42 44
43 -.data-container {  
44 - width: 80px;  
45 - height: 40px; }  
46 -  
47 .tag-cloud { 45 .tag-cloud {
48 border-radius: 25px; 46 border-radius: 25px;
49 - color: #ffffff;  
50 - width: 80px; } 47 + color: #ffffff; }
51 48
52 .tag-name { 49 .tag-name {
53 color: #ffffff; 50 color: #ffffff;
54 font-size: 10px; } 51 font-size: 10px; }
55 52
56 #left-data-selector { 53 #left-data-selector {
57 - background: linear-gradient(#0e8999, #6bf0ce); } 54 + background: linear-gradient(#0e8999, #6bf0ce);
  55 + margin-top: 5%;
  56 + padding-top: 3%;
  57 + padding-bottom: 2%; }
58 58
59 .chart { 59 .chart {
60 width: 30%; 60 width: 30%;
@@ -64,11 +64,11 @@ @@ -64,11 +64,11 @@
64 64
65 .selector { 65 .selector {
66 width: 90%; 66 width: 90%;
67 - height: 20%; 67 + height: 40px;
68 color: white; 68 color: white;
69 padding-left: 5px; 69 padding-left: 5px;
70 background-color: #009688; 70 background-color: #009688;
71 - margin-top: 10px; 71 + margin-top: 5px;
72 border-radius: 0px 20px 20px 0px; } 72 border-radius: 0px 20px 20px 0px; }
73 .selector p { 73 .selector p {
74 padding-top: 10px; 74 padding-top: 10px;
@@ -87,13 +87,31 @@ @@ -87,13 +87,31 @@
87 background-color: #52b7bd; 87 background-color: #52b7bd;
88 width: 80%; 88 width: 80%;
89 margin-left: 2%; 89 margin-left: 2%;
90 - margin-top: 2%; 90 + margin-top: 4%;
  91 + position: relative;
91 padding-left: 0; 92 padding-left: 0;
92 color: white; 93 color: white;
  94 + border: 2px solid #52b7bd;
93 transition: width 2s, height 2s, background-color 2s, transform 2s; } 95 transition: width 2s, height 2s, background-color 2s, transform 2s; }
94 .most-accessed-list li { 96 .most-accessed-list li {
95 padding-left: 1%; } 97 padding-left: 1%; }
96 98
  99 +.most-accessed-list:after, .most-accessed-list:before {
  100 + bottom: 100%;
  101 + left: 50%;
  102 + border: solid transparent;
  103 + content: " ";
  104 + height: 0;
  105 + width: 0;
  106 + position: absolute;
  107 + pointer-events: none; }
  108 +
  109 +.most-accessed-list:before {
  110 + border-width: 12px;
  111 + margin-left: -50%;
  112 + border-color: rgba(136, 183, 213, 0);
  113 + border-bottom-color: #52b7bd; }
  114 +
97 .most-accessed-item:hover { 115 .most-accessed-item:hover {
98 background-color: #3aa7ad; } 116 background-color: #3aa7ad; }
99 117
analytics/static/analytics/general.css.map
1 { 1 {
2 "version": 3, 2 "version": 3,
3 -"mappings": "AAEA,YAAY;EACR,MAAM,EAAE,iBAAiB;EACzB,aAAa,EAAE,IAAI;EACnB,OAAO,EAAE,IAAI;EACb,QAAQ,EAAE,IAAI;EACd,KAAK,EAAE,IAAI;;AAEf,sBAAsB;EAClB,MAAM,EAAE,GAAG;EACX,OAAO,EAAE,KAAK;EACd,yBAAE;IACE,KAAK,EAbC,OAAO;EAejB,yBAAE;IACE,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IAEX,4BAAE;MACE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;EACpC,mBAAmB,EAAE,OAAO;;AAEhC,yBAAyB;EACrB,gBAAgB,EAAE,OAAO",
4 "sources": ["general.sass"], 4 "sources": ["general.sass"],
5 "names": [], 5 "names": [],
6 "file": "general.css" 6 "file": "general.css"
analytics/static/analytics/general.sass
@@ -6,6 +6,7 @@ $title-color: #009688 @@ -6,6 +6,7 @@ $title-color: #009688
6 padding: 10px 6 padding: 10px
7 overflow: auto 7 overflow: auto
8 width: 100% 8 width: 100%
  9 + background-color: #ffffff
9 10
10 #general-report-header 11 #general-report-header
11 height: 10% 12 height: 10%
@@ -17,25 +18,28 @@ $title-color: #009688 @@ -17,25 +18,28 @@ $title-color: #009688
17 float: right 18 float: right
18 display: inline-flex 19 display: inline-flex
19 width: 50% 20 width: 50%
20 - height: 15% 21 + margin-bottom: 0px
21 22
22 li 23 li
23 margin-right: 2% 24 margin-right: 2%
24 width: 50% 25 width: 50%
25 color: white 26 color: white
  27 + font-size: 20px
  28 + background-color: #0f8a9a
  29 + width: 100%
  30 + text-align: center
  31 + border-radius: 20px
  32 + height: 30px
26 33
27 - div.selected  
28 - background-color: #4dcfbd  
29 - width: 100%  
30 - text-align: center  
31 - border-radius: 20px  
32 34
33 - div  
34 - background-color: #0f8a9a  
35 - width: 100%  
36 - text-align: center  
37 - border-radius: 20px 35 + li.selected
  36 + background-color: #4dcfbd
  37 + width: 100%
  38 + text-align: center
  39 + border-radius: 20px
38 40
  41 +
  42 +
39 43
40 44
41 #most-used-tags-header 45 #most-used-tags-header
@@ -49,14 +53,11 @@ $title-color: #009688 @@ -49,14 +53,11 @@ $title-color: #009688
49 h4 53 h4
50 margin-left: 1% 54 margin-left: 1%
51 55
52 -.data-container  
53 - width: 80px  
54 - height: 40px  
55 56
56 .tag-cloud 57 .tag-cloud
57 border-radius: 25px 58 border-radius: 25px
58 color: #ffffff 59 color: #ffffff
59 - width: 80px 60 +
60 61
61 62
62 63
@@ -67,6 +68,9 @@ $title-color: #009688 @@ -67,6 +68,9 @@ $title-color: #009688
67 68
68 #left-data-selector 69 #left-data-selector
69 background: linear-gradient( #0e8999, #6bf0ce ) 70 background: linear-gradient( #0e8999, #6bf0ce )
  71 + margin-top: 5%
  72 + padding-top: 3%
  73 + padding-bottom: 2%
70 74
71 .chart 75 .chart
72 width: 30% 76 width: 30%
@@ -76,11 +80,11 @@ $title-color: #009688 @@ -76,11 +80,11 @@ $title-color: #009688
76 80
77 .selector 81 .selector
78 width: 90% 82 width: 90%
79 - height: 20% 83 + height: 40px
80 color: white 84 color: white
81 padding-left: 5px 85 padding-left: 5px
82 background-color: #009688 86 background-color: #009688
83 - margin-top: 10px 87 + margin-top: 5px
84 border-radius: 0px 20px 20px 0px 88 border-radius: 0px 20px 20px 0px
85 p 89 p
86 padding-top: 10px 90 padding-top: 10px
@@ -101,13 +105,32 @@ $title-color: #009688 @@ -101,13 +105,32 @@ $title-color: #009688
101 background-color: #52b7bd 105 background-color: #52b7bd
102 width: 80% 106 width: 80%
103 margin-left: 2% 107 margin-left: 2%
104 - margin-top: 2% 108 + margin-top: 4%
  109 + position: relative
105 padding-left: 0 110 padding-left: 0
106 color: white 111 color: white
  112 + border: 2px solid #52b7bd
107 transition: width 2s, height 2s, background-color 2s, transform 2s 113 transition: width 2s, height 2s, background-color 2s, transform 2s
108 114
109 li 115 li
110 padding-left: 1% 116 padding-left: 1%
111 117
  118 +.most-accessed-list:after, .most-accessed-list:before
  119 + bottom: 100%
  120 + left: 50%
  121 + border: solid transparent
  122 + content: " "
  123 + height: 0
  124 + width: 0
  125 + position: absolute
  126 + pointer-events: none
  127 +
  128 +
  129 +.most-accessed-list:before
  130 + border-width: 12px
  131 + margin-left: -50%
  132 + border-color: rgba(136, 183, 213, 0)
  133 + border-bottom-color: #52b7bd
  134 +
112 .most-accessed-item:hover 135 .most-accessed-item:hover
113 background-color: #3aa7ad 136 background-color: #3aa7ad
114 \ No newline at end of file 137 \ No newline at end of file
analytics/static/analytics/js/behavior.js
@@ -56,20 +56,13 @@ var selectors_options = { @@ -56,20 +56,13 @@ var selectors_options = {
56 56
57 $(e).after(string_build); 57 $(e).after(string_build);
58 var new_elem = $(e).next(); 58 var new_elem = $(e).next();
59 - new_elem.slideDown(); 59 + new_elem.slideDown({easing: 'easeInOutSine'}, 5000);
60 $(e).attr("opened", true); 60 $(e).attr("opened", true);
61 61
62 }, 62 },
63 deleteChildren: function(e){ 63 deleteChildren: function(e){
64 - console.log("delete children");  
65 var most_accessed_list = $(e).next(); 64 var most_accessed_list = $(e).next();
66 - $(most_accessed_list).animate(  
67 - {height: 0,  
68 - opacity: 0.1  
69 - }, 1000, function(){  
70 - $(this).remove(); //remove list from UI  
71 - });  
72 - 65 + $(most_accessed_list).slideUp({easing: 'easeInOutSine'}, 1200);
73 $(e).removeAttr("opened"); //remove attribute so it can call API again 66 $(e).removeAttr("opened"); //remove attribute so it can call API again
74 }, 67 },
75 }; 68 };
analytics/static/analytics/js/charts.js
@@ -208,17 +208,17 @@ var charts = { @@ -208,17 +208,17 @@ var charts = {
208 208
209 groups.on("mouseover", function(d){ 209 groups.on("mouseover", function(d){
210 //$("#"+"user_tooltip_"+d['user_id']).show(); 210 //$("#"+"user_tooltip_"+d['user_id']).show();
211 - tooltip_div.transition().duration(200).style("opacity", .9); 211 + tooltip_div.transition().duration(500).style("opacity", .9);
212 tooltip_div.html(d['user'] + '</br>' + d['count'] + ' acessos') 212 tooltip_div.html(d['user'] + '</br>' + d['count'] + ' acessos')
213 .style("left", (d3.event.pageX) + "px") 213 .style("left", (d3.event.pageX) + "px")
214 .style("top", (d3.event.pageY - 28) + "px"); 214 .style("top", (d3.event.pageY - 28) + "px");
215 - console.log(d3.event.pageX);  
216 - console.log(d3.event.pageY);  
217 }); 215 });
218 216
219 217
220 groups.on("mouseout", function(d){ 218 groups.on("mouseout", function(d){
221 //$("#"+"user_tooltip_"+d['user_id']).hide(); 219 //$("#"+"user_tooltip_"+d['user_id']).hide();
  220 + tooltip_div.transition().duration(500).style("opacity", 0);
  221 +
222 }); 222 });
223 223
224 224
@@ -253,7 +253,6 @@ var charts = { @@ -253,7 +253,6 @@ var charts = {
253 simulation.nodes(dataset) 253 simulation.nodes(dataset)
254 .on('tick', ticked); //so all data points are attached to it 254 .on('tick', ticked); //so all data points are attached to it
255 255
256 - console.log("finished simulation");  
257 function ticked(){ 256 function ticked(){
258 groups.attr("transform", function(d){ 257 groups.attr("transform", function(d){
259 return "translate(" + d.x + "," + d.y + ")"; 258 return "translate(" + d.x + "," + d.y + ")";
@@ -371,7 +370,6 @@ var charts = { @@ -371,7 +370,6 @@ var charts = {
371 return maximum 370 return maximum
372 } 371 }
373 372
374 - console.log(dataset);  
375 373
376 var container_div = d3.select("#most-used-tags-body"); 374 var container_div = d3.select("#most-used-tags-body");
377 var svg = container_div.append("svg").attr("width", "100%").attr("height", height) 375 var svg = container_div.append("svg").attr("width", "100%").attr("height", height)
@@ -394,7 +392,7 @@ var charts = { @@ -394,7 +392,7 @@ var charts = {
394 return Math.floor(Math.random() * (max - min)) + min; 392 return Math.floor(Math.random() * (max - min)) + min;
395 } 393 }
396 394
397 - var xScale = d3.scaleSqrt().domain([min(), max()]).range([10,50]); 395 + var xScale = d3.scaleSqrt().domain([min(), max()]).range([10,80]);
398 var tag_cloud = svg.selectAll('.tag-cloud-div') 396 var tag_cloud = svg.selectAll('.tag-cloud-div')
399 .data(dataset) 397 .data(dataset)
400 .enter() 398 .enter()
@@ -409,7 +407,7 @@ var charts = { @@ -409,7 +407,7 @@ var charts = {
409 return xScale(d['count'])*1.2; 407 return xScale(d['count'])*1.2;
410 }) 408 })
411 .attr("height", function(d){ 409 .attr("height", function(d){
412 - return xScale(d["count"])*0.8; 410 + return xScale(d["count"])*0.4;
413 }) 411 })
414 .attr("fill", function(d, i) { 412 .attr("fill", function(d, i) {
415 return color(getRandomInt(0,3)); 413 return color(getRandomInt(0,3));
@@ -422,8 +420,12 @@ var charts = { @@ -422,8 +420,12 @@ var charts = {
422 .text(function(d){ 420 .text(function(d){
423 return d['name']; 421 return d['name'];
424 }) 422 })
425 - .attr("x", 20)  
426 - .attr("y", 25) 423 + .attr("x", function(d){
  424 + return xScale(d['count'])*0.2;
  425 + })
  426 + .attr("y", function(d){
  427 + return xScale(d["count"])*0.2;
  428 + })
427 .attr("class", "tag-name") 429 .attr("class", "tag-name")
428 .attr("fill", "#ffffff"); 430 .attr("fill", "#ffffff");
429 431
@@ -432,7 +434,7 @@ var charts = { @@ -432,7 +434,7 @@ var charts = {
432 .force("x", d3.forceX(width/2).strength(0.05)) 434 .force("x", d3.forceX(width/2).strength(0.05))
433 .force("y", d3.forceY(height/2).strength(0.05)) 435 .force("y", d3.forceY(height/2).strength(0.05))
434 .force("collide", d3.forceCollide(function(d){ 436 .force("collide", d3.forceCollide(function(d){
435 - return 30; 437 + return xScale(d['count'])*0.4;
436 })); 438 }));
437 439
438 //simulation 440 //simulation
analytics/templates/analytics/category.html 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +{% extends 'base.html' %}
  2 +
  3 +{% load static i18n pagination %}
  4 +{% load django_bootstrap_breadcrumbs %}
  5 +{% block style %}
  6 + <link rel="stylesheet" type="text/css" href="{% static 'analytics/general.css' %}">
  7 +{% endblock style %}
  8 +
  9 +{% block javascript %}
  10 + <script type="text/javascript" src="{% static "analytics/js/charts.js" %}"></script>
  11 + <script type="text/javascript" src=" {% static "analytics/js/behavior.js" %} "></script>
  12 +{% endblock javascript %}
  13 +
  14 +{% block breadcrumbs %}
  15 + {{ block.super }}
  16 +
  17 + {% trans 'Analytics Category' as category %}
  18 +
  19 + {% breadcrumb category 'dashboard:view_general' %}
  20 +{% endblock %}
  21 +
  22 +
  23 +{% block content %}
  24 + test
  25 +{% endblock content %}
0 \ No newline at end of file 26 \ No newline at end of file
analytics/templates/analytics/general.html
@@ -24,15 +24,17 @@ @@ -24,15 +24,17 @@
24 <section id="core-subjects-options-div"> 24 <section id="core-subjects-options-div">
25 <nav> 25 <nav>
26 <ul class="core-subjects-options report-menu-choice"> 26 <ul class="core-subjects-options report-menu-choice">
27 - <li class="active">  
28 - {% trans "Platform Report" %}  
29 - </li>  
30 - <li>  
31 - {% trans "Category Report" %}  
32 - </li>  
33 - <li>  
34 - {% trans "Subject Report" %}  
35 - </li> 27 +
  28 + <li class="active">
  29 + {% trans "Platform Report" %}
  30 + </li>
  31 + <li>
  32 + {% trans "Category Report" %}
  33 + </li>
  34 + <li>
  35 + {% trans "Subject Report" %}
  36 + </li>
  37 +
36 </ul> 38 </ul>
37 </nav> 39 </nav>
38 </section> 40 </section>
@@ -42,11 +44,11 @@ @@ -42,11 +44,11 @@
42 <h3>{% trans "Amadeus Report" %}</h3> 44 <h3>{% trans "Amadeus Report" %}</h3>
43 45
44 <ul id="report-header-options"> 46 <ul id="report-header-options">
45 - <li >  
46 - <div class="selected">{% trans "Focus" %}<div> 47 + <li class="selected">
  48 + {% trans "Focus" %}
47 </li> 49 </li>
48 <li> 50 <li>
49 - <div>{% trans "Log" %}<div> 51 + {% trans "Log" %}
50 </li> 52 </li>
51 </ul> 53 </ul>
52 </header> 54 </header>
@@ -65,10 +67,7 @@ @@ -65,10 +67,7 @@
65 </section> 67 </section>
66 <section class="bottom-section"> 68 <section class="bottom-section">
67 <div class="chart left-chart"> 69 <div class="chart left-chart">
68 - <div id="date-selector">  
69 - <p>{% trans "Between" %} 20-20-17 {% trans "and" %}  
70 - 20-20-17</p>  
71 - </div> 70 +
72 71
73 <div id="left-data-selector"> 72 <div id="left-data-selector">
74 73
analytics/views.py
1 from django.shortcuts import render 1 from django.shortcuts import render
2 2
3 -# Create your views here.  
4 from django.views import generic 3 from django.views import generic
5 from django.db.models import Count 4 from django.db.models import Count
  5 +from django.core.urlresolvers import reverse_lazy
6 6
7 from subjects.models import Tag, Subject 7 from subjects.models import Tag, Subject
8 from topics.models import Resource 8 from topics.models import Resource
9 from users.models import User 9 from users.models import User
10 from django.http import HttpResponse, JsonResponse 10 from django.http import HttpResponse, JsonResponse
11 from log.models import Log 11 from log.models import Log
  12 +import operator
  13 +from django.utils.translation import ugettext_lazy as _
  14 +from django.shortcuts import render, get_object_or_404, redirect
12 15
13 16
14 class GeneralView(generic.TemplateView): 17 class GeneralView(generic.TemplateView):
15 template_name = "analytics/general.html" 18 template_name = "analytics/general.html"
16 19
  20 + def dispatch(self, request, *args, **kwargs):
  21 +
  22 + if not request.user.is_staff:
  23 + self.template_name = "analytics/category.html"
  24 + return super(GeneralView, self).dispatch(request, *args, **kwargs)
  25 +
  26 +
17 def get_context_data(self, **kwargs): 27 def get_context_data(self, **kwargs):
18 context = {} 28 context = {}
19 29
@@ -70,7 +80,7 @@ def most_accessed_subjects(request): @@ -70,7 +80,7 @@ def most_accessed_subjects(request):
70 80
71 #order the values of the dictionary by the count in descendent order 81 #order the values of the dictionary by the count in descendent order
72 subjects = sorted(subjects.values(), key = lambda x: x['count'], reverse=True ) 82 subjects = sorted(subjects.values(), key = lambda x: x['count'], reverse=True )
73 - subjects = subjects[:30] 83 + subjects = subjects[:5]
74 84
75 return JsonResponse(subjects, safe=False) 85 return JsonResponse(subjects, safe=False)
76 86
@@ -94,10 +104,17 @@ def most_accessed_categories(request): @@ -94,10 +104,17 @@ def most_accessed_categories(request):
94 return JsonResponse(categories, safe= False) 104 return JsonResponse(categories, safe= False)
95 105
96 def most_accessed_resource_kind(request): 106 def most_accessed_resource_kind(request):
97 - resources_names = [cls.__name__ for cls in Resource.__subclasses__()]  
98 - print(resources_names)  
99 - resources = {} 107 + resources = Resource.objects.distinct()
100 108
  109 + data = {}
  110 + for resource in resources:
  111 + key = resource.__dict__['_my_subclass']
  112 + if key in data.keys():
  113 + data[key]['count'] = data[key]['count'] + 1
  114 + else:
  115 + data[key] = {'name': key, 'count': 1}
  116 +
  117 + data = sorted(data.values(), key = lambda x: x['count'], reverse= True)
101 mapping = {} 118 mapping = {}
102 mapping['pdffile'] = str(_('PDF File')) 119 mapping['pdffile'] = str(_('PDF File'))
103 mapping['goals'] = str(_('Topic Goals')) 120 mapping['goals'] = str(_('Topic Goals'))
@@ -107,10 +124,9 @@ def most_accessed_resource_kind(request): @@ -107,10 +124,9 @@ def most_accessed_resource_kind(request):
107 mapping['ytvideo'] = str(_('YouTube Video')) 124 mapping['ytvideo'] = str(_('YouTube Video'))
108 mapping['webpage'] = str(_('WebPage')) 125 mapping['webpage'] = str(_('WebPage'))
109 126
110 -  
111 -  
112 -  
113 - return JsonResponse(resources, safe = False) 127 + data = [ {'name': mapping[resource['name']] , 'count': resource['count']} for resource in data]
  128 + data = data[:5]
  129 + return JsonResponse(data, safe=False)
114 130
115 131
116 def most_active_users(request): 132 def most_active_users(request):
themes/urls.py
@@ -5,4 +5,5 @@ urlpatterns = [ @@ -5,4 +5,5 @@ urlpatterns = [
5 url(r'^$', views.IndexView.as_view(), name = 'manage'), 5 url(r'^$', views.IndexView.as_view(), name = 'manage'),
6 url(r'^basic_elements$', views.BasicElementsSettings.as_view(), name = 'basic'), 6 url(r'^basic_elements$', views.BasicElementsSettings.as_view(), name = 'basic'),
7 url(r'^css_selector$', views.CSSStyleSettings.as_view(), name = 'css'), 7 url(r'^css_selector$', views.CSSStyleSettings.as_view(), name = 'css'),
  8 + url(r'^contrast$',views.Contrast, name = 'contrast'),
8 ] 9 ]
themes/views.py
@@ -5,7 +5,7 @@ from django.core.urlresolvers import reverse, reverse_lazy @@ -5,7 +5,7 @@ from django.core.urlresolvers import reverse, reverse_lazy
5 from django.utils.translation import ugettext_lazy as _ 5 from django.utils.translation import ugettext_lazy as _
6 from django.http import HttpResponse, JsonResponse, HttpResponseRedirect,HttpRequest 6 from django.http import HttpResponse, JsonResponse, HttpResponseRedirect,HttpRequest
7 from django.shortcuts import redirect 7 from django.shortcuts import redirect
8 - 8 +from log.decorators import log_decorator
9 from braces import views as braces_mixins 9 from braces import views as braces_mixins
10 10
11 from .models import Themes 11 from .models import Themes
@@ -79,3 +79,8 @@ class CSSStyleSettings(braces_mixins.LoginRequiredMixin, braces_mixins.Staffuser @@ -79,3 +79,8 @@ class CSSStyleSettings(braces_mixins.LoginRequiredMixin, braces_mixins.Staffuser
79 context['settings_menu_active'] = "settings_menu_active" 79 context['settings_menu_active'] = "settings_menu_active"
80 80
81 return context 81 return context
  82 +
  83 +@log_decorator("contrast", "click", "contrast")
  84 +def Contrast(request):
  85 + caminho = request.META.get('HTTP_REFERER')
  86 + return HttpResponseRedirect(caminho)
topics/urls.py
@@ -10,5 +10,4 @@ urlpatterns = [ @@ -10,5 +10,4 @@ urlpatterns = [
10 url(r'^view_log/(?P<topic>[\w_-]+)/$', views.topic_view_log, name = 'view_log'), 10 url(r'^view_log/(?P<topic>[\w_-]+)/$', views.topic_view_log, name = 'view_log'),
11 url(r'^update_order/$', views.update_order, name = 'update_order'), 11 url(r'^update_order/$', views.update_order, name = 'update_order'),
12 url(r'^update_resource_order/$', views.update_resource_order, name = 'update_resource_order'), 12 url(r'^update_resource_order/$', views.update_resource_order, name = 'update_resource_order'),
13 - url(r'^count_resources/$', views.getResourceCount, name='resource_count'),  
14 ] 13 ]
topics/views.py
@@ -20,7 +20,6 @@ from subjects.models import Subject @@ -20,7 +20,6 @@ from subjects.models import Subject
20 from .models import Topic, Resource 20 from .models import Topic, Resource
21 from .forms import TopicForm 21 from .forms import TopicForm
22 22
23 -import operator  
24 23
25 class CreateView(LoginRequiredMixin, LogMixin, generic.edit.CreateView): 24 class CreateView(LoginRequiredMixin, LogMixin, generic.edit.CreateView):
26 log_component = 'topic' 25 log_component = 'topic'
@@ -276,27 +275,3 @@ def update_resource_order(request): @@ -276,27 +275,3 @@ def update_resource_order(request):
276 return JsonResponse({'message': 'No data received'}) 275 return JsonResponse({'message': 'No data received'})
277 276
278 277
279 -def getResourceCount(request):  
280 - resources = Resource.objects.distinct()  
281 -  
282 - data = {}  
283 - for resource in resources:  
284 - key = resource.__dict__['_my_subclass']  
285 - if key in data.keys():  
286 - data[key] = data[key] + 1  
287 - else:  
288 - data[key] = 1  
289 -  
290 - data = [(key,value) for key,value in sorted(data.items(), key=operator.itemgetter(1), reverse=True)]  
291 -  
292 - others = data[4:]  
293 - total_others = 0  
294 - for key,value in others:  
295 - total_others += value  
296 -  
297 - del data[4:] #remove from the 5th element  
298 - data.append(("others", total_others)) #so I have the sum of all other resources added up  
299 - real_data = []  
300 - for key,value in data:  
301 - real_data.append((key,value))  
302 - return JsonResponse(real_data, safe=False)  
users/templates/users/login.html
@@ -87,7 +87,7 @@ @@ -87,7 +87,7 @@
87 <span >[{{LANGUAGE_CODE}}] </span> 87 <span >[{{LANGUAGE_CODE}}] </span>
88 88
89 </a> 89 </a>
90 - <a href="" id = "contrast_button" style="margin-left:10px;"><i class="glyphicon glyphicon-adjust"></i></a> 90 + <a href="{% url 'themes:contrast' %}" id = "contrast_button" style="margin-left:10px;"><i class="glyphicon glyphicon-adjust"></i></a>
91 <ul class="dropdown-menu"> 91 <ul class="dropdown-menu">
92 92
93 93
@@ -150,11 +150,11 @@ @@ -150,11 +150,11 @@
150 $("#contrast_button" ).click(function() { 150 $("#contrast_button" ).click(function() {
151 if (Cookies.get('contrast_check')) { 151 if (Cookies.get('contrast_check')) {
152 Cookies.remove('contrast_check') 152 Cookies.remove('contrast_check')
153 - location.reload() 153 + //location.reload()
154 } 154 }
155 else { 155 else {
156 Cookies.set('contrast_check','contrast') 156 Cookies.set('contrast_check','contrast')
157 - location.reload() 157 + //location.reload()
158 } 158 }
159 159
160 }); 160 });