ckeditor 3.6.0 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -1
- data/README.rdoc +44 -9
- data/Rakefile +28 -0
- data/config/locales/pt-BR.ckeditor.yml +8 -0
- data/lib/ckeditor.rb +6 -1
- data/lib/ckeditor/backend/carrierwave.rb +64 -0
- data/lib/ckeditor/backend/paperclip.rb +53 -0
- data/lib/ckeditor/http.rb +10 -2
- data/lib/ckeditor/orm/active_record.rb +4 -69
- data/lib/ckeditor/orm/base.rb +46 -0
- data/lib/ckeditor/orm/mongoid.rb +20 -71
- data/lib/ckeditor/version.rb +1 -1
- data/lib/generators/ckeditor/install_generator.rb +1 -0
- data/lib/generators/ckeditor/models_generator.rb +28 -9
- data/lib/generators/ckeditor/templates/ckeditor.rb +1 -2
- data/lib/generators/ckeditor/templates/ckeditor/filebrowser/javascripts/application.js +1 -1
- data/lib/generators/ckeditor/templates/models/active_record/carrierwave/ckeditor/asset.rb +7 -0
- data/lib/generators/ckeditor/templates/models/active_record/carrierwave/ckeditor/attachment_file.rb +10 -0
- data/lib/generators/ckeditor/templates/models/active_record/carrierwave/ckeditor/picture.rb +7 -0
- data/lib/generators/ckeditor/templates/models/active_record/{migration.rb → carrierwave/migration.rb} +0 -0
- data/lib/generators/ckeditor/templates/models/active_record/{ckeditor → paperclip/ckeditor}/asset.rb +1 -4
- data/lib/generators/ckeditor/templates/models/active_record/{ckeditor → paperclip/ckeditor}/attachment_file.rb +0 -0
- data/lib/generators/ckeditor/templates/models/active_record/{ckeditor → paperclip/ckeditor}/picture.rb +0 -0
- data/lib/generators/ckeditor/templates/models/active_record/paperclip/migration.rb +26 -0
- data/lib/generators/ckeditor/templates/models/base/carrierwave/uploaders/ckeditor_attachment_file_uploader.rb +42 -0
- data/lib/generators/ckeditor/templates/models/base/carrierwave/uploaders/ckeditor_picture_uploader.rb +53 -0
- data/lib/generators/ckeditor/templates/models/mongoid/carrierwave/ckeditor/asset.rb +7 -0
- data/lib/generators/ckeditor/templates/models/mongoid/carrierwave/ckeditor/attachment_file.rb +10 -0
- data/lib/generators/ckeditor/templates/models/mongoid/carrierwave/ckeditor/picture.rb +7 -0
- data/lib/generators/ckeditor/templates/models/mongoid/paperclip/ckeditor/asset.rb +5 -0
- data/lib/generators/ckeditor/templates/models/mongoid/{ckeditor → paperclip/ckeditor}/attachment_file.rb +3 -3
- data/lib/generators/ckeditor/templates/models/mongoid/{ckeditor → paperclip/ckeditor}/picture.rb +0 -0
- data/test/controllers/attachment_files_controller_test.rb +9 -0
- data/test/controllers/pictures_controller_test.rb +9 -0
- data/test/dummy/config/application.rb +6 -2
- data/test/dummy/db/migrate/20110705195648_create_ckeditor_assets.rb +2 -2
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +2808 -0
- data/test/dummy/public/ckeditor_assets/attachments/4e53723cde2f151212000001/rails_tar.gz +0 -0
- data/test/dummy/public/ckeditor_assets/attachments/4e537333de2f15123b000001/rails_tar.gz +0 -0
- data/test/dummy/public/ckeditor_assets/attachments/4e537621de2f1514e9000001/rails_tar.gz +0 -0
- data/test/dummy/public/ckeditor_assets/attachments/4e53766ade2f15152c000001/rails_tar.gz +0 -0
- data/test/dummy/public/ckeditor_assets/attachments/4e53781ede2f1515b7000001/rails.tar.gz +0 -0
- data/test/dummy/public/ckeditor_assets/attachments/4e537849de2f151651000001/rails_tar.gz +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e53723dde2f151212000002/content_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e53723dde2f151212000002/original_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e53723dde2f151212000002/thumb_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e537334de2f15123b000002/content_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e537334de2f15123b000002/original_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e537334de2f15123b000002/thumb_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e537637de2f1514e9000007/content_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e537637de2f1514e9000007/original_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e537637de2f1514e9000007/thumb_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e53768ade2f15152c000007/content_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e53768ade2f15152c000007/original_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e53768ade2f15152c000007/thumb_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e53783ade2f1515b7000007/content_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e53783ade2f1515b7000007/rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e53783ade2f1515b7000007/thumb_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e537868de2f151651000007/content_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e537868de2f151651000007/original_rails.png +0 -0
- data/test/dummy/public/ckeditor_assets/pictures/4e537868de2f151651000007/thumb_rails.png +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1231-4694-7541/rails.png +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1232-4702-5501/rails.png +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-0966/rails.png +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-1597/rails.tar.gz +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-3892/rails.tar.gz +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-5787/rails.tar.gz +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-5790/rails.png +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-6435/rails.png +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-6978/rails.png +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-7226/rails.tar.gz +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-7290/rails.tar.gz +0 -0
- data/test/dummy/public/uploads/tmp/20110823-1245-5487-9279/rails.png +0 -0
- data/test/generators/models_generator_test.rb +34 -4
- data/test/models/attachment_file_test.rb +16 -0
- data/test/models/picture_test.rb +16 -0
- data/test/support/helpers.rb +30 -0
- data/test/support/raw_post.rb +9 -0
- data/test/test_helper.rb +2 -0
- data/test/tmp/app/models/ckeditor/asset.rb +2 -4
- data/test/tmp/app/models/ckeditor/attachment_file.rb +3 -3
- metadata +104 -11
- data/lib/generators/ckeditor/templates/models/mongoid/ckeditor/asset.rb +0 -7
data/lib/ckeditor/orm/mongoid.rb
CHANGED
@@ -1,90 +1,39 @@
|
|
1
1
|
require 'orm_adapter/adapters/mongoid'
|
2
|
+
require 'ckeditor/orm/base'
|
2
3
|
|
3
4
|
module Ckeditor
|
4
5
|
module Orm
|
5
6
|
module Mongoid
|
6
7
|
module AssetBase
|
7
8
|
def self.included(base)
|
8
|
-
base.send(:include, InstanceMethods)
|
9
9
|
base.send(:include, ::Mongoid::Document)
|
10
10
|
base.send(:include, ::Mongoid::Timestamps)
|
11
|
-
base.send(:include, ::
|
11
|
+
base.send(:include, Base::AssetBase::InstanceMethods)
|
12
|
+
base.send(:include, InstanceMethods)
|
12
13
|
base.send(:extend, ClassMethods)
|
13
14
|
end
|
15
|
+
|
16
|
+
module InstanceMethods
|
17
|
+
def type
|
18
|
+
_type
|
19
|
+
end
|
20
|
+
|
21
|
+
def as_json_methods
|
22
|
+
[:id, :type] + super
|
23
|
+
end
|
24
|
+
end
|
14
25
|
|
15
26
|
module ClassMethods
|
16
27
|
def self.extended(base)
|
17
28
|
base.class_eval do
|
29
|
+
field :data_content_type, :type => String
|
30
|
+
field :data_file_size, :type => Integer
|
31
|
+
field :width, :type => Integer
|
32
|
+
field :height, :type => Integer
|
33
|
+
|
18
34
|
belongs_to :assetable, :polymorphic => true
|
19
|
-
|
20
|
-
|
21
|
-
before_create :read_dimensions, :parameterize_filename
|
22
|
-
|
23
|
-
delegate :url, :path, :styles, :size, :content_type, :to => :data
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
module InstanceMethods
|
29
|
-
def filename
|
30
|
-
data_file_name
|
31
|
-
end
|
32
|
-
|
33
|
-
def format_created_at
|
34
|
-
I18n.l(created_at, :format => "%d.%m.%Y")
|
35
|
-
end
|
36
|
-
|
37
|
-
def has_dimensions?
|
38
|
-
respond_to?(:width) && respond_to?(:height)
|
39
|
-
end
|
40
|
-
|
41
|
-
def image?
|
42
|
-
Ckeditor::IMAGE_TYPES.include?(data_content_type)
|
43
|
-
end
|
44
|
-
|
45
|
-
def geometry
|
46
|
-
@geometry ||= Paperclip::Geometry.from_file(data.to_file)
|
47
|
-
@geometry
|
48
|
-
end
|
49
|
-
|
50
|
-
def url_content
|
51
|
-
url
|
52
|
-
end
|
53
|
-
|
54
|
-
def url_thumb
|
55
|
-
url(:thumb)
|
56
|
-
end
|
57
|
-
|
58
|
-
def as_json(options = nil)
|
59
|
-
options = {
|
60
|
-
:methods => [:url_content, :url_thumb, :size, :filename, :format_created_at],
|
61
|
-
:root => "asset"
|
62
|
-
}.merge(options || {})
|
63
|
-
|
64
|
-
super options
|
65
|
-
end
|
66
|
-
|
67
|
-
protected
|
68
|
-
|
69
|
-
def parameterize_filename
|
70
|
-
unless data_file_name.blank?
|
71
|
-
filename = Ckeditor::Utils.parameterize_filename(data_file_name)
|
72
|
-
self.data.instance_write(:file_name, filename)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def read_dimensions
|
77
|
-
if image? && has_dimensions?
|
78
|
-
self.width = geometry.width
|
79
|
-
self.height = geometry.height
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# Extract content_type from filename using mime/types gem
|
84
|
-
def extract_content_type
|
85
|
-
if data_content_type == "application/octet-stream" && !data_file_name.blank?
|
86
|
-
content_types = MIME::Types.type_for(data_file_name)
|
87
|
-
self.data_content_type = content_types.first.to_s unless content_types.empty?
|
35
|
+
|
36
|
+
attr_accessible :data, :assetable_type, :assetable_id, :assetable
|
88
37
|
end
|
89
38
|
end
|
90
39
|
end
|
data/lib/ckeditor/version.rb
CHANGED
@@ -29,6 +29,7 @@ module Ckeditor
|
|
29
29
|
filepath = Rails.root.join("tmp/#{filename}")
|
30
30
|
|
31
31
|
if File.exist?(filepath)
|
32
|
+
FileUtils.mkdir_p(Rails.root.join("public/javascripts"))
|
32
33
|
Ckeditor::Utils.extract(filepath, Rails.root.join('public', 'javascripts'))
|
33
34
|
directory "ckeditor", "public/javascripts/ckeditor"
|
34
35
|
FileUtils.rm_rf(filepath)
|
@@ -11,6 +11,9 @@ module Ckeditor
|
|
11
11
|
# ORM configuration
|
12
12
|
class_option :orm, :type => :string, :default => "active_record",
|
13
13
|
:desc => "Backend processor for upload support"
|
14
|
+
|
15
|
+
class_option :backend, :type => :string, :default => 'paperclip',
|
16
|
+
:desc => "Paperclip (by default) or carrierwave"
|
14
17
|
|
15
18
|
def self.source_root
|
16
19
|
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates', 'models/'))
|
@@ -21,18 +24,22 @@ module Ckeditor
|
|
21
24
|
end
|
22
25
|
|
23
26
|
def create_models
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
[:asset, :picture, :attachment_file].each do |filename|
|
28
|
+
template "#{generator_dir}/ckeditor/#{filename}.rb",
|
29
|
+
File.join('app/models', ckeditor_dir, "#{filename}.rb")
|
30
|
+
end
|
31
|
+
|
32
|
+
if backend == "carrierwave"
|
33
|
+
template "#{uploaders_dir}/uploaders/ckeditor_attachment_file_uploader.rb",
|
34
|
+
File.join("app/uploaders", "ckeditor_attachment_file_uploader.rb")
|
35
|
+
|
36
|
+
template "#{uploaders_dir}/uploaders/ckeditor_picture_uploader.rb",
|
37
|
+
File.join("app/uploaders", "ckeditor_picture_uploader.rb")
|
38
|
+
end
|
32
39
|
end
|
33
40
|
|
34
41
|
def create_migration
|
35
|
-
if
|
42
|
+
if ["active_record"].include?(orm)
|
36
43
|
migration_template "#{generator_dir}/migration.rb", File.join('db/migrate', "create_ckeditor_assets.rb")
|
37
44
|
end
|
38
45
|
end
|
@@ -44,8 +51,20 @@ module Ckeditor
|
|
44
51
|
end
|
45
52
|
|
46
53
|
def generator_dir
|
54
|
+
@generator_dir ||= [orm, backend].join('/')
|
55
|
+
end
|
56
|
+
|
57
|
+
def uploaders_dir
|
58
|
+
@uploaders_dir ||= ['base', 'carrierwave'].join('/')
|
59
|
+
end
|
60
|
+
|
61
|
+
def orm
|
47
62
|
options[:orm] || "active_record"
|
48
63
|
end
|
64
|
+
|
65
|
+
def backend
|
66
|
+
options[:backend] || "paperclip"
|
67
|
+
end
|
49
68
|
end
|
50
69
|
end
|
51
70
|
end
|
@@ -7,13 +7,12 @@ if Object.const_defined?("Ckeditor")
|
|
7
7
|
# available as additional gems.
|
8
8
|
require "ckeditor/orm/<%= options[:orm] %>"
|
9
9
|
|
10
|
-
|
11
10
|
# Allowed image file types for upload.
|
12
11
|
# Set to nil or [] (empty array) for all file types
|
13
12
|
# config.image_file_types = ["jpg", "jpeg", "png", "gif", "tiff"]
|
14
13
|
|
15
14
|
# Allowed attachment file types for upload.
|
16
15
|
# Set to nil or [] (empty array) for all file types
|
17
|
-
# config.attachment_file_types = ["doc", "docx", "rar", "zip", "
|
16
|
+
# config.attachment_file_types = ["doc", "docx", "xls", "odt", "ods", "pdf", "rar", "zip", "tar", "swf"]
|
18
17
|
end
|
19
18
|
end
|
@@ -163,7 +163,7 @@ qq.extend(qq.FileUploaderInput.prototype, {
|
|
163
163
|
qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);
|
164
164
|
|
165
165
|
var item = this._getItemByFileId(id);
|
166
|
-
var asset = result.asset;
|
166
|
+
var asset = result.asset ? result.asset : result;
|
167
167
|
|
168
168
|
if (asset && asset.id){
|
169
169
|
qq.addClass(item, this._classes.success);
|
data/lib/generators/ckeditor/templates/models/active_record/carrierwave/ckeditor/attachment_file.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
2
|
+
mount_uploader :data, CkeditorAttachmentFileUploader, :mount_on => :data_file_name
|
3
|
+
|
4
|
+
def url_thumb
|
5
|
+
@url_thumb ||= begin
|
6
|
+
extname = File.extname(filename).gsub(/^\./, '')
|
7
|
+
"/javascripts/ckeditor/filebrowser/images/thumbs/#{extname}.gif"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
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
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
class CkeditorAttachmentFileUploader < CarrierWave::Uploader::Base
|
3
|
+
include Ckeditor::Backend::CarrierWave
|
4
|
+
|
5
|
+
# Include RMagick or ImageScience support:
|
6
|
+
# include CarrierWave::RMagick
|
7
|
+
# include CarrierWave::MiniMagick
|
8
|
+
# include CarrierWave::ImageScience
|
9
|
+
|
10
|
+
# Choose what kind of storage to use for this uploader:
|
11
|
+
storage :file
|
12
|
+
|
13
|
+
# Override the directory where uploaded files will be stored.
|
14
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
15
|
+
def store_dir
|
16
|
+
"ckeditor_assets/attachments/#{model.id}"
|
17
|
+
end
|
18
|
+
|
19
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
20
|
+
# def default_url
|
21
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
22
|
+
# end
|
23
|
+
|
24
|
+
# Process files as they are uploaded:
|
25
|
+
# process :scale => [200, 300]
|
26
|
+
#
|
27
|
+
# def scale(width, height)
|
28
|
+
# # do something
|
29
|
+
# end
|
30
|
+
|
31
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
32
|
+
# For images you might use something like this:
|
33
|
+
def extension_white_list
|
34
|
+
Ckeditor.attachment_file_types
|
35
|
+
end
|
36
|
+
|
37
|
+
# Override the filename of the uploaded files:
|
38
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
39
|
+
# def filename
|
40
|
+
# "something.jpg" if original_filename
|
41
|
+
# end
|
42
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
class CkeditorPictureUploader < CarrierWave::Uploader::Base
|
3
|
+
include Ckeditor::Backend::CarrierWave
|
4
|
+
|
5
|
+
# Include RMagick or ImageScience support:
|
6
|
+
# include CarrierWave::RMagick
|
7
|
+
include CarrierWave::MiniMagick
|
8
|
+
# include CarrierWave::ImageScience
|
9
|
+
|
10
|
+
# Choose what kind of storage to use for this uploader:
|
11
|
+
storage :file
|
12
|
+
|
13
|
+
# Override the directory where uploaded files will be stored.
|
14
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
15
|
+
def store_dir
|
16
|
+
"ckeditor_assets/pictures/#{model.id}"
|
17
|
+
end
|
18
|
+
|
19
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
20
|
+
# def default_url
|
21
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
22
|
+
# end
|
23
|
+
|
24
|
+
# Process files as they are uploaded:
|
25
|
+
# process :scale => [200, 300]
|
26
|
+
#
|
27
|
+
# def scale(width, height)
|
28
|
+
# # do something
|
29
|
+
# end
|
30
|
+
|
31
|
+
process :read_dimensions
|
32
|
+
|
33
|
+
# Create different versions of your uploaded files:
|
34
|
+
version :thumb do
|
35
|
+
process :resize_to_fill => [118, 100]
|
36
|
+
end
|
37
|
+
|
38
|
+
version :content do
|
39
|
+
process :resize_to_fit => [800, 800]
|
40
|
+
end
|
41
|
+
|
42
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
43
|
+
# For images you might use something like this:
|
44
|
+
def extension_white_list
|
45
|
+
Ckeditor.image_file_types
|
46
|
+
end
|
47
|
+
|
48
|
+
# Override the filename of the uploaded files:
|
49
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
50
|
+
# def filename
|
51
|
+
# "something.jpg" if original_filename
|
52
|
+
# end
|
53
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
2
|
+
mount_uploader :data, CkeditorAttachmentFileUploader, :mount_on => :data_file_name
|
3
|
+
|
4
|
+
def url_thumb
|
5
|
+
@url_thumb ||= begin
|
6
|
+
extname = File.extname(filename).gsub(/^\./, '')
|
7
|
+
"/javascripts/ckeditor/filebrowser/images/thumbs/#{extname}.gif"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -8,8 +8,8 @@ class Ckeditor::AttachmentFile < Ckeditor::Asset
|
|
8
8
|
|
9
9
|
def url_thumb
|
10
10
|
@url_thumb ||= begin
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
extname = File.extname(filename).gsub(/^\./, '')
|
12
|
+
"/javascripts/ckeditor/filebrowser/images/thumbs/#{extname}.gif"
|
13
|
+
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/generators/ckeditor/templates/models/mongoid/{ckeditor → paperclip/ckeditor}/picture.rb
RENAMED
File without changes
|
@@ -2,6 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class AttachmentFilesControllerTest < ActionController::TestCase
|
4
4
|
tests Ckeditor::AttachmentFilesController
|
5
|
+
include RawPost
|
5
6
|
|
6
7
|
def setup
|
7
8
|
@attachment = fixture_file_upload('files/rails.tar.gz', 'application/x-gzip')
|
@@ -34,6 +35,14 @@ class AttachmentFilesControllerTest < ActionController::TestCase
|
|
34
35
|
assert_equal 200, @response.status
|
35
36
|
end
|
36
37
|
|
38
|
+
test "create action via html5 upload" do
|
39
|
+
assert_difference 'Ckeditor::AttachmentFile.count' do
|
40
|
+
raw_post :create, { :qqfile => @attachment.original_filename }, @attachment.read
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_equal 200, @response.status
|
44
|
+
end
|
45
|
+
|
37
46
|
test "invalid params for create action" do
|
38
47
|
assert_no_difference 'Ckeditor::AttachmentFile.count' do
|
39
48
|
post :create, :qqfile => nil
|