Commit a3e249ead0604bd3a3701a633e218326924d9dd5

Authored by Felipe Bormann
1 parent ae48710d

category selector dynamic update loop when it modifies

dashboards/static/dashboards/js/behavior.js
... ... @@ -4,7 +4,6 @@
4 4 $(document).ready(function(){
5 5 selectors_options.init();
6 6  
7   - //for month selector
8 7  
9 8 $('#month_selector').change(function(){
10 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 @@
  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 9  
10 10 {% block javascript %}
11 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 13 {% endblock javascript %}
13 14  
14 15 {% block breadcrumbs %}
... ... @@ -46,7 +47,7 @@
46 47 <h3>{{category.name}} {% trans "Category Report" %}</h3>
47 48 <select id="category-selector">
48 49 {% for category in categories %}
49   - <option>{{category.name}}</option>
  50 + <option value="{{category.id}}">{{category.name}}</option>
50 51 {% endfor %}
51 52 </select>
52 53 <ul id="report-header-options">
... ... @@ -60,6 +61,17 @@
60 61 </header>
61 62  
62 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 75 </article>
64 76 </section>
65 77 {% endblock content %}
66 78 \ No newline at end of file
... ...