summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-11-28 11:38:20 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-11-28 11:38:20 +0200
commit33aea41708b94f480b6eaad760e26abe17a37dfa (patch)
treea1e0620cb16192cbdb5ec3a36041a9a94a348194 /app/controllers
parent70c2e1d773291b4854da5a3b479baa352428bb4b (diff)
downloadgitlab-ce-33aea41708b94f480b6eaad760e26abe17a37dfa.tar.gz
Drop rjs from Infinite scrolling
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb14
-rw-r--r--app/controllers/dashboard_controller.rb2
-rw-r--r--app/controllers/groups_controller.rb2
-rw-r--r--app/controllers/projects/commits_controller.rb2
-rw-r--r--app/controllers/projects_controller.rb2
5 files changed, 18 insertions, 4 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 68ea636ccfe..94ce8e0616c 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -174,4 +174,18 @@ class ApplicationController < ActionController::Base
filters = cookies['event_filter'].split(',') if cookies['event_filter'].present?
@event_filter ||= EventFilter.new(filters)
end
+
+ # JSON for infinite scroll via Pager object
+ def pager_json(partial, count)
+ html = render_to_string(
+ partial,
+ layout: false,
+ formats: [:html]
+ )
+
+ render json: {
+ html: html,
+ count: count
+ }
+ end
end
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb
index ac319384434..17715020f87 100644
--- a/app/controllers/dashboard_controller.rb
+++ b/app/controllers/dashboard_controller.rb
@@ -22,7 +22,7 @@ class DashboardController < ApplicationController
respond_to do |format|
format.html
- format.js
+ format.json { pager_json("events/_events", @events.count) }
format.atom { render layout: false }
end
end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index bb46af14d52..fd0aa03476c 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -38,7 +38,7 @@ class GroupsController < ApplicationController
respond_to do |format|
format.html
- format.js
+ format.json { pager_json("events/_events", @events.count) }
format.atom { render layout: false }
end
end
diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb
index bdffc940ea5..12856191c26 100644
--- a/app/controllers/projects/commits_controller.rb
+++ b/app/controllers/projects/commits_controller.rb
@@ -16,7 +16,7 @@ class Projects::CommitsController < Projects::ApplicationController
respond_to do |format|
format.html # index.html.erb
- format.js
+ format.json { pager_json("projects/commits/_commits", @commits.size) }
format.atom { render layout: false }
end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 60003187a9d..1835671fe98 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -73,7 +73,7 @@ class ProjectsController < ApplicationController
render :show, layout: user_layout
end
end
- format.js
+ format.json { pager_json("events/_events", @events.count) }
end
end