ejholmes / active_admin_editor

Rich text editor for Active Admin using wysihtml5.
MIT License
184 stars 134 forks source link

Adds support for own toolbar and uploader templates #40

Closed codingluke closed 11 years ago

codingluke commented 11 years ago

Hi @ejholmes I came across this great gem. But for my client its very important to customize the UI. So I just added the possibility to configure the templates "toolbar" and "uploader". I also added a description. What do you thing about this?

Custom template paths

The toolbar and the uploader are client side templates (ejs) To customize these you can set custom paths your very own templates. Its important that the template has a different name then (toolbar or uploader)!

ActiveAdmin::Editor.configure do |config|
  config.template_paths = {
      toolbar: 'path to my custom toolbar template',
      uploader: 'path to my custom uploader template'
  }
end

Please check the original templates for an example app/assets/javascripts/active_admin/editor/templates

Make your templates available

Unfortunately sproket can not find templates from your asset folder when requireing them in a gem. So you have to make your templates manually avaliable.

//= require_tree ./path_to_your_templates
ejholmes commented 11 years ago

Hey @codingluke. I've been pretty busy, but I'll try to get a look at this sometime in the next week.

codingluke commented 11 years ago

Hi @ejholmes no problems just take you time!

ejholmes commented 11 years ago

So, I probably won't merge this. I think the issue is that we use require_tree instead of require. I think straight up requires would fix the problem so you could easily override the templates in your app.

codingluke commented 11 years ago

Your right I had this idee too. I just searched for a solution which dont bearks actual code. Im looking forward for your new solution.

codingluke commented 11 years ago

Oh, I missundersood it. Dont you think the require should be on the users asset pipeline for that the override works? I just have the feeling that I is not working because the require_tree is on the gems asset pipeline. I will also investigate in this by interest.