]> source.dussan.org Git - redmine.git/commitdiff
Makes /projects API accept same pagination parameters as other API collection resources.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 23 Dec 2010 13:34:44 +0000 (13:34 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 23 Dec 2010 13:34:44 +0000 (13:34 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4572 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/projects_controller.rb
app/views/projects/index.api.rsb

index 7a4c71217a7fe93c78bcea89e88d83864e712d38..2547d61669ced5b7b7024fa29a826600a3cb29ec 100644 (file)
@@ -53,7 +53,9 @@ class ProjectsController < ApplicationController
         @projects = Project.visible.find(:all, :order => 'lft') 
       }
       format.api  {
-        @projects = Project.visible.find(:all, :order => 'lft')
+        @offset, @limit = api_offset_and_limit
+        @project_count = Project.visible.count
+        @projects = Project.visible.all(:offset => @offset, :limit => @limit, :order => 'lft')
       }
       format.atom {
         projects = Project.visible.find(:all, :order => 'created_on DESC',
index 4ffee934fa6edba986f5a8fac6a479766ce8c615..121300c12c2fb466dd7611645ab64498bb2c530b 100644 (file)
@@ -1,4 +1,4 @@
-api.array :projects do
+api.array :projects, api_meta(:total_count => @project_count, :offset => @offset, :limit => @limit) do
   @projects.each do |project|
     api.project do
       api.id          project.id