Sha256: 69767d1fcd96157150251bcca8c82248026be28aef0522288cc601daecb0e916

Contents?: true

Size: 1.19 KB

Versions: 27

Compression:

Stored size: 1.19 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 == 'Enjoy::Page'
              if @object.fullpath.blank?
                redirect_to main_app.page_url(@object)
              else
                redirect_to @object.fullpath
              end
            elsif @object.class.name == 'Enjoy::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

27 entries across 27 versions & 1 rubygems

Version Path
enjoy_cms-0.3.7.4 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.7.3 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.7.2 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.7.1 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.7 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.6.2 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.6.1 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.6 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.5 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.4 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.3 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.2.1 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.2 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.1.2 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.1.1 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.1 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.0.4 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.0.3 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.3.0.2 lib/rails_admin/custom_show_in_app.rb
enjoy_cms-0.2.1 lib/rails_admin/custom_show_in_app.rb