Class: Praxis::Plugins::PaginationPlugin::Plugin
Instance Attribute Summary
#application, #block, #config, #config_attribute
Instance Method Summary
collapse
#after, #before, #options, #register_doc_browser_plugin
Instance Method Details
#config_key ⇒ Object
60
61
62
|
# File 'lib/praxis/plugins/pagination_plugin.rb', line 60
def config_key
:pagination
end
|
#load_config! ⇒ Object
64
65
66
|
# File 'lib/praxis/plugins/pagination_plugin.rb', line 64
def load_config!
@options || {}
end
|
#prepare_config!(node) ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/praxis/plugins/pagination_plugin.rb', line 68
def prepare_config!(node)
node.attributes do
attribute :max_items, Integer attribute :default_page_size, Integer, default: Praxis::Types::PaginationParams.default_page_size
attribute :paging_default_mode, Hash, default: Praxis::Types::PaginationParams.paging_default_mode
attribute :disallow_paging_by_default, Attributor::Boolean, default: Praxis::Types::PaginationParams.disallow_paging_by_default
attribute :disallow_cursor_by_default, Attributor::Boolean, default: Praxis::Types::PaginationParams.disallow_cursor_by_default
attribute :sorting do
attribute :enforce_all_fields, Attributor::Boolean, default: Praxis::Types::OrderingParams.enforce_all_fields
end
end
end
|
#setup! ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/praxis/plugins/pagination_plugin.rb', line 81
def setup!
config.each do |name, val|
if name == :sorting
val.each do |ordername, orderval|
Praxis::Types::OrderingParams.send(ordername, orderval)
end
else
Praxis::Types::PaginationParams.send(name, val)
end
end
end
|