GithubHelp home page GithubHelp logo

active_admin_editor's Introduction

Active Admin Editor

Build Status Code Climate

This is a wysiwyg html editor for the Active Admin interface using wysihtml5.

screenshot

Demo

Installation

Add the following to your Gemfile:

gem 'active_admin_editor'

And include the wysiwyg styles in your application.css:

//= require active_admin/editor/wysiwyg

Then run the following to install the default intializer:

$ rails g active_admin:editor

Usage

This gem provides you with a custom formtastic input called :html_editor to build out a wysihtml5 enabled input. All you have to do is specify the :as option for your inputs.

Example

ActiveAdmin.register Page do
  form do |f|
    f.inputs do
      f.input :title
      f.input :content, as: :html_editor
    end

    f.buttons
  end
end

Uploads

The editor supports uploading of assets directly to an S3 bucket. Edit the initializer that was installed when you ran rails g active_admin:editor.

ActiveAdmin::Editor.configure do |config|
  config.s3_bucket = '<your bucket>'
  config.aws_access_key_id = '<your aws access key>'
  config.aws_access_secret = '<your aws secret>'
  # config.storage_dir = 'uploads'
end

Then add the following CORS configuration to the S3 bucket:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <ExposeHeader>Location</ExposeHeader>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Configuration

You can configure the editor in the initializer installed with rails g active_admin:editor or you can configure the editor during ActiveAdmin.setup:

ActiveAdmin.setup do |config|
  # ...
  config.editor.aws_access_key_id = '<your aws access key>'
  config.editor.s3_bucket = 'bucket'
end

Parser Rules

Parser rules can be configured through the initializer:

ActiveAdmin::Editor.configure do |config|
  config.parser_rules['tags']['strike'] = {
    'remove' => 0
  }
end

Be sure to clear your rails cache after changing the config:

rm -rf tmp/cache

Heroku

Since some of the javascript files need to be compiled with access to the env vars, it's recommended that you add the user-env-compile labs feature to your app.

  1. Tell your rails app to run initializers on asset compilation

    # config/environments/production.rb
    config.initialize_on_precompile = true
  2. Add the labs feature

    heroku labs:enable user-env-compile -a myapp

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Tests

Run RSpec tests with bundle exec rake. Run JavaScript specs with bundle exec rake konacha:serve.

active_admin_editor's People

Contributors

ejholmes avatar exviva avatar inntran avatar julionc avatar mason-stewart avatar zohararad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

active_admin_editor's Issues

Internal Links are parsed out for src and href

The parser is removing internal links from src and href. The cases I have found look like this:

<img src="/image.png"> => <img alt="">

and

<a href="/file.pdf"> => <a target="_blank"></a>

Tried overriding the parser rules in config/active_admin_editor.rb with:

  config.parser_rules['tags']['img'] = { # allows iframes
      check_attributes: {
          width: 'numbers',
          alt: 'alt',
          src: 'src', # if you compiled master manually then change this from 'url' to 'src'
          height: 'numbers'
      }
  }

However, this just made the src to be parsed out even if it had http:// in it.

The documentation says internal links are allowed, so I am not sure what the issue is.

Heroku and image uploading

The image upload button is not showing up on heroku but it is locally. I followed the heroku specific instructions on the doc and s3 is setup and working locally.

Undefined mixin 'box-shadow'

The gem is currently unusable, due to a missing mixin, 'box-shadow'.

There is a pull request waiting, #62, that seems to deal with this problem.

image upload don't show up

I already configured my s3 in active_admin_editor.rb, and I typedActiveAdmin::Editor.configuration.s3_configured? in console and it's true.
But I still don't know where to upload my image, can you help me?

CORS error "Response for preflight is invalid (redirect)"

Hi,

I've follow the instruction in the docs. setup the aws credentials in initializers.
added cors configuration to the bucket but still get this error "Response for preflight is invalid (redirect)?

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

How do I handle this?
screen shot 2016-01-25 at 4 02 56 pm

Parser rules not being applied?

I'm trying to customize the buttons on the ribbon. According to the documentation, I've set up on initializers/active_admin_editor.rb just to test it:

ActiveAdmin::Editor.configure do |config|

  config.parser_rules['tags']['h1'] = {
    'remove' => 1
  }
  config.parser_rules['tags']['h2'] = {
    'remove' => 1
  }
  config.parser_rules['tags']['h3'] = {
    'remove' => 1
  }  
