Git Product home page Git Product logo

rich's Introduction

Rich

<img src=“https://github.com/kreativgebiet/rich/raw/master/app/assets/images/rich/rich.png” /> Rich is an opinionated implementation of CKEditor for Rails 3.2 and up. It includes a stripped down toolbar, simplified dialogs and a custom file manager. The file manager can also be used separate from CKEditor.

Presently, Rich integrates with Active Admin, Rails Admin and vanilla Formtastic (versions 1 and 2). Uploaded files can be stored on the filesystem, or on S3 (via Paperclips built-in S3 support).

Goals

  1. Keep the CKEditor source out of your project.

  2. Sensible defaults. We don’t want our users to insert tables, smilies or other frivolities that will do nothing but ruin a lovingly crafted design.

  3. Make it easy to customize these defaults.

  4. Implement a usable (and easily configurable) file manager that serves up images that fit your specific design.

  5. A good upload experience (multiple uploads, progress bars, pure html/js).

It should be noted that while a major point of this project was to remove many things from CKEditor, all that stuff is still in there and can be easily re-enabled.

Dependency Status

<img src=“https://gemnasium.com/kreativgebiet/rich.png” />

Quick install

Rich is available as a Ruby Gem, which makes installation very easy.

# In your Gemfile (Rails >= 3.2)
gem 'rich'
# the edge (unstable) version can be had using:
# gem 'rich', :git => 'https://github.com/kreativgebiet/rich.git'

# If you want to use Paperclip
gem 'paperclip'

# If you want to use CarrierWave
# Be sure to set config.backend = :carrierwave in config/initializers/rich.rb
gem 'carrierwave'

After updating your bundle, run the installer.

$> rails generate rich:install

The installer sets up a route, creates an initializer for configuration and adds a javascript and CSS file. It also creates a migration, so we need to migrate the database.

$> rake db:migrate

As a last step, secure the file manager by setting your authentication method in /config/initializers/rich.rb. If you’re using Devise with an AdminUser model (incidentally, the Active Admin defaults):

config.authentication_method = :authenticate_admin_user!

You’re good to go.

Usage

Vanilla Formtastic

To use Rich, it’s javascript file must be loaded. By default, this is already setup for you because Rails loads all Javascript files through the require_tree . command in application.js. If you’ve removed that line, manually load rich by requiring it.

//= require rich

In your formtastic form, use :as => :rich to insert Rich. Like so:

<%= semantic_form_for @post do |f| %>
  <%= f.inputs do %>
    <%= f.input :name %>
    <%= f.input :title %>
    <%= f.input :featured_image, :as => :rich_picker %>
    <%= f.input :body, :as => :rich, :config => { :default_style => "myCrazyPaperclipStyle" } %>
  <% end %>
  <%= f.buttons do %>
    <%= f.commit_button %>
  <% end %>
<% end %>

Active Admin

Since Active Admin actually uses Formtastic, you can use it with Rich out of the box. In your model configuration file, set up your form like this. Make sure you add //= require rich to your app/assets/javascripts/active_admin.js.

form do |f|
  f.inputs "Basic info" do
    f.input :title
    f.input :featured_image, :as => :rich_picker, :config => { :style => 'width: 400px !important;' }
    f.input :body, :as => :rich, :config => { :width => '76%', :height => '400px' }
  end
  f.buttons
end

Rails Admin

Since 1.4.7, it is the user’s responsibility to create assets/javascripts/rails_admin/custom/ui.js and include rich

//= require rich/base

To use Rich in your RA forms, use the following in your initializer:

config.model Post do
  edit do
    field :title
    field :body, :rich_editor do
      config({
        :insert_many => true
      })
    end
  end
end

To use the image picker on a string field, do this:

field :title, :rich_picker do
  config({
    :allowed_styles => [:original],
    :view_mode => "list"
  })
end

Screenshots

This is the editor with default settings (shown here in Rails Admin). <img src=“https://github.com/kreativgebiet/rich/raw/master/screenshots/rich-editor-default.png” />

This is the file picker (Rich without CKEditor, again in Rails Admin). <img src=“https://github.com/kreativgebiet/rich/raw/master/screenshots/rich-picker.png” />

This is the file manager. <img src=“https://github.com/kreativgebiet/rich/raw/master/screenshots/rich-filemanager.png” />

Rich in production mode

