Commit 959ec49df2cb3190abfda2652f5f6be46eab706f

Authored by Felipe Bormann
1 parent f93891d7

modified organization of HTML inside dashboards as well as finished log load methods

dashboards/static/dashboards/.sass-cache/d1f4112ca6d0e14bdf64d22b0b14a2322f24cc83/general.sassc
No preview for this file type
dashboards/static/dashboards/css/general.css
... ... @@ -16,21 +16,24 @@
16 16 display: inline-flex;
17 17 width: 50%;
18 18 margin-bottom: 0px; }
19   - #general-report-header ul li {
20   - margin-right: 2%;
21   - width: 50%;
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; }
  19 + #general-report-header ul a {
  20 + width: 100%; }
  21 +
  22 +li.tab-option {
  23 + margin-right: 2%;
  24 + color: white;
  25 + font-size: 20px;
  26 + background-color: #0f8a9a;
  27 + width: 100%;
  28 + text-align: center;
  29 + border-radius: 20px;
  30 + height: 30px; }
  31 +
  32 +li.selected {
  33 + background-color: #4dcfbd;
  34 + width: 100%;
  35 + text-align: center;
  36 + border-radius: 20px; }
34 37  
35 38 #most-used-tags-header {
36 39 background: linear-gradient(to right, #0e8999, #6bf0ce);
... ... @@ -131,4 +134,7 @@
131 134 color: white;
132 135 text-align: center; }
133 136  
  137 +#period-selector {
  138 + display: flex; }
  139 +