end

But no avail. I did

rm -rf tmp/cache

As suggested on the docs and I restarted the server several times, but still the change makes no effect, and the h1, h2, h3 buttons are still showing up. What could be the problem?

couldn't find file 'active_admin/editor/wysiwyg'

Hi, when I try to precompile my assets the rake task stops saying it can't find that stylesheet.
I followed all the instructions, but it doesn't work.

[ngw@number13:~/sportboom-core]$ rake assets:precompile:all --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
couldn't find file 'active_admin/editor/wysiwyg'
(in /Users/ngw/sportboom-core/app/assets/javascripts/application.js:16)
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/context.rb:100:in resolve' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/context.rb:140:inrequire_asset'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:215:in process_require_directive' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:165:inblock in process_directives'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:163:in each' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:163:inprocess_directives'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:97:in evaluate' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/tilt-1.3.3/lib/tilt/template.rb:76:inrender'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/context.rb:177:in block in evaluate' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/context.rb:174:ineach'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/context.rb:174:in evaluate' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:12:ininitialize'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:in new' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:inblock in build_asset'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:262:in circular_call_protection' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:240:inbuild_asset'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/index.rb:89:in block in build_asset' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/caching.rb:19:incache_asset'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in build_asset' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:infind_asset'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in find_asset' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/bundled_asset.rb:16:ininitialize'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:244:in new' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:244:inbuild_asset'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/index.rb:89:in block in build_asset' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/caching.rb:19:incache_asset'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in build_asset' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:infind_asset'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in find_asset' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/environment.rb:74:infind_asset'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/sprockets/static_compiler.rb:23:in block in compile' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:212:inblock in each_logical_path'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:200:in block (2 levels) in each_file' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:ineach'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:190:in each_entry' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:198:inblock in each_file'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:in each' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:197:ineach_file'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.1.3/lib/sprockets/base.rb:210:in each_logical_path' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/sprockets/static_compiler.rb:18:incompile'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/sprockets/assets.rake:56:in internal_precompile' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/sprockets/assets.rake:70:inblock (3 levels) in <top (required)>'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in call' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:inblock in execute'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in each' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:inexecute'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in block in invoke_with_call_chain' /Users/ngw/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in invoke_with_call_chain' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:ininvoke'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.6/lib/sprockets/assets.rake:60:in block (3 levels) in <top (required)>' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:incall'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in block in execute' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:ineach'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in execute' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:inblock in invoke_with_call_chain'
/Users/ngw/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in invoke' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:ininvoke_task'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block (2 levels) in top_level' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:ineach'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block in top_level' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:instandard_exception_handling'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in top_level' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:inblock in run'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:inrun'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/bin/rake:33:in <top (required)>' /Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:inload'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in <main>' /Users/ngw/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:ineval'
/Users/ngw/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `

'
Tasks: TOP => assets:precompile:primary

Any guess?

Customizing toolbar

Is there any way to override an existing toolbar template or to use config for customization?

Custom CSS within editor

Images I upload are sometimes very large, I would like to set the style of the editor window to have images have a max-width of 100%

Undefined mixin 'box-shadow'.

I got error when I tried to use it (on Rails 5):

/.rvm/gems/ruby-2.4.0/bundler/gems/activeadmin-6411350c8abf/app/views/active_admin/resource/edit.html.arb where line #2 raised:

Undefined mixin 'box-shadow'.

active_admin.js loaded twice

Because lib/active_admin/editor/engine.rb calls ActiveAdmin.setup, which calls Application#register_default_assets, which unconditionally registers active_admin.js, I'm getting active_admin.js loaded twice on my page (first time it's registered in config/initializers/active_admin.rb).

I'm not sure if I should escalate it upstream to active admin, or if active admin editor should deal with it.

I'd be glad to provide a patch, if you have any suggestions @ejholmes .

Thanks for a great gem!

Uncaught ReferenceError: JST is not defined

Using Rails 3.2.22

Here's the console stack trace:

Uncaught ReferenceError: JST is not defined
at Editor._addToolbar (http://intranet.lvh.me:3000/assets/active_admin/editor/editor.js?body=1:29:20)
at new Editor (http://intranet.lvh.me:3000/assets/active_admin/editor/editor.js?body=1:13:10)
at HTMLLIElement.<anonymous> (http://intranet.lvh.me:3000/assets/jquery-ui.js?body=1:508:30)
at Function.each (http://intranet.lvh.me:3000/assets/jquery.js?body=1:658:23)
at init.each (http://intranet.lvh.me:3000/assets/jquery.js?body=1:267:17)
at init.$.fn.(anonymous function) [as editor] (http://intranet.lvh.me:3000/assets/jquery-ui.js?body=1:503:9)
at HTMLDocument.<anonymous> (http://intranet.lvh.me:3000/assets/active_admin/editor.js?body=1:6:36)
at fire (http://intranet.lvh.me:3000/assets/jquery.js?body=1:3065:30)
at Object.fireWith [as resolveWith] (http://intranet.lvh.me:3000/assets/jquery.js?body=1:3177:7)
at Function.ready (http://intranet.lvh.me:3000/assets/jquery.js?body=1:434:13)

Within editor.js it's referring to this method where JST is being referenced:

/**
  * Adds the wysihtml5 toolbar. If uploads are enabled, also adds the
  * necessary file inputs for uploading.
  */
 Editor.prototype._addToolbar = function() {
   var template = JST['active_admin/editor/templates/toolbar']({
     id: this.$el.attr('id') + '-toolbar'
   })

   this.$toolbar = $(template)

   if (config.uploads_enabled) {
     var _this = this
     this.$toolbar.find('input.uploadable').each(function() {
       _this._addUploader(this)
     })
   }

   this.$el.find('.wrap').prepend(this.$toolbar)
 }

I haven't done anything with the initialization file yet - I don't want to upload images. Do I still need to fill this out?

Not working with nested attributes

Maybe I'm missing some thing but let's say I have the following layout where I have :text in a nested field using as: :html_editor. This does not work. It only works if it's not a nested attribute i.e. :name. Any ideas how to fix?

form do |f|
	f.inputs "Section Details" do
		f.semantic_errors
		f.input :district, :collection => AbqDistricts::District.all.map {|u| [u.name, u.id]}, :include_blank => false
		f.input :name
		para "Do not use shortened urls e.g. 'http://bit.ly/1dNVPAW' for images. Only use full urls e.g. 'http://www.somewhere.com/someimage.jpg'", style: 'color:red;padding-left:10px;'
		f.inputs 'List Items' do 
			f.has_many :list_items do |item|
				item.input :item_type, as: :select, collection: ["", "list_item", "media", "text"], :include_blank => false, input_html: {onchange: "itemSelected(this)"}
				item.input :text, as: :html_editor
				item.input :link, input_html: {class: "item-select-type"}
			end
		end
	end
	f.actions
	end
end

Can't make it work in heroku

It's working locally but can't make it work in heroku. upload button doesn't show up.

I tried
config.assets.initialize_on_precompile = true
and
config.assets.initialize_on_precompile = false

I have all the AWS settings correct (it works locally).

I enabled the heroku lab feature with
heroku labs:enable user-env-compile -a myapp

Can you help please? Thanks.

a-tag nofollow attribute always inserted/loaded

Insert a link to the text.
Switch to the html view.
The link has the rel="nofollow" attribute.
Delete the rel attribute manually.
Save the Text.
Text in the db has no rel="nofollow" attribute.
Open the text again in the Active Admin view.
Switch to html view.
The link has now has a rel="nofollow" attribute again...

Using the active_admin_editor-0.3.6

  form do |f|
    f.inputs "Post" do
      f.input :text, as: :html_editor
    end
  end

Hosted @ heroku

Is there a config to allow following for every link? Did I missed something? Does heroku convert every link to a nofollow to prevent link farming?

ActionView::Template::Error ( isn't precompiled):

Started GET "/admin/posts/new" for 87.245.186.102 at 2013-02-20 13:11:52 +0000
Processing by Admin::PostsController#new as HTML
Rendered /home/shaelf/www/**********/shared/bundle/ruby/1.9.1/gems/activeadmin-0.5.1/app/views/active_admin/resource/new.html.arb (593.5ms)
Completed 500 Internal Server Error in 951ms

ActionView::Template::Error ( isn't precompiled):
1: insert_tag renderer_for(:new)
app/admin/posts.rb:14:in block (4 levels) in <top (required)>' app/admin/posts.rb:13:inblock (3 levels) in <top (required)>'
app/admin/posts.rb:12:in `block (2 levels) in <top (required)>'

ActiveAdmin.register Post do
  form do |f|
    f.inputs "Main" do
      f.input :title
      f.input :category
      f.input :lid, as: :html_editor
      f.input :text, as: :html_editor
      f.input :slug
    end
  end
end

gemspec is not vaild

I cant figure this out so last resort to post it here
The gemspec at /home/chris/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bundler/gems/active_admin_editor-86f964be3071/active_admin_editor.gemspec is not valid. The validation error was 'duplicate dependency on activeadmin (> 0.4.3, development), (>= 0.4.0) use:
add_runtime_dependency 'activeadmin', '
> 0.4.3', '>= 0.4.0'

let me know if/what you need

Weak documentation

Many folks trying to disable style filtering from tags, can't find solution and switch to ckeditor. I'm appreciate your gem much, but I'm not good in javascript and couldn't disable filtering as well.

I mean: I have code ike this <div class="page-slider-info__section"> when I paste it into your editor it becomes <div>. I can't into Rules section cause it weak documented.

Hope my feedback helps.

Uploading images from the editor returns nil dimensions.

When uploading images via Assets > Images, image uploads work fine. However, when using the uploader modal in the editor itself, carrierwave returns storage and dimensions as nil. The ImageAsset does save correctly, but it fails to process the uploaded image.

I poked around quite a bit, but nothing in the gem seems to be configured incorrectly. It's as if calling @image_asset.save! on line 51 of assets.rb doesn't care about the mount_uploader param in image_asset.rb

