Module: Ckeditor
- Defined in:
- lib/ckeditor.rb,
lib/ckeditor/http.rb,
lib/ckeditor/utils.rb,
lib/ckeditor/engine.rb,
lib/ckeditor/version.rb,
lib/ckeditor/orm/base.rb,
lib/ckeditor/text_area.rb,
lib/ckeditor/orm/mongoid.rb,
lib/ckeditor/paginatable.rb,
lib/ckeditor/hooks/cancan.rb,
lib/ckeditor/hooks/pundit.rb,
lib/ckeditor/asset_response.rb,
lib/ckeditor/backend/refile.rb,
lib/ckeditor/backend/dragonfly.rb,
lib/ckeditor/backend/paperclip.rb,
lib/ckeditor/orm/active_record.rb,
lib/ckeditor/backend/carrierwave.rb,
lib/ckeditor/helpers/controllers.rb,
lib/ckeditor/helpers/form_helper.rb,
lib/ckeditor/helpers/view_helper.rb,
lib/ckeditor/helpers/form_builder.rb,
lib/ckeditor/utils/javascript_code.rb,
lib/ckeditor/utils/content_type_detector.rb,
lib/generators/ckeditor/install_generator.rb,
lib/generators/ckeditor/pundit_policy_generator.rb
Defined Under Namespace
Modules: ApplicationHelper, Backend, Generators, Helpers, Hooks, Http, Orm, Utils, Version Classes: ApplicationController, Asset, AssetResponse, AttachmentFile, AttachmentFilePolicy, AttachmentFilesController, Engine, Paginatable, Picture, PicturePolicy, PicturesController, TextArea
Constant Summary collapse
- IMAGE_TYPES =
%w(image/jpeg image/png image/gif image/jpg image/pjpeg image/tiff image/x-png)- DEFAULT_AUTHORIZE =
Proc.new {}
- AUTHORIZATION_ADAPTERS =
{}
- DEFAULT_CURRENT_USER =
Proc.new do request.env["warden"].try(:user) || respond_to?(:current_user) && current_user end
- @@image_file_types =
%w(jpg jpeg png gif tiff)- @@attachment_file_types =
%w(doc docx xls odt ods pdf rar zip tar tar.gz swf)- @@relative_path =
'ckeditor'- @@asset_path =
nil- @@assets =
nil- @@run_on_precompile =
true- @@parameterize_filenames =
true- @@default_per_page =
24- @@assets_languages =
nil- @@assets_plugins =
nil- @@picture_model =
Model classes
nil- @@attachment_file_model =
nil
Class Method Summary collapse
-
.assets ⇒ Object
All css and js files from ckeditor folder.
- .attachment_file_adapter ⇒ Object
- .attachment_file_model(&block) ⇒ Object
- .attachment_file_model=(value) ⇒ Object
-
.authorize_with(*args, &block) ⇒ Object
Setup authorization to be run as a before filter This is run inside the controller instance so you can setup any authorization you need to.
- .base_path ⇒ Object
-
.current_user_method(&block) ⇒ Object
Setup a different method to determine the current user or admin logged in.
- .picture_adapter ⇒ Object
- .picture_model(&block) ⇒ Object
- .picture_model=(value) ⇒ Object
- .root_path ⇒ Object
- .run_on_precompile? ⇒ Boolean
-
.setup {|_self| ... } ⇒ Object
Default way to setup Ckeditor.
Class Method Details
.assets ⇒ Object
All css and js files from ckeditor folder
107 108 109 |
# File 'lib/ckeditor.rb', line 107 def self.assets @@assets ||= Utils.select_assets("ckeditor", "vendor/assets/javascripts") << "ckeditor/init.js" end |
.attachment_file_adapter ⇒ Object
157 158 159 |
# File 'lib/ckeditor.rb', line 157 def self. .to_adapter end |
.attachment_file_model(&block) ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/ckeditor.rb', line 138 def self.(&block) if block_given? self. = block else ||= begin if .respond_to? :call .call else || Ckeditor::AttachmentFile end end end end |
.attachment_file_model=(value) ⇒ Object
152 153 154 155 |
# File 'lib/ckeditor.rb', line 152 def self.=(value) = nil = value end |
.authorize_with(*args, &block) ⇒ Object
Setup authorization to be run as a before filter This is run inside the controller instance so you can setup any authorization you need to.
By default, there is no authorization.
To use an authorization adapter, pass the name of the adapter. For example, to use with CanCan, pass it like this.
181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/ckeditor.rb', line 181 def self.(*args, &block) extension = args.shift if extension = Proc.new { = Ckeditor::AUTHORIZATION_ADAPTERS[extension].new(*([self] + args).compact) } else = block if block end || DEFAULT_AUTHORIZE end |
.base_path ⇒ Object
102 103 104 |
# File 'lib/ckeditor.rb', line 102 def self.base_path @base_path ||= (asset_path || File.join([Rails.application.config.assets.prefix, '/ckeditor/'])) end |
.current_user_method(&block) ⇒ Object
Setup a different method to determine the current user or admin logged in. This is run inside the controller instance and made available as a helper.
By default, request.env.user or current_user will be used.
207 208 209 210 |
# File 'lib/ckeditor.rb', line 207 def self.current_user_method(&block) @current_user = block if block @current_user || DEFAULT_CURRENT_USER end |
.picture_adapter ⇒ Object
134 135 136 |
# File 'lib/ckeditor.rb', line 134 def self.picture_adapter picture_model.to_adapter end |
.picture_model(&block) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/ckeditor.rb', line 115 def self.picture_model(&block) if block_given? self.picture_model = block else @@picture_model_class ||= begin if @@picture_model.respond_to? :call @@picture_model.call else @@picture_model || Ckeditor::Picture end end end end |
.picture_model=(value) ⇒ Object
129 130 131 132 |
# File 'lib/ckeditor.rb', line 129 def self.picture_model=(value) @@picture_model_class = nil @@picture_model = value end |
.root_path ⇒ Object
98 99 100 |
# File 'lib/ckeditor.rb', line 98 def self.root_path @root_path ||= Pathname.new(File.dirname(File.('../', __FILE__))) end |
.run_on_precompile? ⇒ Boolean
111 112 113 |
# File 'lib/ckeditor.rb', line 111 def self.run_on_precompile? @@run_on_precompile end |
.setup {|_self| ... } ⇒ Object
Default way to setup Ckeditor. Run rails generate ckeditor to create a fresh initializer with all configuration values.
94 95 96 |
# File 'lib/ckeditor.rb', line 94 def self.setup yield self end |