Sha256: 784ddc5c6827cc129a758856a276c4ce51eb7102c0083c8b99ef406c8c13ac27

Contents?: true

Size: 1.94 KB

Versions: 8

Compression:

Stored size: 1.94 KB

Contents

- if ['string', 'integer', 'phone', 'email', 'address', 'url', 'domain'].include?(@object.type)
  = form.text_field :raw, :value => field.value
- if @object.type == 'boolean'
  = form.check_box :raw, {:value => field.value}, 'true', 'false'
- if @object.type == 'color'
  = form.text_field :raw, :value => field.value, 'data-color' => true, style: "background-color: ##{field.value}"
- elsif %w(text yaml phones).include?( @object.type )
  = form.text_area :raw, :value => field.value, :rows => 10, :cols => 80
- elsif @object.type == 'code'
  :ruby
    #binding.pry
    js_data = {
      csspath: asset_path('ckeditor/plugins/codemirror/css/codemirror.min.css'),
      jspath: asset_path('ckeditor/plugins/codemirror/js/codemirror.min.js'),
      options:  {
        mode: 'htmlmixed',
        theme: 'monokai',
        lineNumbers: true
      },
      locations: {
        mode: asset_path('ckeditor/plugins/codemirror/js/codemirror.mode.htmlmixed.min.js'),
        theme: asset_path('ckeditor/plugins/codemirror/theme/monokai.css')
      }
    }

  = form.text_area field.method_name, field.html_attributes.reverse_merge(data: { richtext: 'codemirror', options: js_data.to_json }).reverse_merge({ value: field.form_value })
- elsif @object.type == 'html' || @object.type == 'sanitized'
  - if form.respond_to?(:cktext_area)
    = javascript_include_tag "ckeditor/init"
    = form.cktext_area :raw, :value => field.value, :rows => 10, :cols => 80
  - elsif Object.const_defined?('Rich')
    = form.text_area :raw, :value => field.value, :rows => 10, :cols => 80

    = javascript_include_tag "rich/base.js"
    :javascript
      var instance = CKEDITOR.instances['#{form.dom_id(field)}'];
      if(instance) { CKEDITOR.remove(instance); }
      CKEDITOR.replace('#{form.dom_id(field)}', #{Rich.options().to_json.html_safe});
  - else
    .alert.alert-error
      = t('admin.settings.no_ckeditor_detected')
    = form.text_area :raw, :value => field.value, :rows => 10, :cols => 80

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rails_admin_settings-1.3.2 app/views/rails_admin/main/_setting_value.html.haml
rails_admin_settings-1.3.1 app/views/rails_admin/main/_setting_value.html.haml
rails_admin_settings-1.3.0 app/views/rails_admin/main/_setting_value.html.haml
rails_admin_settings-1.2.1 app/views/rails_admin/main/_setting_value.html.haml
rails_admin_settings-1.2.0 app/views/rails_admin/main/_setting_value.html.haml
rails_admin_settings-1.1.4 app/views/rails_admin/main/_setting_value.html.haml
rails_admin_settings-1.1.3 app/views/rails_admin/main/_setting_value.html.haml
rails_admin_settings-1.1.2 app/views/rails_admin/main/_setting_value.html.haml