Rich works just fine in production mode. To accommodate the structure of the CKEditor source, Rich extends the assets:precompile task to make sure the full CKEditor source tree is copied to your assets folder. So the following works as you would expect:

rake assets:precompile

Rich will also clean up these CKEditor files when you clean your assets. Like this:

rake assets:clean

Although generally not necessary, the underlying Rich tasks can be invoked directly.

rake rich:assetize_ckeditor
rake rich:clean_ckeditor

Configuration and overrides

Take a look at the generated rich.rb initializer and – if you want to dig deeper – the Rich sourcecode. The initializer guides you through the most important settings and configuration options.

Localization

Localization should be automatic. Rich uses the currently set locale (I18n.locale) for it’s editor and file browser.

CKEditor configuration

Rich attempts to provide you with a sensible set of buttons and capabilities. But of course, you might disagree. To that end, you can configure CKEditor through the config directive, either globally through the initializer, or per editor instance as an option.

Rich also includes a few settings that manipulate CKEditor settings, but are a bit easier to use. For example, you can set :allow_embeds to true to load a media embed plugin (think Youtube, Vimeo, etc.)

Editor styles

When you run the generator a css file is created for you in app/assets/stylesheets/rich/editor.css. Use this stylesheet to define the contents of the Styles drop down in CKEditor.

Image configuration & (re)processing

The styles you define in the initializer are passed to Paperclip directly, so the syntax is identical. See github.com/thoughtbot/paperclip/wiki/Thumbnail-Generation for more information. You can also set additional processing options using convert_options. See your Rich initializer for more information.

When you change styles after uploading files, you will need to re-process those old files. To accomplish this, run the following command (avoid the standard Paperclip task!).

rake rich:refresh_assets

Using the file manager without CKEditor

Besides from within the editor, the file manager can also be used on it’s own. See the rich_picker examples above.

When the field you connect the picker to defines a relation (i.e. it ends in _id), the picker will return a reference to Rich::RichFile object. If the field you connect the picker does not refine a relation but is instead a string, the picker will return a URL to the file chosen in the picker.

In the picker’s configuration (or globally in your initializer), you can optionally pass the following:

:hidden_input => true # hide the textfield that is populated with the file ID or URL. Handy when creating relations (since the ID doesn't tell you much).
:preview_size => '100px' # specify the bounding box of the image preview
:placeholder_image => image_path('placeholder.png') # show a placeholder image that will be replaced when an asset has been selected

You might use this in a relation like this in ActiveAdmin:

form do |f|
  f.inputs do
    f.input :title
  end
  f.has_many :assets do |asset_form|
    asset_form.input :rich_file_id, :as => :rich_picker, :config => {:style => 'width: 400px !important;', :hidden_input => true, :placeholder_image => image_path('placeholder.png'), :preview_size => '200px'}
  end
  f.buttons
end

Non-image uploads

To enable uploads of non-image files, set the following in your Rich initializer:

# enable document uploads. default is false.
config.allow_document_uploads = true
# restrict the type of files that can be uploaded. defaults to :all for no restrictions.
config.allowed_document_types = ['application/pdf']

This will enable a new button on your CKEditor toolbar where you can upload regular files. Keep in mind that even if an image is uploaded through this method, it will not go through any processing you might have set up for your images.

Non-image uploads also work from within the file picker when you pass in the :type => 'file' option. A Rails Admin example:

field :title, :rich_picker do
  config({
    :type => 'file',
    :allowed_styles => [:original] #only original makes sense for non-images
  })
end

Media embedding (Youtube, Vimeo, etc.)

Set :allow_embeds to true to enable an extra button on the CKEditor toolbar that enables you to insert embed code. This works by virtue of the MediaEmbed plugin for CKEditor. It’s not pretty, but it works.

Scoping (filtering in the file manager)

It is possible to limit the files available in the file manager to a more relevant subset. This subset can either be comprised of collection of your choosing, or be tied to the current object you are editing (this works by associating your objects type and its id with any uploaded files).

To scope the file manager to a collection of your choosing, pass the collection name into the :scoped configuration option. This collection name is just a string; pick anything you like. In Rails Admin:

field :cover_images, :rich_editor do
  config({
    :scoped => "book covers"
  })
end

To scope the filemanager to a specific object, simply pass in true. Again for Rails Admin:

field :body, :rich_editor do
  config({
    :scoped => true
  })
end

