Sha256: ca3626d2cd70ab00f8488a85f17b0f1f759b3972992f1328f659a411cedf0408

Contents?: true

Size: 1007 Bytes

Versions: 2

Compression:

Stored size: 1007 Bytes

Contents

module Admin
  module ResourcesHelper

    include Admin::DisplayHelper
    include Admin::ListHelper
    include Admin::FiltersHelper
    include Admin::FormHelper
    include Admin::RelationshipsHelper
    include Admin::FilePreviewHelper
    include Admin::SearchHelper
    include Admin::SidebarHelper
    include Admin::TableHelper

    def display_link_to_previous(params = params)
      if params[:resource]

        item_class = params[:resource].typus_constantize
        url = { :controller => item_class.to_resource }

        if params[:resource_id]
          item = item_class.find(params[:resource_id])
          url.merge!(:action => 'edit', :id => item.id)
        else
          url.merge!(:action => 'new')
        end

        body = Typus::I18n.t("Cancel adding a new %{resource}?", :resource => @resource.model_name.human.downcase)

        render "admin/helpers/resources/display_link_to_previous",
               :body => body,
               :url => url
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typus-3.0.10 app/helpers/admin/resources_helper.rb
typus-3.0.9 app/helpers/admin/resources_helper.rb