Sha256: f934c4a44747a6436050a68bd495ee817f3845c3bd427a347fb9098b0d8c9b81

Contents?: true

Size: 1.38 KB

Versions: 15

Compression:

Stored size: 1.38 KB

Contents

require 'rails_admin/config/fields/base'

module RailsAdmin
  module Config
    module Fields
      module Types
        class CodeMirror < RailsAdmin::Config::Fields::Types::Text
          # Register field type for the type loader
          RailsAdmin::Config::Fields::Types.register(self)

          # Pass the theme and mode for Codemirror
          register_instance_option :config do
            {
              mode: 'css',
              theme: 'night',
            }
          end

          # Pass the location of the theme and mode for Codemirror
          register_instance_option :assets do
            {
              mode: '/assets/codemirror/modes/css.js',
              theme: '/assets/codemirror/themes/night.css',
            }
          end

          # Use this if you want to point to a cloud instances of CodeMirror
          register_instance_option :js_location do
            '/assets/codemirror.js'
          end

          # Use this if you want to point to a cloud instances of CodeMirror
          register_instance_option :css_location do
            '/assets/codemirror.css'
          end

          register_instance_option :partial do
            :form_code_mirror
          end

          [:assets, :config, :css_location, :js_location].each do |key|
            register_deprecated_instance_option :"codemirror_#{key}", key
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
rails_admin-1.3.0 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-1.2.0 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-1.1.1 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-1.1.0 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-1.0.0 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-1.0.0.rc lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-0.8.1 lib/rails_admin/config/fields/types/code_mirror.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/rails_admin-0.7.0/lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-0.7.0 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-0.6.8 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-0.6.7 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-0.6.6 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-0.6.5 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-0.6.4 lib/rails_admin/config/fields/types/code_mirror.rb
rails_admin-0.6.3 lib/rails_admin/config/fields/types/code_mirror.rb