Sha256: 8147eb7ba63a8d77e8a5bb5388297e4a9d947b61b832fdb351ec53c40ae56586
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
module Listings module ViewHelperMethods extend ActiveSupport::Concern included do def is_active_scope(scope) self.scope.name == scope.name end def url_for_scope(scope) view_context.listings.listing_full_url build_params(param_scope => scope.name) end def url_for_sort(name, direction) view_context.listings.listing_full_url build_params(param_sort_by => name, param_sort_direction => direction) end def url_for_format(format) view_context.listings.listing_export_url build_params(:format => format) end # TODO add url_for_filter that will build the search string def build_params(more_params) res = view_context.params.merge(:listing => self.name).merge(params).merge(more_params) res.delete param_page res.delete :controller res.delete :action res.with_indifferent_access end def no_data_message I18n.t 'listings.no_data', kind: kind end def export_message I18n.t 'listings.export' end def search_placeholder I18n.t 'listings.search_placeholder', kind: kind end def kind model_class.model_name.human.downcase.pluralize rescue I18n.t('listings.records') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
listings-0.1.7 | lib/listings/view_helper_methods.rb |
listings-0.1.6 | lib/listings/view_helper_methods.rb |
listings-0.1.5 | lib/listings/view_helper_methods.rb |