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.8.12 app/helpers/para/admin/resources_helper.rb
para-0.8.11 app/helpers/para/admin/resources_helper.rb
para-0.8.10 app/helpers/para/admin/resources_helper.rb
para-0.8.9 app/helpers/para/admin/resources_helper.rb
para-0.8.8 app/helpers/para/admin/resources_helper.rb
para-0.8.7 app/helpers/para/admin/resources_helper.rb
para-0.8.5 app/helpers/para/admin/resources_helper.rb
para-0.8.3.3 app/helpers/para/admin/resources_helper.rb
para-0.8.3.2 app/helpers/para/admin/resources_helper.rb
para-0.8.3.1 app/helpers/para/admin/resources_helper.rb
para-0.8.3 app/helpers/para/admin/resources_helper.rb
para-0.8.2.3 app/helpers/para/admin/resources_helper.rb
para-0.8.2.2 app/helpers/para/admin/resources_helper.rb
para-0.8.2.1 app/helpers/para/admin/resources_helper.rb
para-0.8.2 app/helpers/para/admin/resources_helper.rb
para-0.8.1 app/helpers/para/admin/resources_helper.rb
para-0.8.0 app/helpers/para/admin/resources_helper.rb
para-0.7.4.p1 app/helpers/para/admin/resources_helper.rb
para-0.7.4 app/helpers/para/admin/resources_helper.rb
para-0.7.3.p6 app/helpers/para/admin/resources_helper.rb