Commit a3e249ead0604bd3a3701a633e218326924d9dd5
1 parent
ae48710d
Exists in
master
and in
2 other branches
category selector dynamic update loop when it modifies
Showing
3 changed files
with
23 additions
and
2 deletions
Show diff stats
dashboards/static/dashboards/js/behavior.js
@@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
4 | $(document).ready(function(){ | 4 | $(document).ready(function(){ |
5 | selectors_options.init(); | 5 | selectors_options.init(); |
6 | 6 | ||
7 | - //for month selector | ||
8 | 7 | ||
9 | $('#month_selector').change(function(){ | 8 | $('#month_selector').change(function(){ |
10 | $.get('/analytics/amount_active_users_per_day', {month: $(this).val() }).done(function(data){ | 9 | $.get('/analytics/amount_active_users_per_day', {month: $(this).val() }).done(function(data){ |
dashboards/static/dashboards/js/behavior_categories.js
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +$(document).ready(function(){ | ||
2 | + charts.most_used_tags('/analytics/get_category_tags/?category_id='+$("#category-selector").val()); | ||
3 | + | ||
4 | + $("#category-selector").on("change", function(e){ | ||
5 | + //when it changes, the tag chart is replaced and all others are. | ||
6 | + category_id = $(e.target).val(); | ||
7 | + charts.most_used_tags('/analytics/get_category_tags/?category_id='+category_id); | ||
8 | + }); | ||
9 | +}); | ||
10 | + |
dashboards/templates/dashboards/category.html
@@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
9 | 9 | ||
10 | {% block javascript %} | 10 | {% block javascript %} |
11 | <script type="text/javascript" src="{% static "analytics/js/charts.js" %}"></script> | 11 | <script type="text/javascript" src="{% static "analytics/js/charts.js" %}"></script> |
12 | + <script type="text/javascript" src="{% static "dashboards/js/behavior_categories.js" %}"></script> | ||
12 | {% endblock javascript %} | 13 | {% endblock javascript %} |
13 | 14 | ||
14 | {% block breadcrumbs %} | 15 | {% block breadcrumbs %} |
@@ -46,7 +47,7 @@ | @@ -46,7 +47,7 @@ | ||
46 | <h3>{{category.name}} {% trans "Category Report" %}</h3> | 47 | <h3>{{category.name}} {% trans "Category Report" %}</h3> |
47 | <select id="category-selector"> | 48 | <select id="category-selector"> |
48 | {% for category in categories %} | 49 | {% for category in categories %} |
49 | - <option>{{category.name}}</option> | 50 | + <option value="{{category.id}}">{{category.name}}</option> |
50 | {% endfor %} | 51 | {% endfor %} |
51 | </select> | 52 | </select> |
52 | <ul id="report-header-options"> | 53 | <ul id="report-header-options"> |
@@ -60,6 +61,17 @@ | @@ -60,6 +61,17 @@ | ||
60 | </header> | 61 | </header> |
61 | 62 | ||
62 | <article class="report-body"> | 63 | <article class="report-body"> |
64 | + | ||
65 | + <section id="most-used-tags"> | ||
66 | + <header id="most-used-tags-header"> | ||
67 | + <h4 > | ||
68 | + {% trans "most used tags" %} | ||
69 | + </h4> | ||
70 | + </header> | ||
71 | + <div id="most-used-tags-body"> | ||
72 | + | ||
73 | + </div> | ||
74 | + </section> | ||
63 | </article> | 75 | </article> |
64 | </section> | 76 | </section> |
65 | {% endblock content %} | 77 | {% endblock content %} |
66 | \ No newline at end of file | 78 | \ No newline at end of file |