Any ideas?

Images not being added to text

the terminal seems to suggest things have gone okay:|

Started GET "/admin/image_assets.json" for 127.0.0.1 at 2012-12-05 12:07:08 +0000
 Processing by Admin::ImageAssetsController#index as JSON
  ImageAsset Load (0.9ms)  SELECT `assets`.* FROM `assets` WHERE `assets`.`type` IN  
  ('ImageAsset') ORDER BY `assets`.`id` desc LIMIT 30 OFFSET 0
Completed 200 OK in 118ms (Views: 1.0ms | ActiveRecord: 0.9ms)

but no image is shown in the body of the text.

Could this be related to my app already having an 'assets' table?

Issue with Strong Parameters??

I love this gem and have successfully used it for several years. For some reason, I just started getting this error:

ActionController::UnpermittedParameters in Admin::PostsController#create

I tried adding :_wysithml5_mode as a permitted param, but that did not work.

I'm running:

activeadmin 1.0.0.pre2
Rails 4.2.4
Ruby 2.2.3

Thanks in advance.

Allow Tags configuration via initializer

Hello,

I want to be able to emmed youtube videos using the iframe youtube provides, but in app/assets/javascripts/active_admin/editor/parser_rules.js, the iframe tag is set to 'remove=1'

If I understand it correctly, I need to make a fork of your project just to change that rule and possibly getting out of sync :( (If there is another way to insert videos, plese tell me)

I think it would be a great addition to be able to modify the tags section of the parser via the initializer used to set S3 options.

Could you enlighten me a bit about this issue, please?

Thanks

Localization

Thank you for the project.

Is there any way of localizing the editor controls?

bypass HTML generator

First of all, thank you for developing the gem, it's incredibly usefull in the projects I currently work, but I was wondering if there is a way to not generate a div tag when using the editor.

I ask this because I need to show part of the text in a view and there is the starting

tag always appearing in the view, which obviously shouldn't be there.
As a solution I tried putting <%= raw article_text %> but this instead messes up my markup.

Is there a way to not generate a div tag when using the editor?

Thanks.

Upload Image?

If I use the 1.0.5 gem, I am presented with the file selector button and can opt to upload an image. However, the image upload process fails. I have saved the CORS configuration to the bucket.

If I try using the 1.0.6 gem, I am never even presented with the option of uploading a file.

Any chance you have an idea of what I'm screwing up?

Sass::SyntaxError

I have tried use it and appear errors:

Sass::SyntaxError at /admin/articles/new
Undefined mixin 'box-shadow'.
  (in /home/pro/.rvm/gems/ruby-2.1.5@etf/gems/active_admin_editor-1.1.0/app/assets/stylesheets/active_admin/editor.css.scss:25)

Generator Fails without ActiveRecord

rails g active_admin:editor produces:

...active_record/connection_adapters/abstract/connection_pool.rb:404:in retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)`

because it somehow relies on active record even though it just moves a css file

many projects may stop including active record when using mongoid or alternatives

parser_rules

Hi! Can I somehow disable parser_rules?
It's remove all params from div
<div class="bar" style="width: 60%;"></div>
goes to
<div></div>

Problem with cache_classes = true

Deploying to heroku I've seen some problems when this is set to true.

For some reason, formtastic does not reload some classes when it's needed. So I see things like:

NoMethodError: undefined method `editor' for #<ActiveAdmin::Application:0x007f08134ae5f8>
ActionView::Template::Error (Unable to find input class HtmlEditorInput)
/app/config/initializers/active_admin_editor.rb:1:in `<top (required)>': uninitialized constant ActiveAdmin::Editor (NameError)

See: rails/spring#95 for references.

I was able to make a workaround for this error, prepending this to the initializer:

require 'active_admin_editor'
require "#{Gem::Specification.find_by_name("active_admin_editor").gem_dir}/app/inputs/html_editor_input"

This is problem an error more related to Formtastic than to this gem, but this should be useful for someone who has the same problem.

File not being uploading. "Failed to upload file. Have you configured S3 properly?"

I'm following your example but when it comes to the image it's doesn't work.

in my Gemfile

41 gem "activeadmin"
42
43 gem "rmagick"
44 gem 'fog'
45 gem "carrierwave"
46
47 gem 'active_admin_editor', :git => 'https://github.com/ejholmes/active_admin_editor.git'

My config
c/i/active_admin_editor.rb
1 ActiveAdmin::Editor.configure do |config|
2 config.s3_bucket = 'laguiltiere'
3 config.aws_access_key_id = 'AKIAJ5NKFSKSKGNYEYJQ'
4 config.aws_access_secret = 'xx'
5 config.storage_dir = 'uploads'
6 end

very simple setup that doesn't work, i'm missing something?

embedding video

Hi, I notice that pasting iframes for embedded videos doesn't work in source mode.
However this is active_admin, not a forum. We should be able to embed videos in our website news. So it makes sense in the original editor, but we have to override this behavior in active_admin_editor.

Error in core.js.coffee

There is an error in line:

      selectedScale = ->
        image_dialog.find('input[@name="asset_scale"]:checked').data('scale')

I think ther shouldn't be @ sign before name...

It occure with Uncaught Error: Syntax error, unrecognized expression: [@name="asset_scale"]:checked when clicked on image after upload.

Chrome 18.0.1025.168 (Developer Build 134367 Linux) Ubuntu 12.04 was used
active_admin_editor 0.3.5
active_admin 0.4.4

Image at center

Need center position when adding image.
And opportunity to translate gem. I'll translate it to Russian.

Pasting HTML into editor

When I click the source button and paste new HTML into it, it gets all screwed up. It gets removed, is missing specific parts. What causes this? What is the way to fix it?

Image uploading won't work

I thought I configured active_admin_editor correctly, but when I click the Image upload button, nothing happens. I looked at the network inspector and I can see a GET http://localhost:3000/admin/image_assets.json with a 500 response code every time I click on it.

I'm currently on Rails 3.2.8 with Active Admin 0.4.4

Not working for nested objects

Hey,

I'm using your great gem but unfortunately it doesn't seem to work for new nested objects.

This is how I use it in the config file /app/admin/issues.rb:
ActiveAdmin.register Issue do
...
form do |f|
...
f.has_many :topics do |t_f|
...
t_f.input :text, as: :html_editor
...
end
f.actions
end
end

Now, when I click "New Topic", the form appears but text is just a simple textarea. After saving and clicking on edit, the topic and the input text is loaded correctly. I think the JS and whatnot is not correctly loaded because the form is appended after DOM is loaded?

Issues when working with last rails and active_admin

Sometimes the 'upload a file' button is there, sometimes it is not there. When you click that button nothing happens, than u reload the page and the image is uploaded 3 times...
rails-3.2.8
activeadmin-0.5.0
last chrome and ff, ubuntu 12.04

mailto link not working

There is issue in adding mailto on any link rather than adding any url. Email id is get removed from the link and target="_blank" is added.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.