Class: Kaui::TagsController
- Inherits:
-
EngineController
- Object
- ApplicationController
- EngineController
- Kaui::TagsController
- Defined in:
- app/controllers/kaui/tags_controller.rb
Constant Summary
Constants included from EngineControllerUtil
EngineControllerUtil::SIMPLE_PAGINATION_THRESHOLD
Instance Method Summary collapse
Methods inherited from EngineController
#check_for_redirect_to_tenant_screen, #current_ability, #current_user, #options_for_klient, #populate_account_details, #retrieve_allowed_users_for_current_user, #retrieve_tenants_for_current_user
Instance Method Details
#index ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/controllers/kaui/tags_controller.rb', line 3 def index @search_query = params[:q] @ordering = params[:ordering] || (@search_query.blank? ? 'desc' : 'asc') @offset = params[:offset] || 0 @limit = params[:limit] || 50 @max_nb_records = @search_query.blank? ? Kaui::Tag.list_or_search(nil, 0, 0, ).pagination_max_nb_records : 0 end |
#pagination ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/kaui/tags_controller.rb', line 13 def pagination searcher = lambda do |search_key, offset, limit| Kaui::Tag.list_or_search(search_key, offset, limit, ) end data_extractor = lambda do |tag, column| [ tag.tag_id, tag.object_id, tag.object_type, tag.tag_definition_name ][column] end formatter = lambda do |tag| url_for_object = view_context.url_for_object(tag.object_id, tag.object_type) [ tag.tag_id, url_for_object ? view_context.link_to(tag.object_id, url_for_object) : tag.object_id, tag.object_type, tag.tag_definition_name ] end paginate searcher, data_extractor, formatter end |