Module: Terrazzo::CollectionActionsHelper
- Defined in:
- app/helpers/terrazzo/collection_actions_helper.rb
Instance Method Summary collapse
Instance Method Details
#collection_item_actions(resource) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'app/helpers/terrazzo/collection_actions_helper.rb', line 3 def collection_item_actions(resource) resource_dashboard = "#{resource.class.name}Dashboard".safe_constantize&.new if resource_dashboard&.respond_to?(:collection_item_actions) resource_dashboard.collection_item_actions(resource, self) else default_collection_item_actions(resource) end end |
#has_many_pagination_paths(field, resource) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/terrazzo/collection_actions_helper.rb', line 12 def has_many_pagination_paths(field, resource) param_key = Terrazzo::HasManyPagination.param_key(field.attribute) base = request.query_parameters.merge( only_path: true, controller: controller_path, action: :show, id: resource.to_param, format: nil, props_at: "data.attributes.#{field.attribute}" ) { prevPagePath: (field.current_page > 1 ? url_for(base.merge(param_key => field.current_page - 1)) : nil), nextPagePath: (field.current_page < field.total_pages ? url_for(base.merge(param_key => field.current_page + 1)) : nil) } end |