ckeditor 3.6.0.pre → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +21 -10
- data/README.rdoc +3 -2
- data/lib/ckeditor/orm/mongoid.rb +94 -0
- data/lib/ckeditor/version.rb +1 -1
- data/lib/generators/ckeditor/install_generator.rb +18 -15
- data/lib/generators/ckeditor/models_generator.rb +13 -13
- data/lib/generators/ckeditor/templates/ckeditor.rb +7 -6
- data/lib/generators/ckeditor/templates/models/active_record/{asset.rb → ckeditor/asset.rb} +0 -0
- data/lib/generators/ckeditor/templates/models/active_record/{attachment_file.rb → ckeditor/attachment_file.rb} +0 -0
- data/lib/generators/ckeditor/templates/models/active_record/{picture.rb → ckeditor/picture.rb} +0 -0
- data/lib/generators/ckeditor/templates/models/mongoid/ckeditor/asset.rb +7 -0
- data/lib/generators/ckeditor/templates/models/mongoid/ckeditor/attachment_file.rb +15 -0
- data/lib/generators/ckeditor/templates/models/mongoid/ckeditor/picture.rb +13 -0
- data/test/dummy/app/models/post.rb +16 -2
- data/test/dummy/config/application.rb +3 -3
- data/test/dummy/config/boot.rb +6 -7
- data/test/dummy/config/database.yml +6 -26
- data/test/dummy/config/initializers/ckeditor.rb +6 -6
- data/test/dummy/config/mongoid.yml +2 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +1495 -0
- data/test/generators/install_generator_test.rb +11 -4
- data/test/generators/models_generator_test.rb +12 -2
- data/test/orm/active_record.rb +1 -0
- data/test/orm/mongoid.rb +6 -0
- data/test/test_helper.rb +5 -2
- data/test/tmp/app/models/ckeditor/asset.rb +3 -3
- data/test/tmp/app/models/ckeditor/attachment_file.rb +11 -11
- data/test/tmp/app/models/ckeditor/picture.rb +11 -11
- metadata +23 -22
- data/test/dummy/app/models/ckeditor/asset.rb +0 -7
- data/test/dummy/app/models/ckeditor/attachment_file.rb +0 -15
- data/test/dummy/app/models/ckeditor/picture.rb +0 -13
- data/test/tmp/db/migrate/20110711170413_create_ckeditor_assets.rb +0 -26
@@ -6,13 +6,20 @@ class InstallGeneratorTest < Rails::Generators::TestCase
|
|
6
6
|
setup :prepare_destination
|
7
7
|
|
8
8
|
test "Assert all files are properly created" do
|
9
|
-
run_generator
|
10
|
-
|
11
|
-
assert_file "config/initializers/ckeditor.rb"
|
9
|
+
run_generator %w(--orm=active_record)
|
10
|
+
|
11
|
+
assert_file "config/initializers/ckeditor.rb", /require "ckeditor\/orm\/active_record"/
|
12
|
+
|
12
13
|
assert_file "tmp/ckeditor_#{Ckeditor::Version::EDITOR}.tar.gz"
|
13
|
-
|
14
|
+
|
14
15
|
["rails.js", "jquery.js", "fileuploader.js", "jquery.tmpl.js"].each do |file|
|
15
16
|
assert_file "public/javascripts/ckeditor/filebrowser/javascripts/#{file}"
|
16
17
|
end
|
17
18
|
end
|
19
|
+
|
20
|
+
test "Assert configurator is valid for mongoid" do
|
21
|
+
run_generator %w(--orm=mongoid)
|
22
|
+
|
23
|
+
assert_file "config/initializers/ckeditor.rb", /require "ckeditor\/orm\/mongoid"/
|
24
|
+
end
|
18
25
|
end
|
@@ -7,15 +7,25 @@ class ModelsGeneratorTest < Rails::Generators::TestCase
|
|
7
7
|
|
8
8
|
test "models and migration for active_record orm" do
|
9
9
|
run_generator %w(--orm=active_record)
|
10
|
-
|
10
|
+
|
11
11
|
assert_file "app/models/ckeditor/asset.rb"
|
12
12
|
assert_file "app/models/ckeditor/picture.rb"
|
13
13
|
assert_file "app/models/ckeditor/attachment_file.rb"
|
14
|
-
|
14
|
+
|
15
15
|
assert_migration "db/migrate/create_ckeditor_assets.rb" do |migration|
|
16
16
|
assert_class_method :up, migration do |up|
|
17
17
|
assert_match /create_table/, up
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
test "models for mongoid orm" do
|
23
|
+
run_generator %w(--orm=mongoid)
|
24
|
+
|
25
|
+
assert_file "app/models/ckeditor/asset.rb"
|
26
|
+
assert_file "app/models/ckeditor/picture.rb"
|
27
|
+
assert_file "app/models/ckeditor/attachment_file.rb"
|
28
|
+
|
29
|
+
assert_no_migration "db/migrate/create_ckeditor_assets.rb"
|
30
|
+
end
|
21
31
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
ActiveRecord::Migrator.migrate(File.expand_path("../../dummy/db/migrate/", __FILE__))
|
data/test/orm/mongoid.rb
ADDED
data/test/test_helper.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Configure Rails Envinronment
|
2
2
|
ENV["RAILS_ENV"] = "test"
|
3
|
+
CKEDITOR_ORM = (ENV["CKEDITOR_ORM"] || :active_record).to_sym
|
4
|
+
|
5
|
+
puts "\n==> Ckeditor.orm = #{CKEDITOR_ORM.inspect}. You can change orm in environment variable CKEDITOR_ORM"
|
3
6
|
|
4
7
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
8
|
require "rails/test_help"
|
@@ -16,8 +19,8 @@ require "capybara/rails"
|
|
16
19
|
Capybara.default_driver = :rack_test
|
17
20
|
Capybara.default_selector = :css
|
18
21
|
|
19
|
-
# Run
|
20
|
-
|
22
|
+
# Run specific orm operations
|
23
|
+
require "orm/#{CKEDITOR_ORM}"
|
21
24
|
|
22
25
|
# Load support files
|
23
26
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'mime/types'
|
2
2
|
|
3
|
-
class Ckeditor::Asset
|
4
|
-
include Ckeditor::Orm::
|
5
|
-
|
3
|
+
class Ckeditor::Asset
|
4
|
+
include Ckeditor::Orm::Mongoid::AssetBase
|
5
|
+
|
6
6
|
attr_accessible :data, :assetable_type, :assetable_id, :assetable
|
7
7
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
has_mongoid_attached_file :data,
|
3
|
+
:url => "/ckeditor_assets/attachments/:id/:filename",
|
4
|
+
:path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
|
5
|
+
|
6
6
|
validates_attachment_size :data, :less_than => 100.megabytes
|
7
7
|
validates_attachment_presence :data
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
|
9
|
+
def url_thumb
|
10
|
+
@url_thumb ||= begin
|
11
|
+
extname = File.extname(filename).gsub(/^\./, '')
|
12
|
+
"/javascripts/ckeditor/filebrowser/images/thumbs/#{extname}.gif"
|
13
|
+
end
|
14
|
+
end
|
15
15
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
class Ckeditor::Picture < Ckeditor::Asset
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
has_mongoid_attached_file :data,
|
3
|
+
:url => "/ckeditor_assets/pictures/:id/:style_:basename.:extension",
|
4
|
+
:path => ":rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension",
|
5
|
+
:styles => { :content => '800>', :thumb => '118x100#' }
|
6
|
+
|
7
|
+
validates_attachment_size :data, :less_than => 2.megabytes
|
8
|
+
validates_attachment_presence :data
|
9
|
+
|
10
|
+
def url_content
|
11
|
+
url(:content)
|
12
|
+
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ckeditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 6
|
9
9
|
- 0
|
10
|
-
|
11
|
-
version: 3.6.0.pre
|
10
|
+
version: 3.6.0
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Igor Galeta
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-29 00:00:00 +03:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
@@ -77,6 +76,7 @@ files:
|
|
77
76
|
- lib/ckeditor/hooks/formtastic.rb
|
78
77
|
- lib/ckeditor/http.rb
|
79
78
|
- lib/ckeditor/orm/active_record.rb
|
79
|
+
- lib/ckeditor/orm/mongoid.rb
|
80
80
|
- lib/ckeditor/version.rb
|
81
81
|
- lib/generators/ckeditor/models_generator.rb
|
82
82
|
- lib/generators/ckeditor/install_generator.rb
|
@@ -106,10 +106,13 @@ files:
|
|
106
106
|
- lib/generators/ckeditor/templates/ckeditor/plugins/attachment/lang/uk.js
|
107
107
|
- lib/generators/ckeditor/templates/ckeditor/plugins/attachment/lang/ru.js
|
108
108
|
- lib/generators/ckeditor/templates/ckeditor/config.js
|
109
|
-
- lib/generators/ckeditor/templates/models/
|
110
|
-
- lib/generators/ckeditor/templates/models/
|
109
|
+
- lib/generators/ckeditor/templates/models/mongoid/ckeditor/attachment_file.rb
|
110
|
+
- lib/generators/ckeditor/templates/models/mongoid/ckeditor/asset.rb
|
111
|
+
- lib/generators/ckeditor/templates/models/mongoid/ckeditor/picture.rb
|
112
|
+
- lib/generators/ckeditor/templates/models/active_record/ckeditor/attachment_file.rb
|
113
|
+
- lib/generators/ckeditor/templates/models/active_record/ckeditor/asset.rb
|
114
|
+
- lib/generators/ckeditor/templates/models/active_record/ckeditor/picture.rb
|
111
115
|
- lib/generators/ckeditor/templates/models/active_record/migration.rb
|
112
|
-
- lib/generators/ckeditor/templates/models/active_record/picture.rb
|
113
116
|
- lib/generators/ckeditor/templates/ckeditor.rb
|
114
117
|
- lib/ckeditor.rb
|
115
118
|
- config/routes.rb
|
@@ -143,9 +146,6 @@ files:
|
|
143
146
|
- test/dummy/app/views/posts/index.html.erb
|
144
147
|
- test/dummy/app/helpers/posts_helper.rb
|
145
148
|
- test/dummy/app/helpers/application_helper.rb
|
146
|
-
- test/dummy/app/models/ckeditor/attachment_file.rb
|
147
|
-
- test/dummy/app/models/ckeditor/asset.rb
|
148
|
-
- test/dummy/app/models/ckeditor/picture.rb
|
149
149
|
- test/dummy/app/models/post.rb
|
150
150
|
- test/dummy/app/controllers/application_controller.rb
|
151
151
|
- test/dummy/app/controllers/posts_controller.rb
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- test/dummy/test/fixtures/files/rails.png
|
158
158
|
- test/dummy/test/fixtures/files/rails.tar.gz
|
159
159
|
- test/dummy/script/rails
|
160
|
+
- test/dummy/config/mongoid.yml
|
160
161
|
- test/dummy/config/routes.rb
|
161
162
|
- test/dummy/config/environments/production.rb
|
162
163
|
- test/dummy/config/environments/test.rb
|
@@ -175,13 +176,15 @@ files:
|
|
175
176
|
- test/dummy/db/migrate/20110623120047_create_posts.rb
|
176
177
|
- test/dummy/db/migrate/20110705195648_create_ckeditor_assets.rb
|
177
178
|
- test/dummy/db/schema.rb
|
179
|
+
- test/dummy/db/test.sqlite3
|
178
180
|
- test/dummy/config.ru
|
179
181
|
- test/tmp/app/models/ckeditor/attachment_file.rb
|
180
182
|
- test/tmp/app/models/ckeditor/asset.rb
|
181
183
|
- test/tmp/app/models/ckeditor/picture.rb
|
182
|
-
- test/tmp/db/migrate/20110711170413_create_ckeditor_assets.rb
|
183
184
|
- test/support/integration_case.rb
|
184
185
|
- test/test_helper.rb
|
186
|
+
- test/orm/active_record.rb
|
187
|
+
- test/orm/mongoid.rb
|
185
188
|
- test/controllers/pictures_controller_test.rb
|
186
189
|
- test/controllers/attachment_files_controller_test.rb
|
187
190
|
- test/ckeditor_test.rb
|
@@ -207,14 +210,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
211
|
none: false
|
209
212
|
requirements:
|
210
|
-
- - "
|
213
|
+
- - ">="
|
211
214
|
- !ruby/object:Gem::Version
|
212
|
-
hash:
|
215
|
+
hash: 3
|
213
216
|
segments:
|
214
|
-
-
|
215
|
-
|
216
|
-
- 1
|
217
|
-
version: 1.3.1
|
217
|
+
- 0
|
218
|
+
version: "0"
|
218
219
|
requirements: []
|
219
220
|
|
220
221
|
rubyforge_project: ckeditor
|
@@ -246,9 +247,6 @@ test_files:
|
|
246
247
|
- test/dummy/app/views/posts/index.html.erb
|
247
248
|
- test/dummy/app/helpers/posts_helper.rb
|
248
249
|
- test/dummy/app/helpers/application_helper.rb
|
249
|
-
- test/dummy/app/models/ckeditor/attachment_file.rb
|
250
|
-
- test/dummy/app/models/ckeditor/asset.rb
|
251
|
-
- test/dummy/app/models/ckeditor/picture.rb
|
252
250
|
- test/dummy/app/models/post.rb
|
253
251
|
- test/dummy/app/controllers/application_controller.rb
|
254
252
|
- test/dummy/app/controllers/posts_controller.rb
|
@@ -260,6 +258,7 @@ test_files:
|
|
260
258
|
- test/dummy/test/fixtures/files/rails.png
|
261
259
|
- test/dummy/test/fixtures/files/rails.tar.gz
|
262
260
|
- test/dummy/script/rails
|
261
|
+
- test/dummy/config/mongoid.yml
|
263
262
|
- test/dummy/config/routes.rb
|
264
263
|
- test/dummy/config/environments/production.rb
|
265
264
|
- test/dummy/config/environments/test.rb
|
@@ -278,13 +277,15 @@ test_files:
|
|
278
277
|
- test/dummy/db/migrate/20110623120047_create_posts.rb
|
279
278
|
- test/dummy/db/migrate/20110705195648_create_ckeditor_assets.rb
|
280
279
|
- test/dummy/db/schema.rb
|
280
|
+
- test/dummy/db/test.sqlite3
|
281
281
|
- test/dummy/config.ru
|
282
282
|
- test/tmp/app/models/ckeditor/attachment_file.rb
|
283
283
|
- test/tmp/app/models/ckeditor/asset.rb
|
284
284
|
- test/tmp/app/models/ckeditor/picture.rb
|
285
|
-
- test/tmp/db/migrate/20110711170413_create_ckeditor_assets.rb
|
286
285
|
- test/support/integration_case.rb
|
287
286
|
- test/test_helper.rb
|
287
|
+
- test/orm/active_record.rb
|
288
|
+
- test/orm/mongoid.rb
|
288
289
|
- test/controllers/pictures_controller_test.rb
|
289
290
|
- test/controllers/attachment_files_controller_test.rb
|
290
291
|
- test/ckeditor_test.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
2
|
-
has_attached_file :data,
|
3
|
-
:url => "/ckeditor_assets/attachments/:id/:filename",
|
4
|
-
:path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
|
5
|
-
|
6
|
-
validates_attachment_size :data, :less_than => 100.megabytes
|
7
|
-
validates_attachment_presence :data
|
8
|
-
|
9
|
-
def url_thumb
|
10
|
-
@url_thumb ||= begin
|
11
|
-
extname = File.extname(filename).gsub(/^\./, '')
|
12
|
-
"/javascripts/ckeditor/filebrowser/images/thumbs/#{extname}.gif"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class Ckeditor::Picture < Ckeditor::Asset
|
2
|
-
has_attached_file :data,
|
3
|
-
:url => "/ckeditor_assets/pictures/:id/:style_:basename.:extension",
|
4
|
-
:path => ":rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension",
|
5
|
-
:styles => { :content => '800>', :thumb => '118x100#' }
|
6
|
-
|
7
|
-
validates_attachment_size :data, :less_than => 2.megabytes
|
8
|
-
validates_attachment_presence :data
|
9
|
-
|
10
|
-
def url_content
|
11
|
-
url(:content)
|
12
|
-
end
|
13
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
class CreateCkeditorAssets < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :ckeditor_assets do |t|
|
4
|
-
t.string :data_file_name, :null => false
|
5
|
-
t.string :data_content_type
|
6
|
-
t.integer :data_file_size
|
7
|
-
|
8
|
-
t.integer :assetable_id
|
9
|
-
t.string :assetable_type, :limit => 30
|
10
|
-
t.string :type, :limit => 30
|
11
|
-
|
12
|
-
# Uncomment it to save images dimensions, if your need it
|
13
|
-
# t.integer :width
|
14
|
-
# t.integer :height
|
15
|
-
|
16
|
-
t.timestamps
|
17
|
-
end
|
18
|
-
|
19
|
-
add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_ckeditor_assetable_type"
|
20
|
-
add_index "ckeditor_assets", ["assetable_type", "assetable_id"], :name => "idx_ckeditor_assetable"
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.down
|
24
|
-
drop_table :ckeditor_assets
|
25
|
-
end
|
26
|
-
end
|