In the latter example (scoping to an object), it is up to you to determine if scoping is possible. For example, a new object has no id yet, so there is nothing to scope to (yet). You could hide Rich in that case, until the object has been saved. If you do enable Rich but there is no id to scope to, Rich will disable scoping until an id has been set. This will effectively hide any files previously uploaded (before the save), which is most likely not what you want. So think twice about using this option, and implement it correctly when you do.

Also note that none of this is secure. At all. It is purely meant as a convenience to save you from wading through tons of irrelevant files. If need to hide files from prying eyes, you need something else.

Uploading to S3

Paperclip (which Rich uses to handle uploads) supports S3 out of the box. Just add the following to your environment:

Paperclip::Attachment.default_options.merge!(
  :storage => :s3,
  :bucket => ENV['S3_BUCKET'],
  :url => "/system/:class/:attachment/:id/:style/:filename",
  :s3_credentials => {
    :access_key_id => ENV['S3_ACCESS_KEY_ID'],
    :secret_access_key => ENV['S3_SECRET_ACCESS_KEY']
  }
)

Planned features & ideas

  • drag & drop uploading

  • finding/filtering assets

  • live image cropping

  • live image rotation

Inspiration

Tools used

Contributing

Your contributions (small and large) are very welcome! Please fork the project, make your changes and send me a pull request. If you are considering adding new functionality, or if you found a bug, please open an issue on Github first.

Rich, the affluent editor. By Bastiaan Terhorst and the Contributors. Sponsored by Perceptor.

This project is licenced under the MIT License. See MIT-LICENSE for details.

rich's People

Contributors

a-ono avatar aderyabin avatar alepee avatar alexander-lazarov avatar bastiaanterhorst avatar benhutton avatar dalpo avatar danielwestendorf avatar davebrace avatar dunyakirkali avatar iduuck avatar jerefrer avatar jgv avatar joekur avatar kim3er avatar kirs avatar mackermedia avatar madyankin avatar miharekar avatar nitr avatar pefringant avatar pehlert avatar pgeraghty avatar preen avatar pzgz avatar reaktivo avatar renews avatar rheaton avatar seanpdoyle avatar tehplayer 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rich's Issues

S3 Hosting

How can I upload Images to an S3 host?

Custom Toolbar with "Rich file picker" button

Hi,

I trying to add some buttons in my toolbar like this ( on the rich.rb file include in a initializers folder ) :

config.editor[:toolbar] = 'Easy';

config.editor[:toolbar_Easy] =
  [
      ['Source','-','showblocks', 'ServerPreview', 'Preview'],
      ['Cut','Copy','Paste','PasteText','PasteFromWord'],
      ['Undo','Redo','-','SelectAll','RemoveFormat'],
      ['Templates'],
      ['Format', 'FontSize', 'TextColor', 'Font'], '/',
      ['Bold','Italic','Underline','Strike'], ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
      ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
      ['Link','Unlink','Anchor'],
      ['Table','HorizontalRule','Smiley','SpecialChar'],
      ['MediaEmbed', 'richfile'],
  ];

So now i try to add the "Browse and upload images" with 'richfile' as you can see at the end of the custom toolbar config.

But nothink appear and i can't find your default toolbar in your code.

Can you tell me where i could find your default toolbar config or the name of "Browse and upload images" plugins?

Thanks you.

nested dom question (twitter bootstrap grid imitation)

Hi!

I am trying to imitate twitter bootstrap dom for style purposes.

I've put styles in my editor.css, but once i've created my <div class='row'> and i try to insert a <div class='span4'> it over-rides the <div class='row'> element.

The dom I desire is as such:

<div class='row '>
    <div class='span4'> Some text </div>
    <div class='span8'> some other text </div>
</div>

If I go into the source tab and edit it there I can get it to work, but that's not ideal. Is there a good way around this? I'm not sure what approach to take, so any ideas are welcome!

Here are the relevant styles in my editor.css.less:

div.row {
  .clearfix();
  // extra 20 for padding
  width: 960px;
}


.spanning {
  float: left;
  margin-right: 20px;
}

div.row div.span4 {
  .spanning();
  width: 300px;
}

div.row div.span8 {
  .spanning();
  width: 620px;
}

div.row div.span3 {
  .spanning();
  width: 220px;
}

div.row div.span12 {
  .spanning();
  width: 940px;
}

Write an a example how to use without formtastic or Active Admin