134 140 /*# sourceMappingURL=general.css.map */
... ...
dashboards/static/dashboards/css/general.css.map
1 1 {
2 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;EACX,gBAAgB,EAAE,OAAO;;AAE7B,sBAAsB;EAClB,MAAM,EAAE,GAAG;EACX,OAAO,EAAE,KAAK;EACd,yBAAE;IACE,KAAK,EAdC,OAA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"sources": ["general.sass"],
5 5 "names": [],
6 6 "file": "general.css"
... ...
dashboards/static/dashboards/css/general.sass
... ... @@ -20,25 +20,26 @@ $title-color: #009688
20 20 width: 50%
21 21 margin-bottom: 0px
22 22  
23   - li
24   - margin-right: 2%
25   - width: 50%
26   - color: white
27   - font-size: 20px
28   - background-color: #0f8a9a
  23 + a
29 24 width: 100%
30   - text-align: center
31   - border-radius: 20px
32   - height: 30px
33 25  
  26 +
  27 +li.tab-option
  28 + margin-right: 2%
  29 + color: white
  30 + font-size: 20px
  31 + background-color: #0f8a9a
  32 + width: 100%
  33 + text-align: center
  34 + border-radius: 20px
  35 + height: 30px
34 36  
35   - li.selected
36   - background-color: #4dcfbd
37   - width: 100%
38   - text-align: center
39   - border-radius: 20px
40 37  
41   -
  38 +li.selected
  39 + background-color: #4dcfbd
  40 + width: 100%
  41 + text-align: center
  42 + border-radius: 20px
42 43  
43 44  
44 45  
... ... @@ -150,4 +151,10 @@ $title-color: #009688
150 151 height: 20px
151 152 background: #52b7bd
152 153 color: white
153   - text-align: center
154 154 \ No newline at end of file
  155 + text-align: center
  156 +
  157 +
  158 +//LOG CLASSES AND ID's
  159 +
  160 +#period-selector
  161 + display: flex
155 162 \ No newline at end of file
... ...
dashboards/static/dashboards/js/logbehavior.js 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +$(document).ready(function(){
  2 + $('#init_date').datetimepicker();
  3 + $('#end_date').datetimepicker({
  4 + useCurrent: false //Important! See issue #1075
  5 + });
  6 + $("#init_date").on("dp.change", function (e) {
  7 + $('#end_date').data("DateTimePicker").minDate(e.date);
  8 + });
  9 + $("#end_date").on("dp.change", function (e) {
  10 + $('#init_date').data("DateTimePicker").maxDate(e.date);
  11 + init_date = $("#init_date").data("DateTimePicker").date();
  12 + log.refresh_log_data(init_date, e.date);
  13 + });
  14 +
  15 +
  16 +});
  17 +
  18 +
  19 +
  20 +
  21 +var log = {
  22 +
  23 + refresh_log_data: function(init_date, end_date){
  24 + $.get("/dashboards/get_log_data", {init_date: init_date.format("YYYY-MM-DD HH:mm"), end_date: end_date.format("YYYY-MM-DD HH:mm")}).done(function(data){
  25 + log.render_table("log_body", data);
  26 + })
  27 + },
  28 + render_table: function(target_id, data){
  29 + table_body = $('#' + target_id);
  30 +
  31 + data.forEach(function(datum){
  32 + console.log(datum);
  33 + });
  34 + },
  35 +}
... ...
dashboards/templates/dashboards/category.html
... ... @@ -63,16 +63,7 @@
63 63  
64 64 <article class="report-body">
65 65  
66   - <section id="most-used-tags">
67   - <header id="most-used-tags-header">
68   - <h4 >
69   - {% trans "most used tags" %}
70   - </h4>
71   - </header>
72   - <div id="most-used-tags-body">
73   -
74   - </div>
75   - </section>
  66 + {% include "dashboards/tags_body.html" %}
76 67 </article>
77 68 </section>
78 69 {% endblock content %}
79 70 \ No newline at end of file
... ...
dashboards/templates/dashboards/general.html
... ... @@ -7,9 +7,9 @@
7 7 {% endblock style %}
8 8  
9 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>
  10 + {% for file in javascript_files %}
  11 + <script type="text/javascript" src="{% static file %}"></script>
  12 + {% endfor %}
13 13 {% endblock javascript %}
14 14  
15 15 {% block breadcrumbs %}
... ... @@ -41,92 +41,7 @@
41 41 </section>
42 42  
43 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 "Categories" %} </p>
78   - <i class="fa fa-2x pull-right fa-angle-right" aria-hidden="true" style=""></i>
79   - </div>
80   -
81   - <div class="selector" data-url="subjects">
82   - <p> {% trans "Subjects" %} </p>
83   - <i class="fa fa-2x pull-right fa-angle-right" aria-hidden="true" style=""></i>
84   - </div>
85   -
86   - <div class="selector" data-url="resources">
87   - <p> {% trans "Resource" %} </p>
88   - <i class="fa fa-2x pull-right fa-angle-right" aria-hidden="true" style=""></i>
89   - </div>
90   -
91   - </div>
92   -
93   - </div>
94   - <div class="chart middle-chart">
95   - <article>
96   - <h4>{% trans "Most active users" %}</h4>
97   - </article>
98   -
99   - </div>
100   - <div class="chart right-chart">
101   - <div id="month_selector_div">
102   - <h4>{% trans "Amount of access in: " %}
103   - <select id="month_selector">
104   - {% for month in months %}
105   - <option>{{month}}</option>
106   - {% endfor %}
107   -
108   - </select>
109   - </h4>
110   - </div>
111   -
112   - <div id="right-chart-body">
113   -
114   - </div>
115   -
116   - <div class='input-group date'>
117   - <label>{% trans "Select the begin of the week: " %}</label>
118   - <input type='text' class="datepicker form-control" />
119   - <span class="input-group-addon">
120   - <span class="glyphicon glyphicon-calendar"></span>
121   - </span>
122   - </div>
123   - <div id="bottom-right-chart-body">
124   -
125   - </div>
126   - </div>
127   - </section>
128   -
129   - </article>
  44 + {% include child_template %}
