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

2

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?

Shockley answered 29/4, 2013 at 5:2 Comment(3)
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?Shockley
Thanks likeitlikeit, but quite an important aspect of this question involves rails_admin integration... How do I edit these files in rails_adminShockley
@Shockley Scratch my previous comment, sorry for that. The proper answer is below.Retaliate
R
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.

Retaliate answered 5/5, 2013 at 19:9 Comment(2)
@Shockley Sorry, didn't really pay attention. This is of course also possible :) The correct answer is above.Retaliate
Thanks, and you're welcome! Have fun with wysiHTML5, its an awesome project.Retaliate
G
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

Gimbals answered 12/3, 2014 at 16:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.