ckeditor 3.5.3 → 3.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -36,7 +36,7 @@ Check "config/initializers/ckeditor.rb" for more configuration options:
36
36
 
37
37
  You can pass version of ckeditor to download (http://ckeditor.com/download/releases):
38
38
 
39
- rails generate ckeditor:base --version=3.5.2
39
+ rails generate ckeditor:base --version=3.5.4
40
40
 
41
41
  Generate ckeditor models for file upload support:
42
42
  For paperclip:
@@ -1,3 +1,6 @@
1
+ require 'rails'
2
+ require 'ckeditor'
3
+
1
4
  module Ckeditor
2
5
  class Engine < ::Rails::Engine
3
6
  initializer "ckeditor_engine.add_middleware" do |app|
@@ -8,9 +8,9 @@ module Ckeditor
8
8
  end
9
9
 
10
10
  def call(env)
11
- if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
11
+ if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave)\s+Flash/
12
12
  params = ::Rack::Utils.parse_query(env['QUERY_STRING'])
13
- env['HTTP_COOKIE'] = [ @session_key, ::Rack::Utils.escape(params[@session_key]) ].join('=').freeze unless params[@session_key].nil?
13
+ env['HTTP_COOKIE'] = [ @session_key, ::Rack::Utils.unescape(params[@session_key]) ].join('=').freeze unless params[@session_key].nil?
14
14
  end
15
15
  @app.call(env)
16
16
  end
@@ -2,7 +2,7 @@ module Ckeditor
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 5
5
- RELEASE = 3
5
+ RELEASE = 4
6
6
 
7
7
  def self.dup
8
8
  "#{MAJOR}.#{MINOR}.#{RELEASE}"
@@ -15,16 +15,16 @@ module Ckeditor
15
15
  # <%= ckeditor_textarea("object", "field", :index => "2") %>
16
16
  # <% end %>
17
17
  #
18
- def ckeditor_textarea(object, field, options = {})
18
+ def ckeditor_textarea(object_name, field, options = {})
19
19
  options = options.dup.symbolize_keys
20
20
 
21
- var = options.delete(:object) if options.key?(:object)
22
- var ||= @template.instance_variable_get("@#{object}")
21
+ object = options.delete(:object) if options.key?(:object)
22
+ object ||= @template.instance_variable_get("@#{object_name}")
23
23
 
24
- value = var.send(field.to_sym) if var
25
- value ||= options.delete(:value) || ""
26
-
27
- element_id = options.delete(:id) || ckeditor_element_id(object, field, options.delete(:index))
24
+ value = options.delete(:value) if options.key?(:value)
25
+ value ||= object.send(field)
26
+
27
+ element_id = options.delete(:id) || ckeditor_element_id(object_name, field, options.delete(:index))
28
28
  width = options.delete(:width) || '100%'
29
29
  height = options.delete(:height) || '100%'
30
30
 
@@ -50,7 +50,7 @@ module Ckeditor
50
50
 
51
51
  output_buffer = ActiveSupport::SafeBuffer.new
52
52
 
53
- output_buffer << ActionView::Base::InstanceTag.new(object, field, self, var).to_text_area_tag(textarea_options.merge(options))
53
+ output_buffer << ActionView::Base::InstanceTag.new(object_name, field, self, object).to_text_area_tag(textarea_options.merge(options))
54
54
 
55
55
  output_buffer << javascript_tag("if (CKEDITOR.instances['#{element_id}']) {
56
56
  CKEDITOR.remove(CKEDITOR.instances['#{element_id}']);}
@@ -71,8 +71,8 @@ module Ckeditor
71
71
 
72
72
  protected
73
73
 
74
- def ckeditor_element_id(object, field, index = nil)
75
- index.blank? ? "#{object}_#{field}_editor" : "#{object}_#{index}_#{field}_editor"
74
+ def ckeditor_element_id(object_name, field, index = nil)
75
+ [object_name, index, field, 'editor'].compact.join('_')
76
76
  end
77
77
 
78
78
  def ckeditor_applay_options(options={})
@@ -2,7 +2,7 @@ require 'rails/generators'
2
2
 
3
3
  module Ckeditor
4
4
  class BaseGenerator < Rails::Generators::Base
5
- class_option :version, :type => :string, :default => '3.5.3',
5
+ class_option :version, :type => :string, :default => '3.6',
6
6
  :desc => "Version of ckeditor which be install"
7
7
 
8
8
  def self.source_root
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ckeditor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 5
9
- - 3
10
- version: 3.5.3
9
+ - 4
10
+ version: 3.5.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Igor Galeta
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-01 00:00:00 +03:00
18
+ date: 2011-05-25 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -132,16 +132,6 @@ files:
132
132
  - lib/generators/ckeditor/migration/templates/models/paperclip/migration.rb