130 45 </section>
131 46  
132 47 <script type="text/javascript">
... ...
dashboards/templates/dashboards/general_body.html 0 → 100644
... ... @@ -0,0 +1,78 @@
  1 +{% load static i18n pagination %}
  2 +
  3 + <header id="general-report-header">
  4 + <h3>{% trans "Amadeus Report" %}</h3>
  5 +
  6 + <ul id="report-header-options">
  7 + <li class="tab-option selected">
  8 + {% trans "Focus" %}
  9 + </li>
  10 + <a href="{% url 'dashboards:view_general_log' %}"><li class="tab-option">
  11 + {% trans "Log" %}
  12 + </li></a>
  13 + </ul>
  14 + </header>
  15 +
  16 + <article class="report-body">
  17 + {% include "dashboards/tags_body.html" %}
  18 + <section class="bottom-section">
  19 + <div class="chart left-chart">
  20 +
  21 + <h4>{% trans "Most accessed " %}</h4>
  22 + <div id="left-data-selector">
  23 +
  24 +
  25 + <div class="selector" data-url="categories">
  26 + <p> {% trans "Categories" %} </p>
  27 + <i class="fa fa-2x pull-right fa-angle-right" aria-hidden="true" style=""></i>
  28 + </div>
  29 +
  30 + <div class="selector" data-url="subjects">
  31 + <p> {% trans "Subjects" %} </p>
  32 + <i class="fa fa-2x pull-right fa-angle-right" aria-hidden="true" style=""></i>
  33 + </div>
  34 +
  35 + <div class="selector" data-url="resources">
  36 + <p> {% trans "Resource" %} </p>
  37 + <i class="fa fa-2x pull-right fa-angle-right" aria-hidden="true" style=""></i>
  38 + </div>
  39 +
  40 + </div>
  41 +
  42 + </div>
  43 + <div class="chart middle-chart">
  44 + <article>
  45 + <h4>{% trans "Most active users" %}</h4>
  46 + </article>
  47 +
  48 + </div>
  49 + <div class="chart right-chart">
  50 + <div id="month_selector_div">
  51 + <h4>{% trans "Amount of access in: " %}
  52 + <select id="month_selector">
  53 + {% for month in months %}
  54 + <option>{{month}}</option>
  55 + {% endfor %}
  56 +
  57 + </select>
  58 + </h4>
  59 + </div>
  60 +
  61 + <div id="right-chart-body">
  62 +
  63 + </div>
  64 +
  65 + <div class='input-group date'>
  66 + <label>{% trans "Select the begin of the week: " %}</label>
  67 + <input type='text' class="datepicker form-control" />
  68 + <span class="input-group-addon">
  69 + <span class="glyphicon glyphicon-calendar"></span>
  70 + </span>
  71 + </div>
  72 + <div id="bottom-right-chart-body">
  73 +
  74 + </div>
  75 + </div>
  76 + </section>
  77 +
  78 + </article>
0 79 \ No newline at end of file
... ...
dashboards/templates/dashboards/log.html 0 → 100644
... ... @@ -0,0 +1,52 @@
  1 +{% load static i18n pagination %}
  2 +{% load django_bootstrap_breadcrumbs %}
  3 +
  4 + <section id="general-report">
  5 + <header id="general-report-header">
  6 + <h3>{% trans "Amadeus Report" %}</h3>
  7 +
  8 + <ul id="report-header-options">
  9 + <a href="{% url 'dashboards:view_general' %}"><li class="tab-option">
  10 + {% trans "Focus" %}
  11 + </li></a>
  12 + <li class="tab-option selected">
  13 + {% trans "Log" %}
  14 + </li>
  15 + </ul>
  16 + </header>
  17 + <div id="period-selector">
  18 + <div class="container">
  19 + <div class='col-md-5'>
  20 + <div class="form-group">
  21 + <div class='input-group date' id='init_date'>
  22 + <input type='text' class="form-control" />
  23 + <span class="input-group-addon">
  24 + <span class="glyphicon glyphicon-calendar"></span>
  25 + </span>
  26 + </div>
  27 + </div>
  28 + </div>
  29 + <div class='col-md-5'>
  30 + <div class="form-group">
  31 + <div class='input-group date' id='end_date'>
  32 + <input type='text' class="form-control" />
  33 + <span class="input-group-addon">
  34 + <span class="glyphicon glyphicon-calendar"></span>
  35 + </span>
  36 + </div>
  37 + </div>
  38 + </div>
  39 + </div>
  40 +
  41 + </div>
  42 + <article class="report-body">
  43 +
  44 +
  45 + <div id="counter"></div>
  46 +
  47 + <section id="log-body">
  48 +
  49 + </section>
  50 + </article>
  51 + </section>
  52 +
