Class: Ckeditor::AssetResponse
- Inherits:
-
Object
- Object
- Ckeditor::AssetResponse
- Includes:
- ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::TagHelper
- Defined in:
- lib/ckeditor/asset_response.rb
Constant Summary collapse
- FUNCTION =
'window.parent.CKEDITOR.tools.callFunction'
- JSON_TYPE =
'json'
Instance Attribute Summary collapse
-
#asset ⇒ Object
readonly
Returns the value of attribute asset.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #ckeditor? ⇒ Boolean
- #current_mode ⇒ Object
- #data ⇒ Object
- #errors ⇒ Object
- #file ⇒ Object
-
#initialize(asset, request) ⇒ AssetResponse
constructor
A new instance of AssetResponse.
- #json? ⇒ Boolean
- #success(relative_url_root = nil) ⇒ Object
Constructor Details
#initialize(asset, request) ⇒ AssetResponse
Returns a new instance of AssetResponse.
16 17 18 19 20 |
# File 'lib/ckeditor/asset_response.rb', line 16 def initialize(asset, request) @asset = asset @request = request @params = request.params end |
Instance Attribute Details
#asset ⇒ Object (readonly)
Returns the value of attribute asset.
14 15 16 |
# File 'lib/ckeditor/asset_response.rb', line 14 def asset @asset end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
14 15 16 |
# File 'lib/ckeditor/asset_response.rb', line 14 def params @params end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
14 15 16 |
# File 'lib/ckeditor/asset_response.rb', line 14 def request @request end |
Instance Method Details
#ckeditor? ⇒ Boolean
30 31 32 |
# File 'lib/ckeditor/asset_response.rb', line 30 def ckeditor? !params[:CKEditor].blank? end |
#current_mode ⇒ Object
38 39 40 |
# File 'lib/ckeditor/asset_response.rb', line 38 def current_mode @current_mode ||= extract_mode end |
#data ⇒ Object
22 23 24 |
# File 'lib/ckeditor/asset_response.rb', line 22 def data @data ||= read_data end |
#errors ⇒ Object
46 47 48 |
# File 'lib/ckeditor/asset_response.rb', line 46 def errors send("errors_#{current_mode}") end |
#file ⇒ Object
34 35 36 |
# File 'lib/ckeditor/asset_response.rb', line 34 def file !(ckeditor? || json?) ? params[:qqfile] : params[:upload] end |
#json? ⇒ Boolean
26 27 28 |
# File 'lib/ckeditor/asset_response.rb', line 26 def json? params[:responseType] == JSON_TYPE end |
#success(relative_url_root = nil) ⇒ Object
42 43 44 |
# File 'lib/ckeditor/asset_response.rb', line 42 def success(relative_url_root = nil) send("success_#{current_mode}", relative_url_root) end |