Commit 3cc0458312a0d230050b09679da80497052769c8

Authored by Alex Denisov
1 parent 0d9f73fa

Reloading of events via ajax instead of page reloading.

app/assets/javascripts/dashboard.js
... ... @@ -10,13 +10,20 @@ $(function(){
10 10  
11 11 function dashboardPage(){
12 12 $(".event_filter_link").bind('click',(function(){
13   - enableFilter(this.id);
  13 + toggleFilter($(this));
  14 + reloadActivities();
14 15 }));
15 16 }
16 17  
17   -function enableFilter(sender_id){
  18 +function reloadActivities(){
  19 + $('.content_list').html('');
  20 + Pager.init(20, true);
  21 +}
  22 +
  23 +function toggleFilter(sender){
  24 + sender.parent().toggleClass('inactive');
18 25 var event_filters = $.cookie('event_filter');
19   - var filter = sender_id.split('_')[0];
  26 + var filter = sender.attr('id').split('_')[0];
20 27 if (!event_filters) {
21 28 event_filters = new Array();
22 29 } else {
... ...
app/helpers/events_helper.rb
... ... @@ -29,7 +29,7 @@ module EventsHelper
29 29 end
30 30  
31 31 content_tag :div, class: "filter_icon #{inactive}" do
32   - link_to dashboard_path, class: 'has_tooltip event_filter_link', id: "#{key}_event_filter", 'data-original-title' => tooltip do
  32 + link_to 'javascript:void(0)', class: 'has_tooltip event_filter_link', id: "#{key}_event_filter", 'data-original-title' => tooltip do
33 33 image_tag "event_filter_#{key}.png"
34 34 end
35 35 end
... ...