Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to add an "Edit HTML" button to bootstrap-wysihtml5 when integrating with Rails_Admin?

The Rails_Admin wiki explains how to integrate with bootstrap-wysihtml5 which is incredibly easy.

However, I'd like the wysihtml5 widget to have the "edit as html" button.

Is this possible?

like image 539
andy Avatar asked Apr 29 '13 05:04

andy


2 Answers

You can configure wysihtml5 on a per-field basis like below. To e.g. enable the HTML editor feature, use

RailsAdmin.config do |config|
  config.model Team do
    edit do
      field :description, :text do
        bootstrap_wysihtml5 true
        bootstrap_wysihtml5_config_options :html => true
      end
    end
  end
end

This was added to Rails_admin a while ago, but they somehow forgot to update the Wiki.

like image 72
likeitlikeit Avatar answered Nov 02 '22 21:11

likeitlikeit


The above answer is now out of date with the current version of Rails Admin. You should use the following syntax to customize the editor:

field :description, :wysihtml5 do
  config_options :html => true
end

I have updated the wiki

like image 23
Tag0Mag0 Avatar answered Nov 02 '22 20:11

Tag0Mag0