![]() Push to the branch ( git push origin my-new-feature).Commit your changes ( git commit -am 'Added some feature').Create your feature branch ( git checkout -b my-new-feature).Redactor2_rails base on SammyLin/redactor-rails project. def redactor2_authenticate_user! authenticate_admin_user! # devise before_filterĮnd def redactor2_current_user current_admin_user # devise user helper devise_user %s(admin_user) # name of your user classĮnd # You may override this to support legacy schema.Įnd # app/controllers/application_controller.rbĬlass ApplicationController < ActionController :: Base. 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 Overriding the user class in an initializer.Run a migration to update the user_id column in the. ![]() To add it into the editor add 'plugins' attributes to config.js file and specify which ones do you want to use: $('.redactor').redactor(įull details of these can be found at Redactor Plugins Defining a Devise User Modelīy default redactor2_rails uses the User model. Using pluginsĪfter including the desired plugins they can be configured in the redactor config file as normal. 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/redactor2_rails_picture_uploader.rb:33 Setting a max image size with carrierwave Place lang files in the following location: ` app/assets/javascripts/langs/ `Īdd to your application.js: //= require langs/ru In you file app/assets/javascripts/redactor2_rails/config.js set option "lang":'ru' If You Want To setup a new language in Redactor you should do three things: See the Redactor Documentation for a full list of configuration options. Then generate app/assets/javascripts/redactor2_rails/config.js. If you need change some config in redactor, you can $ rails generate redactor2:config You need to put your textarea inside the form with authenticity_token field. Gem "carrierwave-mongoid", :require => "carrierwave/mongoid"Īdd to your application.js: //= require redactor2_railsĪdd to your application.css: *= require redactorįor each textarea that you want to use with Redactor,Īdd the "redactor" class and ensure it has a unique ID: "redactor", :rows => 40, :cols => 120 %> # User will choose only own uploaded Images and FilesĪdd this lines to your application's Gemfile: gem "carrierwave" # 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(Imeg, File) models. Or $ rails generate redactor2:install -devise Generate models for store uploading files ActiveRecord + carrierwaveĪdd this lines to your application's Gemfile: gem " carrierwave " gem " mini_magick "Īnd then execute: $ rails generate redactor2:install Or install it yourself as: $ gem install redactor2_rails ( ), download Redactor II files from them,Īnd place redactor.js file in the following location: ` app/assets/javascripts/ `Īnd redactor.css file in the following location: ` app/assets/stylesheets/ ` InstallationĪdd this line to your application's Gemfile: gem ' redactor2_rails ' In order to use this gem, you must purchase a license from Imperavi Redactor2_rails integrates Imperavi Redactor for Rails Asset Pipeline (Rails 4, 3.x versions are supported) Imperavi Redactor for Rails 3.x - 4 Asset Pipeline
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |