summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-08-26 16:30:03 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-08-26 16:30:03 +0300
commit17af835387c996f82b46f3bade67d513b4e40cc5 (patch)
treea98fc3a53601ce398df32a723947d27daff9e3ff /app/controllers
parent4675ff46e8b1d354d86cdf80ac3bd4f60814dbe3 (diff)
downloadgitlab-ce-17af835387c996f82b46f3bade67d513b4e40cc5.tar.gz
Add event filter for group and project show pages
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb5
-rw-r--r--app/controllers/dashboard_controller.rb5
-rw-r--r--app/controllers/groups_controller.rb4
-rw-r--r--app/controllers/projects_controller.rb5
4 files changed, 12 insertions, 7 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 724122d4b93..b93bf0f98eb 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -155,4 +155,9 @@ class ApplicationController < ActionController::Base
redirect_to new_profile_password_path and return
end
end
+
+ def event_filter
+ filters = cookies['event_filter'].split(',') if cookies['event_filter'].present?
+ @event_filter ||= EventFilter.new(filters)
+ end
end
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index f6620b25818..23da2c274dc 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -66,9 +66,4 @@ class DashboardController < ApplicationController
def load_projects
@projects = current_user.authorized_projects.sorted_by_activity
end
-
- def event_filter
- filters = cookies['event_filter'].split(',') if cookies['event_filter'].present?
- @event_filter ||= EventFilter.new(filters)
- end
end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 60fc3f6b551..3378675692a 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -31,7 +31,9 @@ class GroupsController < ApplicationController
end
def show
- @events = Event.in_projects(project_ids).limit(20).offset(params[:offset] || 0)
+ @events = Event.in_projects(project_ids)
+ @events = event_filter.apply_filter(@events)
+ @events = @events.limit(20).offset(params[:offset] || 0)
@last_push = current_user.recent_push
respond_to do |format|
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 9b4fe5a9b5b..23b54ec44a8 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -55,7 +55,10 @@ class ProjectsController < Projects::ApplicationController
def show
limit = (params[:limit] || 20).to_i
- @events = @project.events.recent.limit(limit).offset(params[:offset] || 0)
+
+ @events = @project.events.recent
+ @events = event_filter.apply_filter(@events)
+ @events = @events.limit(limit).offset(params[:offset] || 0)
# Ensure project default branch is set if it possible
# Normally it defined on push or during creation