Sha256: c21a36cc68e0511042c4d97e816ef106712d9f9892e0c50881dfef13f3b583af

Contents?: true

Size: 1.18 KB

Versions: 39

Compression:

Stored size: 1.18 KB

Contents

module RailsAdmin
  module Config
    module Actions
      class CustomShowInApp < RailsAdmin::Config::Actions::Base
        RailsAdmin::Config::Actions.register(self)

        register_instance_option :member do
          true
        end

        register_instance_option :visible? do
          authorized? && (bindings[:controller].main_app.url_for(bindings[:object]) rescue false)
        end

        register_instance_option :controller do
          Proc.new do
            if @object.class.name == 'Page'
              if @object.fullpath.blank?
                redirect_to main_app.page_url(@object)
              else
                redirect_to @object.fullpath
              end
            elsif @object.class.name == 'News'
              redirect_to main_app.news_url(@object)
            elsif @object.class.name == 'Obj'
              redirect_to main_app.object_url(@object.category, @object)
            else
              redirect_to main_app.url_for(@object)
            end
          end
        end

        register_instance_option :link_icon do
          'icon-eye-open'
        end

        register_instance_option :pjax? do
          false
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
ack_rocket_cms-0.9.2 lib/rails_admin/custom_show_in_app.rb
ack_rocket_cms-0.9.1.3 lib/rails_admin/custom_show_in_app.rb
ack_rocket_cms-0.9.1.2 lib/rails_admin/custom_show_in_app.rb
ack_rocket_cms-0.9.1.1 lib/rails_admin/custom_show_in_app.rb
ack_rocket_cms-0.9.1 lib/rails_admin/custom_show_in_app.rb
ack_rocket_cms-0.9 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.9.1 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.13 lib/rails_admin/custom_show_in_app.rb
ack_rocket_cms-0.8.2 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.12 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.11 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.10 lib/rails_admin/custom_show_in_app.rb
ack_rocket_cms-0.8.0 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.9 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.8 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.7 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.6 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.5 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.4 lib/rails_admin/custom_show_in_app.rb
rocket_cms-0.8.3 lib/rails_admin/custom_show_in_app.rb