Sha256: b4e6f05a07ff0a1fb85eab5eb792ed69c3d8f78f544b3670c272a6c5e8b44585
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true require 'active_support' require 'active_support/inflector' module ProxES module Helpers module Component include ActiveSupport::Inflector def dataset policy_scope(settings.model_class) end def list params['count'] ||= 10 params['page'] ||= 1 dataset.select.paginate(params['page'].to_i, params['count'].to_i) end def heading(action = nil) @headings ||= begin heading = titleize(demodulize(settings.model_class)) h = Hash.new(heading) h[:new] = "New #{heading}" h[:list] = pluralize heading h[:edit] = "Edit #{heading}" h end @headings[action] end def dehumanized settings.dehumanized || underscore(heading) end def base_path settings.base_path || "/_proxes/#{dasherize(view_location)}" end def view_location settings.view_location || underscore(pluralize(demodulize(settings.model_class))) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
proxes-0.5.2 | lib/proxes/helpers/component.rb |
proxes-0.5.1 | lib/proxes/helpers/component.rb |
proxes-0.5.0 | lib/proxes/helpers/component.rb |