| @@ -0,0 +1,58 @@ | ||
| # Use this hook to configure ckeditor | ||
| Ckeditor.setup do |config| | ||
| # ==> ORM configuration | ||
| # Load and configure the ORM. Supports :active_record (default), :mongo_mapper and | ||
| # :mongoid (bson_ext recommended) by default. Other ORMs may be | ||
| # available as additional gems. | ||
| require 'ckeditor/orm/active_record' | ||
|
|
||
| # Allowed image file types for upload. | ||
| # Set to nil or [] (empty array) for all file types | ||
| # By default: %w(jpg jpeg png gif tiff) | ||
| # config.image_file_types = %w(jpg jpeg png gif tiff) | ||
|
|
||
| # Allowed flash file types for upload. | ||
| # Set to nil or [] (empty array) for all file types | ||
| # By default: %w(jpg jpeg png gif tiff) | ||
| # config.flash_file_types = %w(swf) | ||
|
|
||
| # Allowed attachment file types for upload. | ||
| # Set to nil or [] (empty array) for all file types | ||
| # By default: %w(doc docx xls odt ods pdf rar zip tar tar.gz swf) | ||
| # config.attachment_file_types = %w(doc docx xls odt ods pdf rar zip tar tar.gz swf) | ||
|
|
||
| # Setup authorization to be run as a before filter | ||
| # By default: there is no authorization. | ||
| # config.authorize_with :cancan | ||
|
|
||
| # Override parent controller CKEditor inherits from | ||
| # By default: 'ApplicationController' | ||
| # config.parent_controller = 'MyController' | ||
|
|
||
| # Asset model classes | ||
| # config.picture_model { Ckeditor::Picture } | ||
| # config.attachment_file_model { Ckeditor::AttachmentFile } | ||
|
|
||
| # Paginate assets | ||
| # By default: 24 | ||
| # config.default_per_page = 24 | ||
|
|
||
| # Customize ckeditor assets path | ||
| # By default: nil | ||
| # config.asset_path = 'http://www.example.com/assets/ckeditor/' | ||
|
|
||
| # To reduce the asset precompilation time, you can limit plugins and/or languages to those you need: | ||
| # By default: nil (no limit) | ||
| # config.assets_languages = ['en', 'uk'] | ||
| # config.assets_plugins = ['image', 'smiley'] | ||
|
|
||
| # CKEditor CDN | ||
| # More info here http://cdn.ckeditor.com/ | ||
| # By default: nil (CDN disabled) | ||
| # config.cdn_url = '//cdn.ckeditor.com/4.6.1/standard/ckeditor.js' | ||
|
|
||
| # JS config url | ||
| # Used when CKEditor CDN enabled | ||
| # By default: "ckeditor/config.js" | ||
| # config.js_config_url = 'ckeditor/config.js' | ||
| end |
| @@ -0,0 +1,56 @@ | ||
| RailsAdmin.config do |config| | ||
|
|
||
| ### Popular gems integration | ||
|
|
||
| ## == Devise == | ||
| # config.authenticate_with do | ||
| # warden.authenticate! scope: :user | ||
| # end | ||
| # config.current_user_method(&:current_user) | ||
|
|
||
| ## == Cancan == | ||
| # config.authorize_with :cancan | ||
|
|
||
| ## == Pundit == | ||
| # config.authorize_with :pundit | ||
|
|
||
| ## == PaperTrail == | ||
| # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0 | ||
|
|
||
| ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration | ||
|
|
||
| ## == Gravatar integration == | ||
| ## To disable Gravatar integration in Navigation Bar set to false | ||
| # config.show_gravatar true | ||
|
|
||
| config.authorize_with do |controller| | ||
| redirect_to main_app.root_path unless current_user | ||
| end | ||
|
|
||
| config.model User do | ||
| edit do | ||
| # For RailsAdmin >= 0.5.0 | ||
| field :description, :ck_editor | ||
| # For RailsAdmin < 0.5.0 | ||
| # field :description do | ||
| # ckeditor true | ||
| # end | ||
| end | ||
| end | ||
|
|
||
| config.actions do | ||
| dashboard # mandatory | ||
| index # mandatory | ||
| new | ||
| export | ||
| bulk_delete | ||
| show | ||
| edit | ||
| delete | ||
| show_in_app | ||
|
|
||
| ## With an audit adapter, you can add: | ||
| # history_index | ||
| # history_show | ||
| end | ||
| end |
| @@ -1,4 +1,6 @@ | ||
| Rails.application.routes.draw do | ||
| mount Ckeditor::Engine => '/ckeditor' | ||
| mount RailsAdmin::Engine => '/admin', as: 'rails_admin' | ||
| devise_for :users | ||
| root to: 'pages#home' | ||
|
|
||
| @@ -0,0 +1,22 @@ | ||
| class CreateCkeditorAssets < ActiveRecord::Migration | ||
| def self.up | ||
| create_table :ckeditor_assets do |t| | ||
| t.string :data_file_name, null: false | ||
| t.string :data_content_type | ||
| t.integer :data_file_size | ||
| t.string :type, limit: 30 | ||
|
|
||
| # Uncomment it to save images dimensions, if your need it | ||
| t.integer :width | ||
| t.integer :height | ||
|
|
||
| t.timestamps null: false | ||
| end | ||
|
|
||
| add_index :ckeditor_assets, :type | ||
| end | ||
|
|
||
| def self.down | ||
| drop_table :ckeditor_assets | ||
| end | ||
| end |
| @@ -0,0 +1,5 @@ | ||
| class AddContentToArticle < ActiveRecord::Migration[5.0] | ||
| def change | ||
| add_column :articles, :content, :text | ||
| end | ||
| end |