Module: Ckeditor

Defined in:
lib/ckeditor.rb,
lib/ckeditor/utils.rb,
lib/ckeditor/engine.rb,
lib/ckeditor/version.rb,
lib/ckeditor/formtastic.rb,
lib/ckeditor/middleware.rb,
lib/ckeditor/view_helper.rb,
lib/ckeditor/form_builder.rb,
lib/generators/ckeditor/base/base_generator.rb,
lib/generators/ckeditor/migration/migration_generator.rb

Defined Under Namespace

Modules: BaseHelper, FormBuilder, Utils, Version, ViewHelper Classes: Asset, AttachmentFile, AttachmentsController, BaseController, BaseGenerator, CustomFormBuilder, Engine, Middleware, MigrationGenerator, Picture, PicturesController

Constant Summary collapse

IMAGE_TYPES =
['image/jpeg', 'image/png', 'image/gif', 'image/jpg', 'image/pjpeg', 'image/tiff', 'image/x-png']
@@swf_file_post_name =
"data"
@@swf_image_file_types_description =
"Images"
@@swf_image_file_types =
"*.jpg;*.jpeg;*.png;*.gif"
@@swf_image_file_size_limit =
"5 MB"
@@swf_image_file_upload_limit =
10
@@swf_file_types_description =
"Files"
@@swf_file_types =
"*.doc;*.wpd;*.pdf;*.swf;*.xls"
@@swf_file_size_limit =
"10 MB"
@@swf_file_file_upload_limit =
5
@@public_uri =
"/uploads"
@@public_path =
"public/uploads"
@@file_manager_uri =
"/ckeditor/attachments"
@@file_manager_upload_uri =
"/ckeditor/attachments"
@@file_manager_image_upload_uri =
"/ckeditor/pictures"
@@file_manager_image_uri =
"/ckeditor/pictures"

Class Method Summary collapse

Class Method Details

.file_manager_file_model=(class_name) ⇒ Object

Set the file model reference object to access the files.



81
82
83
# File 'lib/ckeditor.rb', line 81

def self.file_manager_file_model=(class_name)
  @@file_model_ref = ActiveSupport::Dependencies.ref(class_name)
end

.file_manager_image_model=(class_name) ⇒ Object

Set the image model reference object to access the images.



66
67
68
# File 'lib/ckeditor.rb', line 66

def self.file_manager_image_model=(class_name)
  @@image_model_ref = ActiveSupport::Dependencies.ref(class_name)
end

.file_modelObject

Get the file class from the file reference object.



71
72
73
74
75
76
77
78
# File 'lib/ckeditor.rb', line 71

def self.file_model
  if self.class_variables.include?('@@file_model_ref')
    @@file_model_ref.get 
  else
    self.file_manager_file_model = "Ckeditor::AttachmentFile"
    @@file_model_ref.get
  end
end

.image_modelObject

Get the image class from the image reference object.



56
57
58
59
60
61
62
63
# File 'lib/ckeditor.rb', line 56

def self.image_model
  if self.class_variables.include?('@@image_model_ref')
    @@image_model_ref.get 
  else
    self.file_manager_image_model = "Ckeditor::Picture"
    @@image_model_ref.get
  end
end

.setup {|_self| ... } ⇒ Object

Default way to setup Ckeditor. Run rails generate ckeditor to create a fresh initializer with all configuration values.

Yields:

  • (_self)

Yield Parameters:

  • _self (Ckeditor)

    the object that the method was called on



87
88
89
# File 'lib/ckeditor.rb', line 87

def self.setup
  yield self
end