Sha256: f20854a326a6b5796b72246b6644f041a08f11d18251be2caf6809ba63571ce0

Contents?: true

Size: 721 Bytes

Versions: 59

Compression:

Stored size: 721 Bytes

Contents

module Para
  module Admin
    module ResourcesHelper
      def resource_form_path(resource)
        if resource.new_record?
          resource_path(resource, :index)
        else
          resource_path(resource, :show)
        end
      end

      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
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
para-0.12.4 app/helpers/para/admin/resources_helper.rb
para-0.12.3 app/helpers/para/admin/resources_helper.rb
para-0.12.2 app/helpers/para/admin/resources_helper.rb
para-0.12.1 app/helpers/para/admin/resources_helper.rb
para-0.12.0 app/helpers/para/admin/resources_helper.rb
para-0.11.4 app/helpers/para/admin/resources_helper.rb
para-0.11.3 app/helpers/para/admin/resources_helper.rb
para-0.11.2 app/helpers/para/admin/resources_helper.rb
para-0.11.1 app/helpers/para/admin/resources_helper.rb
para-0.11.0 app/helpers/para/admin/resources_helper.rb
para-0.10.0 app/helpers/para/admin/resources_helper.rb
para-0.9.4 app/helpers/para/admin/resources_helper.rb
para-0.9.3.3 app/helpers/para/admin/resources_helper.rb
para-0.9.3.2 app/helpers/para/admin/resources_helper.rb
para-0.9.3.1 app/helpers/para/admin/resources_helper.rb
para-0.9.2 app/helpers/para/admin/resources_helper.rb
para-0.9.0 app/helpers/para/admin/resources_helper.rb
para-0.8.15 app/helpers/para/admin/resources_helper.rb
para-0.8.14 app/helpers/para/admin/resources_helper.rb
para-0.8.13 app/helpers/para/admin/resources_helper.rb