Module: Admin::ResourcesHelper
- Defined in:
- app/helpers/admin/resources_helper.rb
Instance Method Summary collapse
- #build_sidebar ⇒ Object
-
#resource_actions ⇒ Object
TODO: This method should be moved to
lib/typus/controller/actions.rb. -
#resources_actions ⇒ Object
TODO: This method should be moved to
lib/typus/controller/actions.rb. - #search(resource = @resource, params = params) ⇒ Object
- #sidebar_add_new(klass) ⇒ Object
Instance Method Details
#build_sidebar ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/admin/resources_helper.rb', line 14 def resources = ActiveSupport::OrderedHash.new app_name = @resource.typus_application admin_user.application(app_name).each do |resource| klass = resource.constantize if klass.(:hide_from_sidebar) == false resources[resource] = [(klass)].compact end end render "helpers/admin/resources/sidebar", :resources => resources if resources.any? end |
#resource_actions ⇒ Object
TODO: This method should be moved to lib/typus/controller/actions.rb
35 36 37 |
# File 'app/helpers/admin/resources_helper.rb', line 35 def resource_actions @resource_actions ||= [] end |
#resources_actions ⇒ Object
TODO: This method should be moved to lib/typus/controller/actions.rb
40 41 42 |
# File 'app/helpers/admin/resources_helper.rb', line 40 def resources_actions @resources_actions ||= [] end |
#search(resource = @resource, params = params) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/admin/resources_helper.rb', line 3 def search(resource = @resource, params = params) if (typus_search = resource.typus_defaults_for(:search)) && typus_search.any? hidden_filters = params.dup rejections = %w(controller action locale utf8 sort_order order_by search page) hidden_filters.delete_if { |k, v| rejections.include?(k) } render "helpers/admin/resources/search", :hidden_filters => hidden_filters end end |
#sidebar_add_new(klass) ⇒ Object
28 29 30 31 32 |
# File 'app/helpers/admin/resources_helper.rb', line 28 def (klass) if admin_user.can?("create", klass) { :message => Typus::I18n.t("Add New"), :url => { :action => "new" } } end end |