Commit 8b5dead56a59beb07e9830bf4a195e9cc7a83c4a
1 parent
bcc4439c
Exists in
master
and in
2 other branches
modified analytics and dashboards app, now they serve their right purpose and ar…
…e more separated and functional
Showing
19 changed files
with
362 additions
and
281 deletions
Show diff stats
amadeus/settings.py
amadeus/templates/base.html
... | ... | @@ -251,7 +251,7 @@ |
251 | 251 | </a> |
252 | 252 | </li> |
253 | 253 | <li class="item" data-toggle="tooltip" data-placement="right" title="{% trans "Analytics" %}"> |
254 | - <a href="{% url 'analytics:view_general' %}"><i class="fa fa-bar-chart" aria-hid{% get_current_language as LANGUAGE_CODE %}den="true"></i></a> | |
254 | + <a href="{% url 'dashboards:view_general' %}"><i class="fa fa-bar-chart" aria-hid{% get_current_language as LANGUAGE_CODE %}den="true"></i></a> | |
255 | 255 | </li> |
256 | 256 | </ul> |
257 | 257 | {% endblock %} |
... | ... | @@ -306,7 +306,7 @@ |
306 | 306 | </a> |
307 | 307 | </li> |
308 | 308 | <li class="item" data-toggle="tooltip" data-placement="top" title="{% trans "Analytics" %}"> |
309 | - <a href="{% url 'analytics:view_general' %}"><i class="fa fa-bar-chart" aria-hid{% get_current_language as LANGUAGE_CODE %}den="true"></i></a> | |
309 | + <a href="{% url 'dashboards:view_general' %}"><i class="fa fa-bar-chart" aria-hid{% get_current_language as LANGUAGE_CODE %}den="true"></i></a> | |
310 | 310 | </li> |
311 | 311 | </ul> |
312 | 312 | </div> | ... | ... |
amadeus/urls.py
... | ... | @@ -46,6 +46,7 @@ urlpatterns = [ |
46 | 46 | url(r'^news/', include('news.urls', namespace='news')), |
47 | 47 | url(r'^i18n/', include('django.conf.urls.i18n')), |
48 | 48 | url(r'^analytics/', include('analytics.urls', namespace='analytics')), |
49 | + url(r'^dashboards/', include('dashboards.urls', namespace='dashboards')), | |
49 | 50 | #API |
50 | 51 | url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')), |
51 | 52 | #S3Direct | ... | ... |
analytics/static/analytics/js/behavior.js
... | ... | @@ -1,96 +0,0 @@ |
1 | - | |
2 | - | |
3 | - | |
4 | -$(document).ready(function(){ | |
5 | - selectors_options.init(); | |
6 | - | |
7 | - //for month selector | |
8 | - | |
9 | - $('#month_selector').change(function(){ | |
10 | - $.get('/analytics/amount_active_users_per_day', {month: $(this).val() }).done(function(data){ | |
11 | - charts.month_heatmap(data, '#right-chart-body'); | |
12 | - | |
13 | - }); | |
14 | - }); | |
15 | - //week date selector at the right-chart field | |
16 | - $('input.datepicker').datetimepicker({ | |
17 | - format: 'L', | |
18 | - defaultDate: new Date(), | |
19 | - }).on('dp.change', function(ev){ | |
20 | - $.get('/analytics/get_days_of_the_week_log', {date: ev.date._i}).done(function(data){ | |
21 | - charts.month_heatmap(data, '#bottom-right-chart-body'); | |
22 | - }); | |
23 | - | |
24 | - }); | |
25 | - | |
26 | - | |
27 | - | |
28 | - | |
29 | -}); | |
30 | - | |
31 | - | |
32 | - | |
33 | -var selectors_options = { | |
34 | - init: function(){ | |
35 | - selectors = $("div.selector"); | |
36 | - selectors.click(function(e){ | |
37 | - selectors_options.loadData(e.currentTarget); | |
38 | - }); | |
39 | - }, | |
40 | - loadData: function(e){ | |
41 | - if (e){ | |
42 | - opened = $(e).attr('opened'); | |
43 | - if (typeof opened !== typeof undefined && opened !== false){ | |
44 | - selectors_options.deleteChildren(e); | |
45 | - }else { | |
46 | - switch(e.attributes['data-url'].value){ | |
47 | - case "subjects": | |
48 | - var url = "/analytics/most_accessed_subjects"; | |
49 | - break; | |
50 | - case "categories": | |
51 | - var url = "/analytics/most_accessed_categories"; | |
52 | - break; | |
53 | - case "resources": | |
54 | - var url = "/analytics/most_accessed_resources"; | |
55 | - break; | |
56 | - | |
57 | - } | |
58 | - | |
59 | - } | |
60 | - } | |
61 | - if(url){ | |
62 | - $.get(url, function(dataset){ | |
63 | - return dataset; | |
64 | - }).done(function(data){ | |
65 | - selectors_options.modifyElement(e, data); | |
66 | - | |
67 | - }).fail(function(error){ | |
68 | - console.log("couldn't complete get request"); | |
69 | - }); | |
70 | - } | |
71 | - | |
72 | - | |
73 | - }, | |
74 | - modifyElement: function(e, data){ | |
75 | - var string_build = ""; | |
76 | - string_build += '<ul class="most-accessed-list" style="display:none;">'; | |
77 | - | |
78 | - data.forEach(function(datum){ | |
79 | - string_build += '<li class="most-accessed-item">' +datum.name+ ' ' + datum.count+ '</li>'; | |
80 | - }); | |
81 | - string_build += "</ul>"; | |
82 | - | |
83 | - $(e).after(string_build); | |
84 | - var new_elem = $(e).next(); | |
85 | - new_elem.slideDown({easing: 'easeInOutSine'}, 5000); | |
86 | - $(e).attr("opened", true); | |
87 | - | |
88 | - }, | |
89 | - deleteChildren: function(e){ | |
90 | - var most_accessed_list = $(e).next(); | |
91 | - $(most_accessed_list).slideUp({easing: 'easeInOutSine'}, 1200); | |
92 | - $(e).removeAttr("opened"); //remove attribute so it can call API again | |
93 | - }, | |
94 | -}; | |
95 | - | |
96 | - |
analytics/templates/analytics/category.html
... | ... | @@ -1,25 +0,0 @@ |
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 | - | |
25 | -{% endblock content %} | |
26 | 0 | \ No newline at end of file |
analytics/templates/analytics/general.html
... | ... | @@ -1,133 +0,0 @@ |
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 | - | |
11 | - <script type="text/javascript" src="{% static "analytics/js/charts.js" %}"></script> | |
12 | - <script type="text/javascript" src=" {% static "analytics/js/behavior.js" %} "></script> | |
13 | -{% endblock javascript %} | |
14 | - | |
15 | -{% block breadcrumbs %} | |
16 | - {{ block.super }} | |
17 | - | |
18 | - {% trans 'Analytics General' as general %} | |
19 | - | |
20 | - {% breadcrumb general 'dashboard:view_general' %} | |
21 | -{% endblock %} | |
22 | - | |
23 | - | |
24 | -{% block content %} | |
25 | - <section id="core-subjects-options-div"> | |
26 | - <nav> | |
27 | - <ul class="core-subjects-options report-menu-choice"> | |
28 | - | |
29 | - <li class="active"> | |
30 | - {% trans "Platform Report" %} | |
31 | - </li> | |
32 | - <li> | |
33 | - {% trans "Category Report" %} | |
34 | - </li> | |
35 | - <li> | |
36 | - {% trans "Subject Report" %} | |
37 | - </li> | |
38 | - | |
39 | - </ul> | |
40 | - </nav> | |
41 | - </section> | |
42 | - | |
43 | - <section id="general-report"> | |
44 | - <header id="general-report-header"> | |
45 | - <h3>{% trans "Amadeus Report" %}</h3> | |
46 | - | |
47 | - <ul id="report-header-options"> | |
48 | - <li class="selected"> | |
49 | - {% trans "Focus" %} | |
50 | - </li> | |
51 | - <li> | |
52 | - {% trans "Log" %} | |
53 | - </li> | |
54 | - </ul> | |
55 | - </header> | |
56 | - | |
57 | - <article class="report-body"> | |
58 | - | |
59 | - <section id="most-used-tags"> | |
60 | - <header id="most-used-tags-header"> | |
61 | - <h4 > | |
62 | - {% trans "most used tags" %} | |
63 | - </h4> | |
64 | - </header> | |
65 | - <div id="most-used-tags-body"> | |
66 | - | |
67 | - </div> | |
68 | - </section> | |
69 | - <section class="bottom-section"> | |
70 | - <div class="chart left-chart"> | |
71 | - | |
72 | - <h4>{% trans "Most accessed " %}</h4> | |
73 | - <div id="left-data-selector"> | |
74 | - | |
75 | - | |
76 | - <div class="selector" data-url="categories"> | |
77 | - <p> {% trans "Most accessed categories" %} </p> | |
78 | - </div> | |
79 | - | |
80 | - <div class="selector" data-url="subjects"> | |
81 | - <p> {% trans "Most accessed subjects" %} </p> | |
82 | - </div> | |
83 | - | |
84 | - <div class="selector" data-url="resources"> | |
85 | - <p> {% trans "Most accessed resource" %} </p> | |
86 | - </div> | |
87 | - | |
88 | - </div> | |
89 | - | |
90 | - </div> | |
91 | - <div class="chart middle-chart"> | |
92 | - <article> | |
93 | - <h4>{% trans "Most active users" %}</h4> | |
94 | - </article> | |
95 | - | |
96 | - </div> | |
97 | - <div class="chart right-chart"> | |
98 | - <div id="month_selector_div"> | |
99 | - <h4>{% trans "Amount of access in: " %} | |
100 | - <select id="month_selector"> | |
101 | - {% for month in months %} | |
102 | - <option>{{month}}</option> | |
103 | - {% endfor %} | |
104 | - | |
105 | - </select> | |
106 | - </h4> | |
107 | - </div> | |
108 | - | |
109 | - <div id="right-chart-body"> | |
110 | - | |
111 | - </div> | |
112 | - | |
113 | - <div class='input-group date'> | |
114 | - <label>{% trans "Select the begin of the week: " %}</label> | |
115 | - <input type='text' class="datepicker form-control" /> | |
116 | - <span class="input-group-addon"> | |
117 | - <span class="glyphicon glyphicon-calendar"></span> | |
118 | - </span> | |
119 | - </div> | |
120 | - <div id="bottom-right-chart-body"> | |
121 | - | |
122 | - </div> | |
123 | - </div> | |
124 | - </section> | |
125 | - | |
126 | - </article> | |
127 | - </section> | |
128 | - | |
129 | - <script type="text/javascript"> | |
130 | - </script> | |
131 | - | |
132 | - | |
133 | -{% endblock content %} | |
134 | 0 | \ No newline at end of file |
analytics/urls.py
... | ... | @@ -3,8 +3,6 @@ from . import views |
3 | 3 | |
4 | 4 | |
5 | 5 | urlpatterns = [ |
6 | - url(r'^view/general/$', views.GeneralView.as_view(), name='view_general'), | |
7 | - url(r'^view/category/data$', views.CategoryView.as_view(), name='view_category_data'), | |
8 | 6 | |
9 | 7 | #"api" callls |
10 | 8 | url(r'^most_used_tags/$', views.most_used_tags, name="most_used_tags"), | ... | ... |
analytics/views.py
... | ... | @@ -18,23 +18,6 @@ import calendar |
18 | 18 | from collections import OrderedDict |
19 | 19 | |
20 | 20 | |
21 | -class GeneralView(generic.TemplateView): | |
22 | - template_name = "analytics/general.html" | |
23 | - | |
24 | - def dispatch(self, request, *args, **kwargs): | |
25 | - | |
26 | - if not request.user.is_staff: | |
27 | - return redirect('analytics:view_category_data') | |
28 | - return super(GeneralView, self).dispatch(request, *args, **kwargs) | |
29 | - | |
30 | - | |
31 | - def get_context_data(self, **kwargs): | |
32 | - context = {} | |
33 | - | |
34 | - context['months'] = [_('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July'), _('August'), | |
35 | - _('September'), _('October'), _('November'), _('December')] | |
36 | - | |
37 | - return context | |
38 | 21 | |
39 | 22 | |
40 | 23 | |
... | ... | @@ -94,9 +77,7 @@ Subject view that returns a list of the most used subjects """ |
94 | 77 | |
95 | 78 | |
96 | 79 | def most_accessed_subjects(request): |
97 | - data = {} #empty response | |
98 | 80 | |
99 | - data = Log.objects.filter(resource = 'subject') | |
100 | 81 | subjects = get_log_count_of_resource(resource='subject') |
101 | 82 | #order the values of the dictionary by the count in descendent order |
102 | 83 | subjects = sorted(subjects.values(), key = lambda x: x['count'], reverse=True ) |
... | ... | @@ -119,9 +100,7 @@ def get_log_count_of_resource(resource = ''): |
119 | 100 | |
120 | 101 | |
121 | 102 | def most_accessed_categories(request): |
122 | - data = {} | |
123 | 103 | |
124 | - data = Log.objects.filter(resource = 'category') | |
125 | 104 | categories = get_log_count_of_resource('category') |
126 | 105 | |
127 | 106 | |
... | ... | @@ -214,5 +193,3 @@ def get_days_of_the_week(date): |
214 | 193 | return days_set |
215 | 194 | |
216 | 195 | |
217 | -class CategoryView(generic.TemplateView): | |
218 | - template_name = "analytics/category.html" | ... | ... |
... | ... | @@ -0,0 +1,96 @@ |
1 | + | |
2 | + | |
3 | + | |
4 | +$(document).ready(function(){ | |
5 | + selectors_options.init(); | |
6 | + | |
7 | + //for month selector | |
8 | + | |
9 | + $('#month_selector').change(function(){ | |
10 | + $.get('/analytics/amount_active_users_per_day', {month: $(this).val() }).done(function(data){ | |
11 | + charts.month_heatmap(data, '#right-chart-body'); | |
12 | + | |
13 | + }); | |
14 | + }); | |
15 | + //week date selector at the right-chart field | |
16 | + $('input.datepicker').datetimepicker({ | |
17 | + format: 'L', | |
18 | + defaultDate: new Date(), | |
19 | + }).on('dp.change', function(ev){ | |
20 | + $.get('/analytics/get_days_of_the_week_log', {date: ev.date._i}).done(function(data){ | |
21 | + charts.month_heatmap(data, '#bottom-right-chart-body'); | |
22 | + }); | |
23 | + | |
24 | + }); | |
25 | + | |
26 | + | |
27 | + | |
28 | + | |
29 | +}); | |
30 | + | |
31 | + | |
32 | + | |
33 | +var selectors_options = { | |
34 | + init: function(){ | |
35 | + selectors = $("div.selector"); | |
36 | + selectors.click(function(e){ | |
37 | + selectors_options.loadData(e.currentTarget); | |
38 | + }); | |
39 | + }, | |
40 | + loadData: function(e){ | |
41 | + if (e){ | |
42 | + opened = $(e).attr('opened'); | |
43 | + if (typeof opened !== typeof undefined && opened !== false){ | |
44 | + selectors_options.deleteChildren(e); | |
45 | + }else { | |
46 | + switch(e.attributes['data-url'].value){ | |
47 | + case "subjects": | |
48 | + var url = "/analytics/most_accessed_subjects"; | |
49 | + break; | |
50 | + case "categories": | |
51 | + var url = "/analytics/most_accessed_categories"; | |
52 | + break; | |
53 | + case "resources": | |
54 | + var url = "/analytics/most_accessed_resources"; | |
55 | + break; | |
56 | + | |
57 | + } | |
58 | + | |
59 | + } | |
60 | + } | |
61 | + if(url){ | |
62 | + $.get(url, function(dataset){ | |
63 | + return dataset; | |
64 | + }).done(function(data){ | |
65 | + selectors_options.modifyElement(e, data); | |
66 | + | |
67 | + }).fail(function(error){ | |
68 | + console.log("couldn't complete get request"); | |
69 | + }); | |
70 | + } | |
71 | + | |
72 | + | |
73 | + }, | |
74 | + modifyElement: function(e, data){ | |
75 | + var string_build = ""; | |
76 | + string_build += '<ul class="most-accessed-list" style="display:none;">'; | |
77 | + | |
78 | + data.forEach(function(datum){ | |
79 | + string_build += '<li class="most-accessed-item">' +datum.name+ ' ' + datum.count+ '</li>'; | |
80 | + }); | |
81 | + string_build += "</ul>"; | |
82 | + | |
83 | + $(e).after(string_build); | |
84 | + var new_elem = $(e).next(); | |
85 | + new_elem.slideDown({easing: 'easeInOutSine'}, 5000); | |
86 | + $(e).attr("opened", true); | |
87 | + | |
88 | + }, | |
89 | + deleteChildren: function(e){ | |
90 | + var most_accessed_list = $(e).next(); | |
91 | + $(most_accessed_list).slideUp({easing: 'easeInOutSine'}, 1200); | |
92 | + $(e).removeAttr("opened"); //remove attribute so it can call API again | |
93 | + }, | |
94 | +}; | |
95 | + | |
96 | + | ... | ... |
... | ... | @@ -0,0 +1,59 @@ |
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 "dashboards/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 | + <section id="core-subjects-options-div"> | |
25 | + <nav> | |
26 | + <ul class="core-subjects-options report-menu-choice"> | |
27 | + | |
28 | + <li> | |
29 | + {% trans "Platform Report" %} | |
30 | + </li> | |
31 | + <a href=""><li class="active"> | |
32 | + {% trans "Category Report" %} | |
33 | + </li></a> | |
34 | + <li> | |
35 | + {% trans "Subject Report" %} | |
36 | + </li> | |
37 | + | |
38 | + </ul> | |
39 | + </nav> | |
40 | + </section> | |
41 | + | |
42 | + <section id="general-report"> | |
43 | + <header id="general-report-header"> | |
44 | + <h3>{{category.name}} {% trans "Category Report" %}</h3> | |
45 | + | |
46 | + <ul id="report-header-options"> | |
47 | + <li class="selected"> | |
48 | + {% trans "Focus" %} | |
49 | + </li> | |
50 | + <li> | |
51 | + {% trans "Log" %} | |
52 | + </li> | |
53 | + </ul> | |
54 | + </header> | |
55 | + | |
56 | + <article class="report-body"> | |
57 | + </article> | |
58 | + </section> | |
59 | +{% endblock content %} | |
0 | 60 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,133 @@ |
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 | + | |
11 | + <script type="text/javascript" src="{% static "analytics/js/charts.js" %}"></script> | |
12 | + <script type="text/javascript" src=" {% static "dashboards/js/behavior.js" %} "></script> | |
13 | +{% endblock javascript %} | |
14 | + | |
15 | +{% block breadcrumbs %} | |
16 | + {{ block.super }} | |
17 | + | |
18 | + {% trans 'Dashboards General' as general %} | |
19 | + | |
20 | + {% breadcrumb general 'dashboard:view_general' %} | |
21 | +{% endblock %} | |
22 | + | |
23 | + | |
24 | +{% block content %} | |
25 | + <section id="core-subjects-options-div"> | |
26 | + <nav> | |
27 | + <ul class="core-subjects-options report-menu-choice"> | |
28 | + | |
29 | + <li class="active"> | |
30 | + {% trans "Platform Report" %} | |
31 | + </li> | |
32 | + <a href=""><li> | |
33 | + {% trans "Category Report" %} | |
34 | + </li></a> | |
35 | + <li> | |
36 | + {% trans "Subject Report" %} | |
37 | + </li> | |
38 | + | |
39 | + </ul> | |
40 | + </nav> | |
41 | + </section> | |
42 | + | |
43 | + <section id="general-report"> | |
44 | + <header id="general-report-header"> | |
45 | + <h3>{% trans "Amadeus Report" %}</h3> | |
46 | + | |
47 | + <ul id="report-header-options"> | |
48 | + <li class="selected"> | |
49 | + {% trans "Focus" %} | |
50 | + </li> | |
51 | + <li> | |
52 | + {% trans "Log" %} | |
53 | + </li> | |
54 | + </ul> | |
55 | + </header> | |
56 | + | |
57 | + <article class="report-body"> | |
58 | + | |
59 | + <section id="most-used-tags"> | |
60 | + <header id="most-used-tags-header"> | |
61 | + <h4 > | |
62 | + {% trans "most used tags" %} | |
63 | + </h4> | |
64 | + </header> | |
65 | + <div id="most-used-tags-body"> | |
66 | + | |
67 | + </div> | |
68 | + </section> | |
69 | + <section class="bottom-section"> | |
70 | + <div class="chart left-chart"> | |
71 | + | |
72 | + <h4>{% trans "Most accessed " %}</h4> | |
73 | + <div id="left-data-selector"> | |
74 | + | |
75 | + | |
76 | + <div class="selector" data-url="categories"> | |
77 | + <p> {% trans "Most accessed categories" %} </p> | |
78 | + </div> | |
79 | + | |
80 | + <div class="selector" data-url="subjects"> | |
81 | + <p> {% trans "Most accessed subjects" %} </p> | |
82 | + </div> | |
83 | + | |
84 | + <div class="selector" data-url="resources"> | |
85 | + <p> {% trans "Most accessed resource" %} </p> | |
86 | + </div> | |
87 | + | |
88 | + </div> | |
89 | + | |
90 | + </div> | |
91 | + <div class="chart middle-chart"> | |
92 | + <article> | |
93 | + <h4>{% trans "Most active users" %}</h4> | |
94 | + </article> | |
95 | + | |
96 | + </div> | |
97 | + <div class="chart right-chart"> | |
98 | + <div id="month_selector_div"> | |
99 | + <h4>{% trans "Amount of access in: " %} | |
100 | + <select id="month_selector"> | |
101 | + {% for month in months %} | |
102 | + <option>{{month}}</option> | |
103 | + {% endfor %} | |
104 | + | |
105 | + </select> | |
106 | + </h4> | |
107 | + </div> | |
108 | + | |
109 | + <div id="right-chart-body"> | |
110 | + | |
111 | + </div> | |
112 | + | |
113 | + <div class='input-group date'> | |
114 | + <label>{% trans "Select the begin of the week: " %}</label> | |
115 | + <input type='text' class="datepicker form-control" /> | |
116 | + <span class="input-group-addon"> | |
117 | + <span class="glyphicon glyphicon-calendar"></span> | |
118 | + </span> | |
119 | + </div> | |
120 | + <div id="bottom-right-chart-body"> | |
121 | + | |
122 | + </div> | |
123 | + </div> | |
124 | + </section> | |
125 | + | |
126 | + </article> | |
127 | + </section> | |
128 | + | |
129 | + <script type="text/javascript"> | |
130 | + </script> | |
131 | + | |
132 | + | |
133 | +{% endblock content %} | |
0 | 134 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,48 @@ |
1 | +from django.shortcuts import render | |
2 | + | |
3 | +from django.views import generic | |
4 | +from django.db.models import Count | |
5 | +from django.core.urlresolvers import reverse_lazy | |
6 | + | |
7 | +from subjects.models import Tag, Subject | |
8 | +from topics.models import Resource | |
9 | +from users.models import User | |
10 | +from django.http import HttpResponse, JsonResponse | |
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 | |
15 | + | |
16 | +from datetime import date, timedelta, datetime | |
17 | +import calendar | |
18 | +from collections import OrderedDict | |
19 | + | |
20 | + | |
21 | +class GeneralView(generic.TemplateView): | |
22 | + template_name = "dashboards/general.html" | |
23 | + | |
24 | + def dispatch(self, request, *args, **kwargs): | |
25 | + | |
26 | + if not request.user.is_staff: | |
27 | + return redirect('analytics:view_category_data') | |
28 | + return super(GeneralView, self).dispatch(request, *args, **kwargs) | |
29 | + | |
30 | + | |
31 | + def get_context_data(self, **kwargs): | |
32 | + context = {} | |
33 | + | |
34 | + context['months'] = [_('January'), _('February'), _('March'), _('April'), _('May'), _('June'), _('July'), _('August'), | |
35 | + _('September'), _('October'), _('November'), _('December')] | |
36 | + | |
37 | + return context | |
38 | + | |
39 | +class CategoryView(generic.TemplateView): | |
40 | + template_name = "dashboards/category.html" | |
41 | + | |
42 | + def dispatch(self, request, *args, **kwargs): | |
43 | + return super(CategoryView, self).dispatch(request, *args, **kwargs) | |
44 | + | |
45 | + def get_context_data(self, **kwargs): | |
46 | + context = {} | |
47 | + | |
48 | + return context | |
0 | 49 | \ No newline at end of file | ... | ... |