9

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?

andy
  • 8,775
  • 13
  • 77
  • 122
  • I haven't. There's no config options anywhere (have you clicked on the link?) and all the documentation is javascript based. But this is integrated with rails_admin...? Any ideas? – andy Apr 29 '13 at 07:45
  • Thanks likeitlikeit, but quite an important aspect of this question involves rails_admin integration... How do I edit these files in rails_admin – andy May 05 '13 at 23:49
  • @andy Scratch my previous comment, sorry for that. The proper answer is below. – likeitlikeit May 06 '13 at 00:19

2 Answers2

6

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.

likeitlikeit
  • 5,563
  • 5
  • 42
  • 56
4

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

Tag0Mag0
  • 199
  • 2
  • 7