Module: Para::Admin::ResourcesHelper
- Defined in:
- app/helpers/para/admin/resources_helper.rb
Instance Method Summary collapse
Instance Method Details
#resource_form_path(resource) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/para/admin/resources_helper.rb', line 4 def resource_form_path(resource) if resource.new_record? resource_path(resource, :index) else resource_path(resource, :show) end end |
#resource_path(resource, action = :index) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/para/admin/resources_helper.rb', line 12 def resource_path(resource, action =:index) resource = resource.kind_of?(Class) ? resource.new : resource route_key = resource.class.model_name.route_key component_path = @component && @component.to_param id = resource.id if [:index, :show, :create, :update, :destroy].include?(action) action = nil end ["", "admin", component_path, route_key, id, action].compact.join('/') end |