Sha256: 7cce37c6845db41132d53e0f760eae4e55f5f507aa1c216b1c6864fbe866fc1c

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

module RailsAdminSettings
  module RailsAdminConfig
    def self.included(base)
      if base.respond_to?(:rails_admin)
        base.rails_admin do
          navigation_label I18n.t('admin.settings.label')

          object_label_method do
            :label
          end

          list do
            if Object.const_defined?('RailsAdminToggleable')
              field :enabled, :toggle
            else
              field :enabled
            end
            field :label
            field :raw
            field :type
          end

          edit do
            field :enabled
            field :label do
              read_only true
              help false
            end
            field :type do
              read_only true
              help false
            end
            field :raw do
              partial "setting_value"
              visible do
                !bindings[:object].file_type?
              end
            end
            if Settings.file_uploads_supported
              field :file, Settings.file_uploads_engine do
                visible do
                  bindings[:object].file_type?
                end
              end
            end
          end
        end
      else
        puts "[rails_admin_settings] Problem: model does not respond to rails_admin: this should not happen"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_admin_settings-0.5.5 lib/rails_admin_settings/rails_admin_config.rb
rails_admin_settings-0.5.4 lib/rails_admin_settings/rails_admin_config.rb
rails_admin_settings-0.5.3 lib/rails_admin_settings/rails_admin_config.rb
rails_admin_settings-0.5.2 lib/rails_admin_settings/rails_admin_config.rb