I set on text area fields class 'rich_editor/edtior/rich' but CKEditor doesn't load. When i put custom id 'editor' on text area field and do this CKEDITOR.replace( 'editor' ) form firebug CKEditora is loaded. Can you write some example, how to use it without formtastic, please.

Precompile assets fails in production environment

When trying to run rake assets:precompile on my production environment during deployment, the asset precompilation fails due to what it sees as invalid CSS in one of the CKEditor CSS files...

$ rake assets:precompile RAILS_ENV=production
Rich - Copying CKEditor to your assets folder
mkdir -p /my/root/dir/public/assets/ckeditor
cp -r /my/root/dir/vendor/bundle/ruby/1.8/gems/rich-1.0.3/vendor/assets/ckeditor/ckeditor/. /my/root/dir/public/assets/ckeditor
mkdir -p /my/root/dir/public/assets/ckeditor-contrib
cp -r /my/root/dir/vendor/bundle/ruby/1.8/gems/rich-1.0.3/vendor/assets/ckeditor/ckeditor-contrib/. /my/root/dir/public/assets/ckeditor-contrib
/usr/bin/ruby /usr/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Invalid CSS after " +margin:": expected pseudoclass or pseudoelement, was " 2px 0; /* IE7 */"
  (in /my/root/dir/vendor/bundle/ruby/1.8/gems/rich-1.0.3/vendor/assets/ckeditor/ckeditor/_source/skins/kama/dialog.css)

Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/usr/bin/ruby /usr/bin/rake assets:precomp...]

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

Any workarounds for this?

Scoping the images to users

I'm wondering if i can show in the filemanager only images that belong to current_user ? I think this is somehow tied to scoping, but i dont understand how to achieve a result.
I noted there are owner_id and owner_type fields in Rich::RichFile model. Should i somehow set the owner_id to the current_user id and than retrieve images which have that id in their owner_id filed?
Could you clarify this to me please?
I use Rich with active_admin and by its own in pure views.
Thank you.

File Browser issues

I found some problems with File Browser. I can't fix them cause I haven't enough Rails knowledge, so far )

  1. There is a problem with deleting an image if File Browser translation strings absent.
  2. Files didn't deletes physically.
  3. When clicking at the bottom of the File Browser all text around becomes pink.

No route error on image upload dialogue in Active Admin

I am getting "No route matches {:controller=>"welcome"}" when selecting to upload an image from Active Admin. Form previously worked with a type of : file

Rails 3.2.8

Gemfile:

gem 'rails', '3.2.8'



gem 'mysql2'

gem 'json'


group :assets do
   gem 'sass-rails',   '~> 3.2.3'
   gem 'coffee-rails', '~> 3.2.1'



  gem 'compass-rails'
  gem 'zurb-foundation'

  gem 'uglifier', '>= 1.0.3'
end

gem 'will_paginate'
gem 'jquery-rails'
gem 'paperclip'
gem 'make_permalink'
gem 'money'
gem 'activeadmin'
gem 'rich'
gem "ckeditor", "3.7.3"
gem 'acts_as_list', '0.1.4'
gem 'activemerchant', '1.28.0'

Code from active admin:

f.inputs "Product Images" do 
      f.has_many :assets do |i| 
        i.input :attachment, 

                :as => :rich_picker, :config => {:style => 'width: 400px !important;', :hidden_input => true, :placeholder_image => image_path('placeholder.png'), :preview_size => '200px'},
                :multipart => true, 
                :label => "Image" 

      end
    end

Routes:

Loco::Application.routes.draw do

  mount Rich::Engine => '/rich', :as => 'rich'

  devise_for :users

  ActiveAdmin.routes(self)
  mount Ckeditor::Engine => "/ckeditor"
  devise_for :admin_users, ActiveAdmin::Devise.config

  match 'checkout' => 'checkout
  match 'basket' => 'basket
  match 'add_to_basket/:id' => 'basket
  match 'remove_from_basket/:id' => 'basket
  match 'offer_code/' => 'basket
  match 'update_cart/:id' => 'basket
  match 'check_basket' => 'basket

  match "blog" => "blogs
  match "post/:id" => "blogs
  match "blog/category/:name" => 'blogs
  resources :products do
    collection do
      get 'search'
    end
  end
  resources :product_categories
  root :to => 'welcome'
  match ':controller(/:action(/:id))(.:format)'
end

undefined local variable or method `files_path'

I am trying to use rich in my active_admin form, and get the Name Error undefined local variable or method `files_path' when I click on "Browse and Upload Images".

The error is here :

<div id="legacy-form"><%= form_for(@rich_asset, :url => files_path) do |f| %>
   <p><%= f.file_field :rich_file%></p>
  <%= f.submit("Upload") %>
 <% end %>

I am using Rich here :

= semantic_form_for [:admin, @blog] do |f|
    = f.inputs do
        = f.input :name, :label => "Blog Title", :input_html => {:size => 120}
        = f.input :body, :as => :rich, :config => { :width => "76%", :height => "400px" }
    = f.buttons :commit

Allow translations

Hi!

This is looking good I must say! It would be nice if the t method was used in views so we, from far far away, can translate your awesome gem :)

Ahh, saw that this was in "Planned features". Great :)

Issue with rich_editor.css

The gem looks for the file "editor.css" in the asset pipeline, but the css file is named "rich_editor.css". This generates an error with the stylesheet not being found.

Changing the filename of the css file to "app/assets/stylesheets/rich/editor.css" solves issue.

active admin style

Adding this style will make the picker look better for new versions of active admin (button and preview will align with inputs and not the label)

body.active_admin
  li.rich_picker a.button {
    margin-left: 20%;
    margin-top: 10px;
  }
  li.rich_picker .rich-image-preview {
    margin-left: 20%;
  }
}

Rich / Paperclip storage default -> filesystem

Hei everyone!

Sry for this question but how can I change the storage of uploaded files to default?

I once added some configuration for the S3 upload but I didn't need them anymore and deleted them. Now in production (after deploying) I don't have the "/system/rich/rich_files/..." directory anymore which means I can't upload any images from the backend.

Any ideas how to return to default options (upload path filesystem)?