... ...
dashboards/templates/dashboards/tags_body.html 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +{% load static i18n pagination %}
  2 +
  3 + <section id="most-used-tags">
  4 + <header id="most-used-tags-header">
  5 + <h4 >
  6 + {% trans "most used tags" %}
  7 + </h4>
  8 + </header>
  9 + <div id="most-used-tags-body">
  10 +
  11 + </div>
  12 + </section>
0 13 \ No newline at end of file
... ...
dashboards/urls.py
... ... @@ -4,5 +4,7 @@ from . import views
4 4  
5 5 urlpatterns = [
6 6 url(r'^general/$', views.GeneralView.as_view(), name='view_general'),
  7 + url(r'^general/log/$', views.LogView.as_view(), name='view_general_log'),
7 8 url(r'^categories/$', views.CategoryView.as_view(), name='view_categories'),
  9 + url(r'^get_log_data/$', views.load_log_data, name='load_log_data')
8 10 ]
9 11 \ No newline at end of file
... ...
dashboards/views.py
... ... @@ -45,7 +45,8 @@ class GeneralView(LogMixin, generic.TemplateView):
45 45  
46 46 self.createLog(actor = self.request.user)
47 47 context['months'] = self.get_last_twelve_months()
48   -
  48 + context['child_template'] = "dashboards/general_body.html"
  49 + context['javascript_files'] = ["analytics/js/charts.js", "dashboards/js/behavior.js"]
49 50 return context
50 51  
51 52 def get_last_twelve_months(self):
... ... @@ -83,6 +84,7 @@ class CategoryView(LogMixin, generic.TemplateView):
83 84 self.createLog(actor = self.request.user)
84 85  
85 86 context['categories'] = self.categories_associated_with_user(self.request.user)
  87 + context['javascript_files'] = ["analytics/js/charts.js", "dashboards/js/behavior.js"]
86 88  
87 89 return context
88 90  
... ... @@ -91,4 +93,48 @@ class CategoryView(LogMixin, generic.TemplateView):
91 93 categories = Category.objects.all()
92 94 else:
93 95 categories = Category.objects.filter(coordinators__in = [user])
94   - return categories
95 96 \ No newline at end of file
  97 + return categories
  98 +
  99 +class LogView(LogMixin, generic.TemplateView):
  100 + template_name = "dashboards/general.html"
  101 +
  102 + log_component = "admin_log"
  103 + log_action = "view"
  104 + log_resource = "admin_log"
  105 + log_context = {}
  106 +
  107 + def dispatch(self, request, *args, **kwargs):
  108 + return super(LogView, self).dispatch(request, *args, **kwargs)
  109 +
  110 + def get_context_data(self, **kwargs):
  111 + context = {}
  112 + self.createLog(actor = self.request.user)
  113 +
  114 + context['javascript_files'] = ['dashboards/js/logbehavior.js']
  115 + context['child_template'] = "dashboards/log.html"
  116 + return context
  117 +
  118 +
  119 +
  120 +def load_log_data(request):
  121 + params = request.GET
  122 + print(params)
  123 + init_date = datetime.strptime(params['init_date'], '%Y-%m-%d %H:%M')
  124 +
  125 + end_date = datetime.strptime(params['end_date'], '%Y-%m-%d %H:%M')
  126 +
  127 + if params.get('category'):
  128 + print("has category")
  129 + logs = Log.objects.filter(datetime__range = (init_date, end_date) )
  130 + logs = parse_log_queryset_to_JSON(logs)
  131 + return JsonResponse(logs, safe=False)
  132 +
  133 +
  134 +def parse_log_queryset_to_JSON(logs):
  135 + data = []
  136 + for log in logs:
  137 + datum = {}
  138 + datum['user'] = log.user
  139 +
  140 + data.append(datum)
  141 + return data
96 142 \ No newline at end of file
... ...