![]() # You may override this to support legacy schema. Rename_column :redactor_assets, :admin_user_id, :user_id Rename_column :redactor_assets, :user_id, :admin_user_id Overriding the authentication helpers in your controller.Ĭreate a new Migration: rails g rename_user_id_to_new_user_id # db/migrate/.rename_user_id_to_new_user_id.rbĬlass RenameUserIdToNewUserId < ActiveRecord::Migration ![]() Overriding the user class in an initializer.Run a migration to update the user_id column in the.To add it into the editor just add 'plugins' attributes to config.js file and specify which ones do you want to use: $('.redactor').redactor(īy default redactor-rails uses the User model. = require redactor-rails/plugins/fontfamilyĪfter including the desired plugins they can be configured in the redactor config file as normal. If you would prefer to pick and choose which plugins to include you canĪdd for example: //= require redactor-rails/plugins/fontsize To include all the plugins just add to your application.js: //= require redactor-rails/pluginsĪnd add to your application.css: *= redactor-rails/plugins This gem comes bundled with several Redactor plugins:įull details of these can be found at Redactor Plugins The above example will set the image to have a maximum width of 500px. If you want to set a maximum image size used when a user uploads an image via carrierwave, open the uploader file and add add the following: # app/uploaders/redactor_rails_picture_uploader.rb:33 Setting a max image size with carrierwave In you file app\assets\redactor-rails\config.js set option "lang":'zh_tw'Īdd to your application.js: //= require redactor-rails/langs/zh_tw If You Want To setup a new language in Redactor you should do two things: See the Redactor Documentation for a full list of configuration options. Then generate app\assets\redactor-rails\config.js. If you need change some config in redactor, you can $ rails generate redactor:config Gem "carrierwave-mongoid", :require => "carrierwave/mongoid"Īdd to your application.js: //= require redactor-railsĪdd to your application.css: *= require redactor-railsįor each textarea that you want to use with Redactor, add the "redactor" class and ensure it has a unique ID: "redactor", :rows => 40, :cols => 120 %> # User will choose only own uploaded Pictures and Documents # All uploaded files will stored with current user_id # Now, Pictures and Documents uploading available only for signed in users # -devise option generate user_id attribute for asset(Picture, Document) models. $ rails generate redactor:install -devise Now generate models for store uploading files ActiveRecord carrierwave gem "carrierwave" Or install it yourself as: $ gem install redactor-rails InstallationĪdd this line to your application's Gemfile: gem 'redactor-rails' Check Redactor's changelog for further updates. This gem bundles Redactor version 10.0.4 which is the most recent version as of January 9, 2015. ![]() ![]() The redactor-rails gem integrates the Redactor editor with the Rails 3.2 asset pipeline. Rails 3.2 Integration for Redactor (Devise Edition) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |