brightcontent-attachments 2.0.29 → 2.0.30
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +65 -68
- data/README.md +10 -0
- data/app/controllers/brightcontent/attachments_controller.rb +7 -1
- data/app/models/brightcontent/attachment.rb +2 -2
- data/lib/brightcontent/attachment_model_extensions.rb +13 -0
- data/lib/brightcontent/attachments.rb +1 -0
- data/lib/brightcontent/attachments/engine.rb +5 -0
- data/spec/dummy/app/models/blog.rb +1 -5
- data/spec/models/brightcontent/attachment_spec.rb +2 -2
- metadata +7 -5
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
brightcontent-attachments (2.0.
|
5
|
-
brightcontent-core (= 2.0.
|
4
|
+
brightcontent-attachments (2.0.30)
|
5
|
+
brightcontent-core (= 2.0.30)
|
6
6
|
jquery-fileupload-rails
|
7
7
|
paperclip
|
8
8
|
|
9
9
|
PATH
|
10
10
|
remote: ../core
|
11
11
|
specs:
|
12
|
-
brightcontent-core (2.0.
|
12
|
+
brightcontent-core (2.0.30)
|
13
13
|
bcrypt-ruby
|
14
14
|
bootstrap-wysihtml5-rails
|
15
15
|
has_scope
|
@@ -23,66 +23,66 @@ PATH
|
|
23
23
|
GEM
|
24
24
|
remote: http://rubygems.org/
|
25
25
|
specs:
|
26
|
-
actionmailer (3.2.
|
27
|
-
actionpack (= 3.2.
|
28
|
-
mail (~> 2.
|
29
|
-
actionpack (3.2.
|
30
|
-
activemodel (= 3.2.
|
31
|
-
activesupport (= 3.2.
|
26
|
+
actionmailer (3.2.13)
|
27
|
+
actionpack (= 3.2.13)
|
28
|
+
mail (~> 2.5.3)
|
29
|
+
actionpack (3.2.13)
|
30
|
+
activemodel (= 3.2.13)
|
31
|
+
activesupport (= 3.2.13)
|
32
32
|
builder (~> 3.0.0)
|
33
33
|
erubis (~> 2.7.0)
|
34
34
|
journey (~> 1.0.4)
|
35
|
-
rack (~> 1.4.
|
35
|
+
rack (~> 1.4.5)
|
36
36
|
rack-cache (~> 1.2)
|
37
37
|
rack-test (~> 0.6.1)
|
38
38
|
sprockets (~> 2.2.1)
|
39
|
-
activemodel (3.2.
|
40
|
-
activesupport (= 3.2.
|
39
|
+
activemodel (3.2.13)
|
40
|
+
activesupport (= 3.2.13)
|
41
41
|
builder (~> 3.0.0)
|
42
|
-
activerecord (3.2.
|
43
|
-
activemodel (= 3.2.
|
44
|
-
activesupport (= 3.2.
|
42
|
+
activerecord (3.2.13)
|
43
|
+
activemodel (= 3.2.13)
|
44
|
+
activesupport (= 3.2.13)
|
45
45
|
arel (~> 3.0.2)
|
46
46
|
tzinfo (~> 0.3.29)
|
47
|
-
activeresource (3.2.
|
48
|
-
activemodel (= 3.2.
|
49
|
-
activesupport (= 3.2.
|
50
|
-
activesupport (3.2.
|
51
|
-
i18n (
|
47
|
+
activeresource (3.2.13)
|
48
|
+
activemodel (= 3.2.13)
|
49
|
+
activesupport (= 3.2.13)
|
50
|
+
activesupport (3.2.13)
|
51
|
+
i18n (= 0.6.1)
|
52
52
|
multi_json (~> 1.0)
|
53
|
-
addressable (2.3.
|
53
|
+
addressable (2.3.3)
|
54
54
|
arel (3.0.2)
|
55
55
|
bcrypt-ruby (3.0.1)
|
56
56
|
bootstrap-wysihtml5-rails (0.3.1.19)
|
57
57
|
railties (>= 3.0)
|
58
58
|
builder (3.0.4)
|
59
|
-
capybara (2.0.
|
59
|
+
capybara (2.0.3)
|
60
60
|
mime-types (>= 1.16)
|
61
61
|
nokogiri (>= 1.3.3)
|
62
62
|
rack (>= 1.0.0)
|
63
63
|
rack-test (>= 0.5.4)
|
64
64
|
selenium-webdriver (~> 2.0)
|
65
65
|
xpath (~> 1.0.0)
|
66
|
-
childprocess (0.3.
|
67
|
-
ffi (~> 1.0, >= 1.0.
|
66
|
+
childprocess (0.3.9)
|
67
|
+
ffi (~> 1.0, >= 1.0.11)
|
68
68
|
climate_control (0.0.3)
|
69
69
|
activesupport (>= 3.0)
|
70
70
|
cocaine (0.5.1)
|
71
71
|
climate_control (>= 0.0.3, < 1.0)
|
72
|
-
diff-lcs (1.1
|
72
|
+
diff-lcs (1.2.1)
|
73
73
|
erubis (2.7.0)
|
74
|
-
factory_girl (4.
|
74
|
+
factory_girl (4.2.0)
|
75
75
|
activesupport (>= 3.0.0)
|
76
|
-
factory_girl_rails (4.1
|
77
|
-
factory_girl (~> 4.
|
76
|
+
factory_girl_rails (4.2.1)
|
77
|
+
factory_girl (~> 4.2.0)
|
78
78
|
railties (>= 3.0.0)
|
79
|
-
ffi (1.
|
79
|
+
ffi (1.6.0)
|
80
80
|
has_scope (0.5.1)
|
81
81
|
hike (1.2.1)
|
82
82
|
i18n (0.6.1)
|
83
|
-
inherited_resources (1.
|
83
|
+
inherited_resources (1.4.0)
|
84
84
|
has_scope (~> 0.5.0)
|
85
|
-
responders (~> 0.
|
85
|
+
responders (~> 0.9)
|
86
86
|
journey (1.0.4)
|
87
87
|
jquery-fileupload-rails (0.4.1)
|
88
88
|
actionpack (>= 3.1)
|
@@ -90,19 +90,16 @@ GEM
|
|
90
90
|
jquery-rails (2.2.1)
|
91
91
|
railties (>= 3.0, < 5.0)
|
92
92
|
thor (>= 0.14, < 2.0)
|
93
|
-
json (1.7.
|
94
|
-
launchy (2.
|
93
|
+
json (1.7.7)
|
94
|
+
launchy (2.2.0)
|
95
95
|
addressable (~> 2.3)
|
96
|
-
|
97
|
-
addressable
|
98
|
-
websocket
|
99
|
-
mail (2.4.4)
|
96
|
+
mail (2.5.3)
|
100
97
|
i18n (>= 0.4.0)
|
101
98
|
mime-types (~> 1.16)
|
102
99
|
treetop (~> 1.4.8)
|
103
|
-
mime-types (1.
|
104
|
-
multi_json (1.
|
105
|
-
nokogiri (1.5.
|
100
|
+
mime-types (1.21)
|
101
|
+
multi_json (1.7.2)
|
102
|
+
nokogiri (1.5.9)
|
106
103
|
paperclip (3.4.1)
|
107
104
|
activemodel (>= 3.0.0)
|
108
105
|
activerecord (>= 3.0.0)
|
@@ -110,50 +107,50 @@ GEM
|
|
110
107
|
cocaine (~> 0.5.0)
|
111
108
|
mime-types
|
112
109
|
polyglot (0.3.3)
|
113
|
-
rack (1.4.
|
110
|
+
rack (1.4.5)
|
114
111
|
rack-cache (1.2)
|
115
112
|
rack (>= 0.4)
|
116
|
-
rack-ssl (1.3.
|
113
|
+
rack-ssl (1.3.3)
|
117
114
|
rack
|
118
115
|
rack-test (0.6.2)
|
119
116
|
rack (>= 1.0)
|
120
|
-
rails (3.2.
|
121
|
-
actionmailer (= 3.2.
|
122
|
-
actionpack (= 3.2.
|
123
|
-
activerecord (= 3.2.
|
124
|
-
activeresource (= 3.2.
|
125
|
-
activesupport (= 3.2.
|
117
|
+
rails (3.2.13)
|
118
|
+
actionmailer (= 3.2.13)
|
119
|
+
actionpack (= 3.2.13)
|
120
|
+
activerecord (= 3.2.13)
|
121
|
+
activeresource (= 3.2.13)
|
122
|
+
activesupport (= 3.2.13)
|
126
123
|
bundler (~> 1.0)
|
127
|
-
railties (= 3.2.
|
128
|
-
railties (3.2.
|
129
|
-
actionpack (= 3.2.
|
130
|
-
activesupport (= 3.2.
|
124
|
+
railties (= 3.2.13)
|
125
|
+
railties (3.2.13)
|
126
|
+
actionpack (= 3.2.13)
|
127
|
+
activesupport (= 3.2.13)
|
131
128
|
rack-ssl (~> 1.3.2)
|
132
129
|
rake (>= 0.8.7)
|
133
130
|
rdoc (~> 3.4)
|
134
131
|
thor (>= 0.14.6, < 2.0)
|
135
|
-
rake (10.0.
|
136
|
-
rdoc (3.12)
|
132
|
+
rake (10.0.4)
|
133
|
+
rdoc (3.12.2)
|
137
134
|
json (~> 1.4)
|
138
135
|
responders (0.9.3)
|
139
136
|
railties (~> 3.1)
|
140
|
-
rspec-core (2.
|
141
|
-
rspec-expectations (2.
|
142
|
-
diff-lcs (
|
143
|
-
rspec-mocks (2.
|
144
|
-
rspec-rails (2.
|
137
|
+
rspec-core (2.13.1)
|
138
|
+
rspec-expectations (2.13.0)
|
139
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
140
|
+
rspec-mocks (2.13.0)
|
141
|
+
rspec-rails (2.13.0)
|
145
142
|
actionpack (>= 3.0)
|
146
143
|
activesupport (>= 3.0)
|
147
144
|
railties (>= 3.0)
|
148
|
-
rspec-core (~> 2.
|
149
|
-
rspec-expectations (~> 2.
|
150
|
-
rspec-mocks (~> 2.
|
145
|
+
rspec-core (~> 2.13.0)
|
146
|
+
rspec-expectations (~> 2.13.0)
|
147
|
+
rspec-mocks (~> 2.13.0)
|
151
148
|
rubyzip (0.9.9)
|
152
|
-
selenium-webdriver (2.
|
149
|
+
selenium-webdriver (2.31.0)
|
153
150
|
childprocess (>= 0.2.5)
|
154
|
-
libwebsocket (~> 0.1.3)
|
155
151
|
multi_json (~> 1.0)
|
156
152
|
rubyzip
|
153
|
+
websocket (~> 1.0.4)
|
157
154
|
simple_form (2.1.0)
|
158
155
|
actionpack (~> 3.0)
|
159
156
|
activemodel (~> 3.0)
|
@@ -162,18 +159,18 @@ GEM
|
|
162
159
|
multi_json (~> 1.0)
|
163
160
|
rack (~> 1.0)
|
164
161
|
tilt (~> 1.1, != 1.3.0)
|
165
|
-
sqlite3 (1.3.
|
162
|
+
sqlite3 (1.3.7)
|
166
163
|
strong_parameters (0.2.0)
|
167
164
|
actionpack (~> 3.0)
|
168
165
|
activemodel (~> 3.0)
|
169
166
|
railties (~> 3.0)
|
170
|
-
thor (0.
|
171
|
-
tilt (1.3.
|
167
|
+
thor (0.18.0)
|
168
|
+
tilt (1.3.6)
|
172
169
|
treetop (1.4.12)
|
173
170
|
polyglot
|
174
171
|
polyglot (>= 0.3.1)
|
175
172
|
tzinfo (0.3.37)
|
176
|
-
websocket (1.0.
|
173
|
+
websocket (1.0.7)
|
177
174
|
will_paginate (3.0.4)
|
178
175
|
xpath (1.0.0)
|
179
176
|
nokogiri (~> 1.3)
|
data/README.md
ADDED
@@ -9,7 +9,7 @@ module Brightcontent
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def create
|
12
|
-
@attachment = Attachment.new(
|
12
|
+
@attachment = Attachment.new(attachment_params)
|
13
13
|
if @attachment.save
|
14
14
|
render json: @attachment.to_json, status: :created
|
15
15
|
else
|
@@ -22,5 +22,11 @@ module Brightcontent
|
|
22
22
|
redirect_to attachment.attachable
|
23
23
|
end
|
24
24
|
|
25
|
+
private
|
26
|
+
|
27
|
+
def attachment_params
|
28
|
+
params.permit(:attachable_id, :attachable_type, :asset)
|
29
|
+
end
|
30
|
+
|
25
31
|
end
|
26
32
|
end
|
@@ -21,8 +21,8 @@ module Brightcontent
|
|
21
21
|
private
|
22
22
|
|
23
23
|
def user_defined_styles
|
24
|
-
if attachable && attachable.
|
25
|
-
attachable.attachment_styles
|
24
|
+
if attachable && attachable.class.attachment_styles && image?
|
25
|
+
attachable.class.attachment_styles
|
26
26
|
end || {}
|
27
27
|
end
|
28
28
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Brightcontent
|
2
|
+
module AttachmentModelExtensions
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
module ClassMethods
|
6
|
+
attr_reader :attachment_styles
|
7
|
+
def has_attached_files(styles)
|
8
|
+
include Brightcontent::Attachable
|
9
|
+
@attachment_styles = styles
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Brightcontent
|
4
4
|
describe Attachment do
|
5
|
-
subject(:attachment) { Attachment.new }
|
5
|
+
subject(:attachment) { Attachment.new(asset_content_type: 'image/jpg') }
|
6
6
|
|
7
7
|
describe ".attachment_styles" do
|
8
8
|
context "without extra options" do
|
@@ -12,7 +12,7 @@ module Brightcontent
|
|
12
12
|
let(:blog) { build_stubbed(:blog) }
|
13
13
|
before { attachment.attachable = blog }
|
14
14
|
|
15
|
-
|
15
|
+
its(:attachment_styles) { should == { test: "200x200", brightcontent: "100x100#", main: "200x200#" } }
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightcontent-attachments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.30
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.
|
21
|
+
version: 2.0.30
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.
|
29
|
+
version: 2.0.30
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: paperclip
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- .gitignore
|
149
149
|
- Gemfile
|
150
150
|
- Gemfile.lock
|
151
|
+
- README.md
|
151
152
|
- Rakefile
|
152
153
|
- app/assets/javascripts/brightcontent/.gitkeep
|
153
154
|
- app/assets/javascripts/brightcontent/attachments.js
|
@@ -162,6 +163,7 @@ files:
|
|
162
163
|
- db/migrate/20121222172513_create_attachments.rb
|
163
164
|
- lib/brightcontent-attachments.rb
|
164
165
|
- lib/brightcontent/attachable.rb
|
166
|
+
- lib/brightcontent/attachment_model_extensions.rb
|
165
167
|
- lib/brightcontent/attachments.rb
|
166
168
|
- lib/brightcontent/attachments/engine.rb
|
167
169
|
- lib/generators/brightcontent/attachments/install_generator.rb
|
@@ -238,7 +240,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
238
240
|
version: '0'
|
239
241
|
segments:
|
240
242
|
- 0
|
241
|
-
hash:
|
243
|
+
hash: 3038259697186777372
|
242
244
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
245
|
none: false
|
244
246
|
requirements:
|
@@ -247,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
249
|
version: '0'
|
248
250
|
segments:
|
249
251
|
- 0
|
250
|
-
hash:
|
252
|
+
hash: 3038259697186777372
|
251
253
|
requirements: []
|
252
254
|
rubyforge_project:
|
253
255
|
rubygems_version: 1.8.24
|