133
133
  - lib/generators/ckeditor/migration/templates/models/paperclip/picture.rb
134
134
  - lib/tasks/ckeditor_tasks.rake
135
- - examples/migrations/attachment_fu/create_assets.rb
136
- - examples/migrations/paperclip/create_assets.rb
137
- - examples/models/attachment_fu/asset.rb
138
- - examples/models/attachment_fu/attachment_file.rb
139
- - examples/models/attachment_fu/picture.rb
140
- - examples/models/paperclip/asset.rb
141
- - examples/models/paperclip/attachment_file.rb
142
- - examples/models/paperclip/picture.rb
143
- - examples/s3/attachment_file.rb
144
- - examples/s3/picture.rb
145
135
  has_rdoc: true
146
136
  homepage: http://github.com/galetahub/rails-ckeditor
147
137
  licenses: []
@@ -176,14 +166,5 @@ rubygems_version: 1.6.2
176
166
  signing_key:
177
167
  specification_version: 3
178
168
  summary: Rails plugin for integration ckeditor 3.x
179
- test_files:
180
- - examples/migrations/attachment_fu/create_assets.rb
181
- - examples/migrations/paperclip/create_assets.rb
182
- - examples/models/attachment_fu/asset.rb
183
- - examples/models/attachment_fu/attachment_file.rb
184
- - examples/models/attachment_fu/picture.rb
185
- - examples/models/paperclip/asset.rb
186
- - examples/models/paperclip/attachment_file.rb
187
- - examples/models/paperclip/picture.rb
188
- - examples/s3/attachment_file.rb
189
- - examples/s3/picture.rb
169
+ test_files: []
170
+
@@ -1,30 +0,0 @@
1
- class CreateAssets < ActiveRecord::Migration
2
- def self.up
3
- create_table :assets do |t|
4
- t.integer "parent_id"
5
- t.string "content_type"
6
- t.string "filename", :limit=>80
7
- t.string "thumbnail", :limit=>20
8
- t.integer "size"
9
- t.integer "width"
10
- t.integer "height"
11
- t.string "type", :limit=>40
12
- t.integer "user_id"
13
- t.integer "assetable_id"
14
- t.string "assetable_type", :limit=>40
15
-
16
- t.timestamps
17
- end
18
-
19
- add_index "assets", ["assetable_id", "assetable_type", "type"], :name => "ndx_type_assetable"
20
- add_index "assets", ["assetable_id", "assetable_type"], :name => "fk_assets"
21
- add_index "assets", ["parent_id", "type"], :name => "ndx_type_name"
22
- add_index "assets", ["thumbnail", "parent_id"], :name => "assets_thumbnail_parent_id"
23
- add_index "assets", ["user_id", "assetable_type", "assetable_id"], :name => "assets_user_type_assetable_id"
24
- add_index :assets, :user_id, :name=>"fk_user"
25
- end
26
-
27
- def self.down
28
- drop_table :assets
29
- end
30
- end
@@ -1,25 +0,0 @@
1
- class CreateAssets < ActiveRecord::Migration
2
- def self.up
3
- create_table :assets do |t|
4
- t.string :data_file_name
5
- t.string :data_content_type
6
- t.integer :data_file_size
7
-
8
- t.integer :assetable_id
9
- t.string :assetable_type, :limit=>25
10
- t.string :type, :limit=>25
11
-
12
- t.integer :user_id
13
-
14
- t.timestamps
15
- end
16
-
17
- add_index "assets", ["assetable_id", "assetable_type", "type"], :name => "ndx_type_assetable"
18
- add_index "assets", ["assetable_id", "assetable_type"], :name => "fk_assets"
19
- add_index "assets", ["user_id"], :name => "fk_user"
20
- end
21
-
22
- def self.down
23
- drop_table :assets
24
- end
25
- end
@@ -1,45 +0,0 @@
1
- class Asset < ActiveRecord::Base
2
-
3
- # === List of columns ===
4
- # id : integer
5
- # parent_id : integer
6
- # content_type : string
7
- # filename : string
8
- # thumbnail : string
9
- # size : integer
10
- # width : integer
11
- # height : integer
12
- # type : string
13
- # user_id : integer
14
- # assetable_id : integer
15
- # assetable_type : string
16
- # created_at : datetime
17
- # updated_at : datetime
18
- # =======================
19
-
20
- belongs_to :assetable, :polymorphic => true
21
-
22
- def url(*args)
23
- public_filename(*args)
24
- end
25
-
26
- def format_created_at
27
- I18n.l(self.created_at, :format=>"%d.%m.%Y %H:%M")
28
- end
29
-
30
- def to_xml(options = {})
31
- xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
32
-
33
- xml.tag!(self.read_attribute(:type).to_s.downcase) do
34
- xml.filename{ xml.cdata!(self.filename) }
35
- xml.size self.size
36
- xml.path{ xml.cdata!(self.public_filename) }
37
-
38
- xml.thumbnails do
39
- self.thumbnails.each do |t|
40
- xml.tag!(t.thumbnail, self.public_filename(t.thumbnail))
41
- end
42
- end unless self.thumbnails.empty?
43
- end
44
- end
45
- end
@@ -1,46 +0,0 @@
1
- class AttachmentFile < Asset
2
-
3
- # === List of columns ===
4
- # id : integer
5
- # parent_id : integer
6
- # content_type : string
7
- # filename : string
8
- # thumbnail : string
9
- # size : integer
10
- # width : integer
11
- # height : integer
12
- # type : string
13
- # user_id : integer
14
- # assetable_id : integer
15
- # assetable_type : string
16
- # created_at : datetime
17
- # updated_at : datetime
18
- # =======================
19
-
20
- belongs_to :user
21
-
22
- has_attachment :storage => :file_system, :path_prefix => 'public/attachments/files',
23
- :max_size => 10.megabytes
24
-
25
- validates_as_attachment
26
-
27
- named_scope :masters, :conditions => {:parent_id => nil}
28
-
29
- # Map file extensions to mime types.
30
- # Thanks to bug in Flash 8 the content type is always set to application/octet-stream.
31
- # From: http://blog.airbladesoftware.com/2007/8/8/uploading-files-with-swfupload
32
- def swf_uploaded_data=(data)
33
- data.content_type = MIME::Types.type_for(data.original_filename)
34
- self.uploaded_data = data
35
- end
36
-
37
- def full_filename(thumbnail = nil)
38
- file_system_path = self.attachment_options[:path_prefix]
39
- File.join(RAILS_ROOT, file_system_path, file_name_for(self.id))
40
- end
41
-
42
- def file_name_for(asset = nil)
43
- extension = filename.scan(/\.\w+$/)
44
- return "#{asset}_#{filename}"
45
- end
46
- end
@@ -1,46 +0,0 @@
1
- class Picture < Asset
2
-
3
- # === List of columns ===
4
- # id : integer
5
- # parent_id : integer
6
- # content_type : string
7
- # filename : string
8
- # thumbnail : string
9
- # size : integer
10
- # width : integer
11
- # height : integer
12
- # type : string
13
- # user_id : integer
14
- # assetable_id : integer
15
- # assetable_type : string
16
- # created_at : datetime
17
- # updated_at : datetime
18
- # =======================
19
-
20
- belongs_to :user
21
- has_attachment :content_type => :image,
22
- :storage => :file_system, :path_prefix => 'public/attachments/pictures',
23
- :max_size => 2.megabytes,
24
- :size => 0.kilobytes..2000.kilobytes,
25
- :processor => 'Rmagick',
26
- :thumbnails => { :content => '575>', :thumb => '100x100!' }
27
-
28
- validates_as_attachment
29
-
30
- named_scope :masters, :conditions=>"parent_id IS NULL", :order=>'filename'
31
-
32
- def url_content
33
- public_filename(:content)
34
- end
35
-
36
- def url_thumb
37
- public_filename(:thumb)
38
- end
39
-
40
- def to_json(options = {})
41
- options[:methods] ||= []
42
- options[:methods] << :url_content
43
- options[:methods] << :url_thumb
44
- super options
45
- end
46
- end
@@ -1,65 +0,0 @@
1
- class Asset < ActiveRecord::Base
2
-
3
- # === List of columns ===
4
- # id : integer
5
- # data_file_name : string
6
- # data_content_type : string
7
- # data_file_size : integer
8
- # assetable_id : integer
9
- # assetable_type : string
10
- # type : string
11
- # locale : integer
12
- # user_id : integer
13
- # created_at : datetime
14
- # updated_at : datetime
15
- # =======================
16
-
17
-
18
- belongs_to :user
19
- belongs_to :assetable, :polymorphic => true
20
-
21
- def url(*args)
22
- data.url(*args)
23
- end
24
- alias :public_filename :url
25
-
26
- def filename
27
- data_file_name
28
- end
29
-
30
- def content_type
31
- data_content_type
32
- end
33
-
34
- def size
35
- data_file_size
36
- end
37
-
38
- def path
39
- data.path
40
- end
41
-
42
- def styles
43
- data.styles
44
- end
45
-
46
- def format_created_at
47
- I18n.l(self.created_at, :format=>"%d.%m.%Y %H:%M")
48
- end
49
-
50
- def to_xml(options = {})
51
- xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
52
-
53
- xml.tag!(self.type.to_s.downcase) do
54
- xml.filename{ xml.cdata!(self.filename) }
55
- xml.size self.size
56
- xml.path{ xml.cdata!(self.url) }
57
-
58
- xml.styles do
59
- self.styles.each do |style|
60
- xml.tag!(style.first, self.url(style.first))
61
- end
62
- end unless self.styles.empty?
63
- end
64
- end
65
- end
@@ -1,22 +0,0 @@
1
- class AttachmentFile < Asset
2
-
3
- # === List of columns ===
4
- # id : integer
5
- # data_file_name : string
6
- # data_content_type : string
7
- # data_file_size : integer
8
- # assetable_id : integer
9
- # assetable_type : string
10
- # type : string
11
- # locale : integer
12
- # user_id : integer
13
- # created_at : datetime
14
- # updated_at : datetime
15
- # =======================
16
-
17
- has_attached_file :data,
18
- :url => "/assets/attachments/:id/:filename",
19
- :path => ":rails_root/public/assets/attachments/:id/:filename"
20
-
21
- validates_attachment_size :data, :less_than=>10.megabytes
22
- end
@@ -1,39 +0,0 @@
1
- class Picture < Asset
2
-
3
- # === List of columns ===
4
- # id : integer
5
- # data_file_name : string
6
- # data_content_type : string
7
- # data_file_size : integer
8
- # assetable_id : integer
9
- # assetable_type : string
10
- # type : string
11
- # locale : integer
12
- # user_id : integer
13
- # created_at : datetime
14
- # updated_at : datetime
15
- # =======================
16
-
17
-
18
- has_attached_file :data,
19
- :url => "/assets/pictures/:id/:style_:basename.:extension",
20
- :path => ":rails_root/public/assets/pictures/:id/:style_:basename.:extension",
21
- :styles => { :content => '575>', :thumb => '100x100' }
22
-
23
- validates_attachment_size :data, :less_than=>2.megabytes
24
-
25
- def url_content
26
- url(:content)
27
- end
28
-
29
- def url_thumb
30
- url(:thumb)
31
- end
32
-
33
- def to_json(options = {})
34
- options[:methods] ||= []
35
- options[:methods] << :url_content
36
- options[:methods] << :url_thumb
37
- super options
38
- end
39
- end
@@ -1,23 +0,0 @@
1
- class AttachmentFile < Asset
2
-
3
- # === List of columns ===
4
- # id : integer
5
- # data_file_name : string
6
- # data_content_type : string
7
- # data_file_size : integer
8
- # assetable_id : integer
9
- # assetable_type : string
10
- # type : string
11
- # locale : integer
12
- # user_id : integer
13
- # created_at : datetime
14
- # updated_at : datetime
15
- # =======================
16
-
17
- has_attached_file :data,
18
- :s3_credentials => "#{Rails.root}/config/s3.yml", :bucket => "yourbucket",
19
- :storage => :s3,
20
- :path => "#{APP_NAME}/files/:id/:filename"
21
-
22
- validates_attachment_size :data, :less_than => 10.megabytes
23
- end
@@ -1,41 +0,0 @@
1
- class Picture < Asset
2
-
3
- # === List of columns ===
4
- # id : integer
5
- # data_file_name : string
6
- # data_content_type : string
7
- # data_file_size : integer
8
- # assetable_id : integer
9
- # assetable_type : string
10
- # type : string
11
- # locale : integer
12
- # user_id : integer
13
- # created_at : datetime
14
- # updated_at : datetime
15
- # =======================
16
-
17
-
18
-
19
- has_attached_file :data,
20
- :s3_credentials => "#{Rails.root}/config/s3.yml", :bucket => "yourbucket",
21
- :storage => :s3,
22
- :path => "#{APP_NAME}/images/:id/:style_:basename.:extension",
23
- :styles => { :content => '575>', :thumb => '100x100' }
24
-
25
- validates_attachment_size :data, :less_than=>2.megabytes
26
-
27
- def url_content
28
- url(:content)
29
- end
30
-
31
- def url_thumb
32
- url(:thumb)
33
- end
34
-
35
- def to_json(options = {})
36
- options[:methods] ||= []
37
- options[:methods] << :url_content
38
- options[:methods] << :url_thumb
39
- super options
40
- end
41
- end