Sha256: 6f3096837d0a10083a56fe1fbc2712a27703c17110032b169656e531e5b5e76c

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

require 'rails_admin/config/fields/types/ck_editor'

module RailsAdmin
  module Config
    module Fields
      module Types
        class EnjoyHtml < RailsAdmin::Config::Fields::Types::CKEditor
          # Register field type for the type loader
          RailsAdmin::Config::Fields::Types::register(self)
          include RailsAdmin::Engine.routes.url_helpers

          register_instance_option :html_method do
            "#{name}_html"
          end

          register_instance_option :clear_method do
            "#{name}_clear"
          end

          register_instance_option :pretty_value do
            bindings[:object].send(html_method)
          end

          register_instance_option :form_value do
            {
              html: bindings[:object].send(html_method),
              clear: bindings[:object].send(clear_method)
            }
          end


          register_instance_option :formatted_value do
            pretty_value
          end

          register_instance_option :export_value do
            pretty_value
          end


          register_instance_option :boolean_view_helper do
            :check_box
          end

          register_instance_option :allowed_methods do
            [html_method, clear_method]
          end

          register_instance_option :partial do
            :enjoy_html
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
enjoy_cms-0.3.7 lib/enjoy/rails_admin_ext/enjoy_html.rb
enjoy_cms-0.3.6.2 lib/enjoy/rails_admin_ext/enjoy_html.rb
enjoy_cms-0.3.6.1 lib/enjoy/rails_admin_ext/enjoy_html.rb
enjoy_cms-0.3.6 lib/enjoy/rails_admin_ext/enjoy_html.rb
enjoy_cms-0.3.5 lib/enjoy/rails_admin_ext/enjoy_html.rb
enjoy_cms-0.3.4 lib/enjoy/rails_admin_ext/enjoy_html.rb