projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Added support for offset and limit query parameters (?limit=x&offset=y) to workbenc...
[arvados.git]
/
apps
/
workbench
/
app
/
controllers
/
collections_controller.rb
diff --git
a/apps/workbench/app/controllers/collections_controller.rb
b/apps/workbench/app/controllers/collections_controller.rb
index d46ec0354ccba317211342dd60c0c0d692ba4333..01abbb4ee06828f8cf7b529f6bbf77b9bdead716 100644
(file)
--- a/
apps/workbench/app/controllers/collections_controller.rb
+++ b/
apps/workbench/app/controllers/collections_controller.rb
@@
-12,7
+12,19
@@
class CollectionsController < ApplicationController
Collection.where(any: ['contains', params[:search]])).
uniq { |c| c.uuid }
else
Collection.where(any: ['contains', params[:search]])).
uniq { |c| c.uuid }
else
- @collections = Collection.limit(100)
+ if params[:limit]
+ limit = params[:limit].to_i
+ else
+ limit = 100
+ end
+
+ if params[:offset]
+ offset = params[:offset].to_i
+ else
+ offset = 0
+ end
+
+ @collections = Collection.limit(limit).offset(offset)
end
@links = Link.limit(1000).
where(head_uuid: @collections.collect(&:uuid))
end
@links = Link.limit(1000).
where(head_uuid: @collections.collect(&:uuid))