NoMethodError (undefined method `authenticate_admin_user!' for #<Rich::FilesController>)

I get this error every time I run my app on heroku, and I get it sometimes in development unless I restart. I think the issue is your base Rich controller does not inherit from ApplicationController, but from ActionController::Base.
I am defined authenticate_admin_user! in my ApplicationController, so it's not defined.

To be honest, I have no idea how it works 'sometimes' in development.

Here is an example where you can specify the base controller in the app config:
Implemented in controller: https://github.com/plataformatec/devise/blob/master/app/controllers/devise_controller.rb
Set in config: https://github.com/plataformatec/devise/blob/master/lib/devise.rb#L191

I know older versions of devise just inherited from ApplicationController, so you could probably do that until someone requires something else.

Add Support for S3 through Paperclip

Hello. Before anything, sorry for my english. I'm not so good as i wish.

I love the fact that you guys used Paperclip for this great implementation of ckeditor, but i have a problem. I need to use S3 for use in Heroku, so i looked for the RichFile model code and i found this:

has_attached_file :rich_file,
                  :styles => Proc.new {|a| a.instance.set_styles },
                  :convert_options => Proc.new { |a| Rich.convert_options[a] }

There is no hook for add s3 options through the has_attached_file method. So i have a question: Is there a way for add s3 credentials to the has_attached_file method without forking the entire project or monkey-patching the RichFile model using class_eval?

Thanks you.

Don't know how to build task 'rich:install:migrations'

Getting a missing rake task on install.

$ rails generate rich:install
      create  config/initializers/rich.rb
       route  mount Rich::Engine => '/rich', :as => 'rich'
      create  app/assets/stylesheets/rich/editor.css
      create  app/assets/javascripts/rich.js
        rake  rich:install:migrations
rake aborted!
Don't know how to build task 'rich:install:migrations'

And heres a little about the environment:

$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.2]

$ gem list | grep 'rails\|rake\|rich'
coffee-rails (3.2.2)
jquery-rails (2.1.3)
rails (3.2.8)
rake (0.9.2.2)
rich (1.2.0)

Textarea width too large in firefox

Hi, in firefox 15.0.1 textarea for rich editor is too large when using it with active_admin 0.5.0. What i mean is that textarea is larger than the page container, therefore it causes scroll to appear at the bottom of the page.
Also, any progress with loading in IE?
Thanks.

Using S3?

In the original galetahub/ckeditor gem you could specify Paperclip to use S3 by editing models/ckeditor/attachment_file.rb. Can this be done with Rich too?

Route not found on upload

So I've installed the Gem and am mounting the engine, the WYSIWYG side works perfectly (with ActiveAdmin). However, when trying to upload from the file dialogue which all loads fine, I'm getting a routing error:

ActionController::RoutingError (No route matches [POST] "/rich/files/authenticity_token=bnRKfskN8ZdtOTNAWoc0reESW7wpeAEd9gBDTTAneYM=&simplified_type=image&scoped=false&scope_type=undefined&scope_id=undefined&qqfile=02.jpg")

Is anyone else experiencing this?

Rich 0.0.8 editor doesn't load in IE <= 9 post asset compilation

Hi there and thanks for making Rich, I really like it!

Running into an issue with my project https://github.com/whitecl/devotion-cms

In development mode, all versions of IE load the rich editor with no problems. However in production mode, IE <= 9 does not work correctly. The textarea element is not converted into an editor, but no Javascript errors are thrown. Production mode works fine in all non-IE browsers.

Is there any additional troubleshooting data I can provide to help?

Precompilation failed on Heroku

does rich support deployment on Heroku?

I'm trying to deploy to Heroku and I get this error message:

   Running: rake assets:precompile
   mkdir -p /tmp/build_16synbmkjnz1z/public/assets/ckeditor
   cp -r /tmp/build_16synbmkjnz1z/vendor/bundle/ruby/1.9.1/gems/rich-1.2.0/vendor/assets/ckeditor/ckeditor/. /tmp/build_16synbmkjnz1z/public/assets/ckeditor
   mkdir -p /tmp/build_16synbmkjnz1z/public/assets/ckeditor-contrib
   cp -r /tmp/build_16synbmkjnz1z/vendor/bundle/ruby/1.9.1/gems/rich-1.2.0/vendor/assets/ckeditor/ckeditor-contrib/. /tmp/build_16synbmkjnz1z/public/assets/ckeditor-contrib
   rake aborted!
   could not connect to server: Connection refused
   Is the server running on host "127.0.0.1" and accepting
   TCP/IP connections on port 5432?
   Tasks: TOP => environment
   (See full trace by running task with --trace)
   Rich - Copying CKEditor to your assets folder
   [RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it.
   Precompiling assets failed, enabling runtime asset compilation
   Injecting rails31_enable_runtime_asset_compilation
   Please see this article for troubleshooting help:
   http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting

using
gem 'rails_admin', "~> 0.1.2"
gem 'rich'

I cannot customize CKEditor buttons on ActiveAdmin

Hello!

I'm sorry to open this issue because maybe it is not an issue, but I can't seem to be able to change buttons on the editor.

I've tried overriding ckeditor's config.js and change "config.editor" on Rich's initializer. I'm stuck on this for about 4 days, and everything I've tried resulted in nothing.

Can I have some advice on this?

Thank you very much, looking forward for some help!

undefined method `custom_namespace='

I'm trying to follow the steps to make rich available, however I receive this error:

Rendered /Users/nicholaspufal/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.3.3/app/views/active_admin/resource/new.html.arb (5.7ms)
Completed 500 Internal Server Error in 66ms

ActionView::Template::Error (undefined method `custom_namespace=' for Rich::FormBuilder:Module):
  1: render renderer_for(:new)

I did migrate my database, and within my registered model, I did set the form correctly:

form do |f|
  f.inputs "Basic info:" do
    f.input :title
    f.input :content, :as => :rich
  end
  f.buttons
end

Any ideas?

Thanks

Custom plugin into ckeditor

Hello, I'm using the rich along with the Active Admin on a website and need to add a button to insert a "read more", insert the code a <!-- more ->
I looked at the code, but could not as I create this plugin for CKEditor and use the rich, as I do that?

When deploying to Heroku Cedar stack, App Crashes with "/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.7/lib/active_record/dynamic_matchers.rb:50:in `method_missing': undefined method `paginates_per' for Rich::RichFile(Table doesn't exist):Class (NoM

From the Heroku Logs:

/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.7/lib/active_record/dynamic_matchers.rb:50:in method_missing': undefined methodpaginates_per' for Rich::RichFile(Table doesn't exist):Class (NoMethodError)

/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.7/lib/active_record/dynamic_matchers.rb:50:in method_missing': undefined methodpaginates_per' for Rich::RichFile(Table doesn't exist):Class (NoMethodError)
2012-09-16T23:50:35+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rich-1.2.0/app/models/rich/rich_file.rb:13:in <class:RichFile>' 2012-09-16T23:50:35+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rich-1.2.0/app/models/rich/rich_file.rb:6:inmodule:Rich'
2012-09-16T23:50:35+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rich-1.2.0/app/models/rich/rich_file.rb:5:in `<top (required)>'

rich image association (instead of URL)

Hi!

We are working on moving to SSL, and currently everything is hard-coded to use the paperclip URL instead of a connection to the rich file itself.

Obviously, for inline connections we need to use the url (or have some sort of processor that calculates the url).
When I have a rich picker, I think I would rather have the association (or at least have the option) and then be able to generate the URL from that...so that I don't have to worry about migrating a bunch of data in my DB when I move to SSL.

I can dig through the code and look to see how to do this unless you know off-hand.

Thank you so much for being so responsive!

:rich_editor doesn't show existing content when added to field

I applied rich_editor to an existing field in my rails_admin config.

field :description, :rich_editor

When I start the app and view that record the description field is empty. Is there something I need to add within the config to see existing data in the field?

Thanks

files won't upload using the rich uploader

When I try to upload a file using the embedded uploader, the file doesn't get saved in the db and I get this error in the console:

Encoding::UndefinedConversionError ("\xFF" from ASCII-8BIT to UTF-8)

From what I can see it's something similar to the html5 upload bug, that was fixed here galetahub/ckeditor#8
I tried to temper with the gem and make the fix myself, but to no success.

I'm running rails3.1 on ruby 1.9.2-p290. ActiveAdmin 0.3.2 ( ebeigarts's fork) to make it work with formtastic 2 from here: https://github.com/mak-it/active_admin

Thanks a bunch!

No target/advanced tabs on link?

Is there a way to readd the target/advanced tabs on the link dialog? I can see where they're being removed at in rich.rb but I can't figure out a way to get these back in there.

LoadError

When I use:

<%= f.input :description, :as => :rich %>

I got the following error!

Expected /home/irfan/.rvm/gems/ruby-1.9.2-p320@xavy/gems/rich-1.3.1/app/inputs/rich_input.rb to define RichInput

Asset Pipeline with ActiveAdmin using external assets host

When using the assets pipeline using an external asset host the editor doesn't work and keeps trying to load the assets from the local domain.

In config/environments/production.rb

config.action_controller.asset_host = "http://assets.domain.com"

Using Rich file_picker without CKEditor

Can't understand how to use file_picker only.

Besides from within the editor, the file manager can also be used on it’s own. See the rich_picker examples above. One important thing to note is that this requires a string field on the receiving object. A direct connection to the Rich::RichFile object is not supported at this time.

Please provide an example of using.

get styled image

i add some option for image size (like thmb, medium, large etc)

In my controller i try get the medium image, but didnt success

if i add to the module
has_attached_image (like paperclip)

i got the error undefined method "image_file_name"

in short how can i get the image path to one of the size image

thanks!

Rich picker with type file (using active admin) has broken image

Here is my input:

f.input :tutorial, as: :rich_picker, config: { scoped: "tutorials", allowed_styles: [:original], type: 'file' }

I have updated the initializer-- everything is working, but the preview under the input is trying to load an image so I get a broken image tag.

Float issue

It seems that my Rich editor isn't floating correctly when using Active Admin: http://cl.ly/IdKR Of course I could hack it but wondered what the problem was? This is using both latest git repo versions of Rich and ActiveAdmin

File upload (:rich_picker) IE8

Hello everyone

I'm using the Rich Editor together with Rails Admin and configured a model "Document" in the Rails Admin initializer as following:

config.model Document do
    edit do
        fields :title, :category, :role
        field :upload, :rich_picker do
            config ({
               :type => 'file',
               :allowed_styles => [:original]                                                                                                                                                                                                                                    
            })
        end
    end
end

I also allowed document uploads and all document types in my rich initializer.

Now when I click on the "Select or upload" Button of the :upload field in the Rails Admin Backend, it doesn't open the rich file picker. Instead I am asked to download a file with the name "files" from my server.

Maybe I have to add, that when I want to upload a file within the rich text editor in the Backend, it opens the file picker but the files / pictures can't be uploaded.

It works without any problems in all browsers, except for the Internet Explorer 8 (I didn't test other versions because we actually use IE8 in my company).

I hope you guys could help me out with this problem.

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.