Commit 3096a6c42668cc588c54f9813d79be691d177d82
1 parent
521741fe
Exists in
master
and in
2 other branches
saving progress of today, finished design pattern of javascript modifications in…
… lists as well as one get call
Showing
6 changed files
with
87 additions
and
14 deletions
Show diff stats
analytics/static/.sass-cache/9bdb779ec82a4a96f72be09b83b7c997addd0129/general.sassc
No preview for this file type
analytics/static/analytics/general.css
... | ... | @@ -62,4 +62,16 @@ |
62 | 62 | .chart h4 { |
63 | 63 | color: #009688; } |
64 | 64 | |
65 | +.selector { | |
66 | + width: 80%; | |
67 | + height: 40px; | |
68 | + color: white; | |
69 | + padding-left: 5px; | |
70 | + background-color: #009688; | |
71 | + margin-top: 10px; | |
72 | + border-radius: 0px 20px 20px 0px; } | |
73 | + .selector p { | |
74 | + padding-top: 10px; | |
75 | + font-size: 16px; } | |
76 | + | |
65 | 77 | /*# sourceMappingURL=general.css.map */ | ... | ... |
analytics/static/analytics/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;;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,YAAY,EAAE,EAAE;MAChB,KAAK,EAAE,GAAG;MACV,KAAK,EAAE,KAAK;MAEZ,yCAAY;QACR,gBAAgB,EAAE,OAAO;QACzB,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,MAAM;QAClB,aAAa,EAAE,IAAI;MAEvB,gCAAG;QACC,gBAAgB,EAAE,OAAO;QACzB,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,MAAM;QACl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EAClB,UAAU,EAAE,2CAA2C;EACvD,MAAM,EAAE,IAAI;EACZ,aAAa,EAAE,IAAI;EACnB,KAAK,EAAE,OAAO;EACd,WAAW,EAAE,GAAG;EAChB,UAAU,EAAE,IAAI;EAEhB,yBAAE;IACE,WAAW,EAAE,EAAE;;AAEvB,eAAe;EACX,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;;AAEhB,UAAU;EACN,aAAa,EAAE,IAAI;EACnB,KAAK,EAAE,OAAO;EACd,KAAK,EAAE,IAAI;;AAIf,SAAS;EACL,KAAK,EAAE,OAAO;EACd,SAAS,EAAE,IAAI;;AAGnB,mBAAmB;EACf,UAAU,EAAE,iCAAmC;;AAEnD,MAAM;EACF,KAAK,EAAE,GAAG;EACV,KAAK,EAAE,IAAI;EACX,SAAE;IACE,KAAK,EA1EC,OAAO;;AA4ErB,SAAS;EACL,KAAK,EAAE,GAAG;EACV,MAAM,EAAE,IAAI;EACZ,KAAK,EAAE,KAAK;EACZ,YAAY,EAAE,GAAG;EACjB,gBAAgB,EAAE,OAAO;EACzB,UAAU,EAAE,IAAI;EAChB,aAAa,EAAE,iBAAiB;EAChC,WAAC;IACG,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI", | |
4 | 4 | "sources": ["general.sass"], |
5 | 5 | "names": [], |
6 | 6 | "file": "general.css" | ... | ... |
analytics/static/analytics/general.sass
... | ... | @@ -72,4 +72,16 @@ $title-color: #009688 |
72 | 72 | width: 30% |
73 | 73 | float: left |
74 | 74 | h4 |
75 | - color: $title-color | |
76 | 75 | \ No newline at end of file |
76 | + color: $title-color | |
77 | + | |
78 | +.selector | |
79 | + width: 80% | |
80 | + height: 40px | |
81 | + color: white | |
82 | + padding-left: 5px | |
83 | + background-color: #009688 | |
84 | + margin-top: 10px | |
85 | + border-radius: 0px 20px 20px 0px | |
86 | + p | |
87 | + padding-top: 10px | |
88 | + font-size: 16px | |
77 | 89 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,47 @@ |
1 | + | |
2 | +$(document).ready(function(){ | |
3 | + selectors_options.init(); | |
4 | +}); | |
5 | + | |
6 | + | |
7 | +var selectors_options = { | |
8 | + init: function(){ | |
9 | + selectors = $("div.selector"); | |
10 | + selectors.click(function(e){ | |
11 | + selectors_options.loadData(e.currentTarget); | |
12 | + }); | |
13 | + }, | |
14 | + loadData: function(e){ | |
15 | + if (e){ | |
16 | + if (e.attributes['data-url'].value == "subjects"){ | |
17 | + var url = "/analytics/most_accessed_subjects"; | |
18 | + } | |
19 | + } | |
20 | + if(url){ | |
21 | + $.get(url, function(dataset){ | |
22 | + return dataset; | |
23 | + }).done(function(data){ | |
24 | + selectors_options.modifyElement(e, data); | |
25 | + | |
26 | + }).fail(function(error){ | |
27 | + console.log("couldn't complete get request"); | |
28 | + }); | |
29 | + } | |
30 | + | |
31 | + | |
32 | + }, | |
33 | + modifyElement: function(e, data){ | |
34 | + var string_build = ""; | |
35 | + string_build += "<ul>"; | |
36 | + | |
37 | + data.forEach(function(datum){ | |
38 | + string_build += '<li class="most-accessed-item">' +datum.name+ ' ' + datum.count+ '</li>'; | |
39 | + }); | |
40 | + string_build += "</ul>"; | |
41 | + | |
42 | + $(e).append(string_build); | |
43 | + | |
44 | + e.attributes.open = True; | |
45 | + | |
46 | + }, | |
47 | +}; | ... | ... |
analytics/templates/analytics/general.html
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | |
9 | 9 | {% block javascript %} |
10 | 10 | <script type="text/javascript" src="{% static "analytics/js/charts.js" %}"></script> |
11 | + <script type="text/javascript" src=" {% static "analytics/js/behavior.js" %} "></script> | |
11 | 12 | {% endblock javascript %} |
12 | 13 | |
13 | 14 | {% block breadcrumbs %} |
... | ... | @@ -70,18 +71,19 @@ |
70 | 71 | </div> |
71 | 72 | |
72 | 73 | <div id="left-data-selector"> |
73 | - <ul> | |
74 | - <li> | |
75 | - {% trans "most accessed categories" %} | |
76 | - </li> | |
77 | - <li> | |
78 | - {% trans "most accessed subjects" %} | |
79 | - </li> | |
80 | - <li> | |
81 | - {% trans "most accessed resource" %} | |
82 | - </li> | |
83 | - </ul> | |
84 | - | |
74 | + | |
75 | + <div class="selector"> | |
76 | + <p> {% trans "most accessed categories" %} </p> | |
77 | + </div> | |
78 | + | |
79 | + <div class="selector" data-url="subjects"> | |
80 | + <p> {% trans "most accessed subjects" %} </p> | |
81 | + </div> | |
82 | + | |
83 | + <div class="selector"> | |
84 | + <p> {% trans "most accessed resource" %} </p> | |
85 | + </div> | |
86 | + | |
85 | 87 | </div> |
86 | 88 | |
87 | 89 | </div> | ... | ... |