rails_admin_featured_content 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +81 -0
- data/Rakefile +21 -0
- data/app/assets/images/fc-image-default.jpg +0 -0
- data/app/assets/images/fc-loading.svg +1 -0
- data/app/assets/images/fc-snippet-highlight.jpg +0 -0
- data/app/assets/images/fc-snippet-slide.jpg +0 -0
- data/app/assets/images/fc-snippet-text.jpg +0 -0
- data/app/assets/images/fc-snippet-three.jpg +0 -0
- data/app/assets/images/fc-snippet-two.jpg +0 -0
- data/app/assets/javascripts/rails_admin/featured_content.js.erb +399 -0
- data/app/assets/stylesheets/rails_admin/featured_content.scss +599 -0
- data/app/controllers/rails_admin_featured_content/featured_content_controller.rb +28 -0
- data/app/models/.keep +0 -0
- data/app/models/rails_admin_featured_content/featured_content.rb +16 -0
- data/app/models/rails_admin_featured_content/featured_content_image.rb +9 -0
- data/app/views/.gitkeep +0 -0
- data/app/views/rails_admin/main/featured_content.html.erb +42 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config/initializers/assets.rb +7 -0
- data/config/locales/featured_content.en.yml +17 -0
- data/config/locales/featured_content.pt-BR.yml +17 -0
- data/config/routes.rb +9 -0
- data/lib/generators/rails_admin_featured_content_generator.rb +31 -0
- data/lib/generators/templates/create_featured_content_images_migration.rb +10 -0
- data/lib/generators/templates/create_featured_content_migration.rb +11 -0
- data/lib/generators/templates/featured_content_image_uploader.rb +50 -0
- data/lib/generators/templates/rails_admin_featured_content.rb +22 -0
- data/lib/rails_admin_featured_content.rb +55 -0
- data/lib/rails_admin_featured_content/engine.rb +23 -0
- data/lib/rails_admin_featured_content/version.rb +3 -0
- data/rails_admin_featured_content.gemspec +45 -0
- data/spec/controllers/rails_admin_featured_content/featured_content_controller_spec.rb +42 -0
- data/spec/dummy/Gemfile +11 -0
- data/spec/dummy/Gemfile.lock +235 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/uploaders/content_builder_image_uploader.rb +54 -0
- data/spec/dummy/app/uploaders/featured_content_image_uploader.rb +50 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +31 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/rails_admin.rb +37 -0
- data/spec/dummy/config/initializers/rails_admin_content_builder.rb +37 -0
- data/spec/dummy/config/initializers/rails_admin_featured_content.rb +22 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/simple_form.rb +165 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/locales/simple_form.en.yml +31 -0
- data/spec/dummy/config/routes.rb +57 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20160729105801_create_content_builder_categories.rb +10 -0
- data/spec/dummy/db/migrate/20160729105802_create_content_builders.rb +16 -0
- data/spec/dummy/db/migrate/20160729105803_create_content_builder_images.rb +10 -0
- data/spec/dummy/db/migrate/20160729105947_create_featured_contents.rb +11 -0
- data/spec/dummy/db/migrate/20160729105948_create_featured_content_images.rb +10 -0
- data/spec/dummy/db/schema.rb +64 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/spec/dummy/log/development.log +1698 -0
- data/spec/dummy/log/test.log +36 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/1/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/1/example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/1/left_or_right_example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/2/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/2/example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_content_builder/content_builder_image/image/2/left_or_right_example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_featured_content/featured_content_image/image/1/example.jpg +0 -0
- data/spec/dummy/public/uploads/rails_admin_featured_content/featured_content_image/image/1/thumb_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693110-14578-0001-7683/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693110-14578-0001-7683/example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693110-14578-0001-7683/left_or_right_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693202-14651-0001-6505/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693202-14651-0001-6505/example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693202-14651-0001-6505/left_or_right_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693245-14728-0001-4392/center_example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693245-14728-0001-4392/example.jpg +0 -0
- data/spec/dummy/public/uploads/tmp/1461693245-14728-0001-4392/left_or_right_example.jpg +0 -0
- data/spec/factories/featured_content.rb +7 -0
- data/spec/factories/featured_content_image.rb +7 -0
- data/spec/fixtures/assets/example.jpg +0 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/version_spec.rb +7 -0
- data/vendor/assets/stylesheets/rails_admin_featured_content.scss +557 -0
- metadata +575 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RailsAdminFeaturedContent::FeaturedContentController, type: :controller do
|
4
|
+
describe 'PUT #create_images' do
|
5
|
+
it "Should return valid JSON" do
|
6
|
+
featured_content = FactoryGirl.create :featured_content
|
7
|
+
put :create_images, id: featured_content.id,
|
8
|
+
featured_content_image: Rack::Test::UploadedFile.new(File.join('spec', 'fixtures', 'assets', 'example.jpg'))
|
9
|
+
|
10
|
+
json = JSON.parse(response.body)
|
11
|
+
path = '/uploads/rails_admin_featured_content/featured_content_image/image/1/'
|
12
|
+
|
13
|
+
expect(response.status).to eq 200
|
14
|
+
expect(json['image']['url']).to eq path + 'example.jpg'
|
15
|
+
expect(json['image']['thumb']['url']).to eq path + 'thumb_example.jpg'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'GET #search_content' do
|
20
|
+
it "Should return last created content" do
|
21
|
+
featured_content = FactoryGirl.create :featured_content
|
22
|
+
content_builder = RailsAdminContentBuilder::ContentBuilder.create(
|
23
|
+
title: Faker::Lorem.characters,
|
24
|
+
date_publish: Time.now - 1.day,
|
25
|
+
written_by: Faker::Name.name,
|
26
|
+
content: '',
|
27
|
+
content_builder_category_id: 1,
|
28
|
+
status: true
|
29
|
+
)
|
30
|
+
|
31
|
+
get :search_content, id: featured_content.id, term: content_builder.title[0,15]
|
32
|
+
|
33
|
+
json = JSON.parse(response.body)
|
34
|
+
|
35
|
+
puts response.body
|
36
|
+
|
37
|
+
expect(response.status).to eq 200
|
38
|
+
# expect(json['image']['url']).to eq path + 'example.jpg'
|
39
|
+
# expect(json['image']['thumb']['url']).to eq path + 'thumb_example.jpg'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/dummy/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
group :development, :test do
|
4
|
+
gem 'rspec-rails'
|
5
|
+
gem 'factory_girl_rails'
|
6
|
+
gem 'sqlite3'
|
7
|
+
gem 'rails_admin'
|
8
|
+
gem 'shoulda-matchers', '~> 3.1'
|
9
|
+
gem 'rails_admin_content_builder', git: 'git://github.com/luizpicolo/rails_admin_content_builder.git'
|
10
|
+
gem 'rails_admin_featured_content', path: '../../'
|
11
|
+
end
|
@@ -0,0 +1,235 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/luizpicolo/rails_admin_content_builder.git
|
3
|
+
revision: 05ec073a7f276a4d40dcd6eac7173e0f019cf925
|
4
|
+
specs:
|
5
|
+
rails_admin_content_builder (1.0.1)
|
6
|
+
carrierwave (~> 0.11.0)
|
7
|
+
friendly_id (~> 5.1.0)
|
8
|
+
medium-editor-rails (~> 2.1.0)
|
9
|
+
mini_magick (~> 4.5.1)
|
10
|
+
rails-html-sanitizer
|
11
|
+
search_cop (~> 1.0.6)
|
12
|
+
simple_form (~> 3.2)
|
13
|
+
|
14
|
+
PATH
|
15
|
+
remote: ../../
|
16
|
+
specs:
|
17
|
+
rails_admin_featured_content (1.0.3)
|
18
|
+
carrierwave (~> 0.11, >= 0.11.0)
|
19
|
+
croppie_rails (~> 1.2, >= 1.2.0)
|
20
|
+
friendly_id (~> 5.1, >= 5.1.0)
|
21
|
+
medium-editor-rails (~> 2.1, >= 2.1.0)
|
22
|
+
mini_magick (~> 4.5, >= 4.5.1)
|
23
|
+
owlcarousel-rails (~> 0)
|
24
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
25
|
+
simple_form (~> 3.2)
|
26
|
+
|
27
|
+
GEM
|
28
|
+
remote: https://rubygems.org/
|
29
|
+
specs:
|
30
|
+
actionmailer (4.2.6)
|
31
|
+
actionpack (= 4.2.6)
|
32
|
+
actionview (= 4.2.6)
|
33
|
+
activejob (= 4.2.6)
|
34
|
+
mail (~> 2.5, >= 2.5.4)
|
35
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
36
|
+
actionpack (4.2.6)
|
37
|
+
actionview (= 4.2.6)
|
38
|
+
activesupport (= 4.2.6)
|
39
|
+
rack (~> 1.6)
|
40
|
+
rack-test (~> 0.6.2)
|
41
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
42
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
43
|
+
actionview (4.2.6)
|
44
|
+
activesupport (= 4.2.6)
|
45
|
+
builder (~> 3.1)
|
46
|
+
erubis (~> 2.7.0)
|
47
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
48
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
49
|
+
activejob (4.2.6)
|
50
|
+
activesupport (= 4.2.6)
|
51
|
+
globalid (>= 0.3.0)
|
52
|
+
activemodel (4.2.6)
|
53
|
+
activesupport (= 4.2.6)
|
54
|
+
builder (~> 3.1)
|
55
|
+
activerecord (4.2.6)
|
56
|
+
activemodel (= 4.2.6)
|
57
|
+
activesupport (= 4.2.6)
|
58
|
+
arel (~> 6.0)
|
59
|
+
activesupport (4.2.6)
|
60
|
+
i18n (~> 0.7)
|
61
|
+
json (~> 1.7, >= 1.7.7)
|
62
|
+
minitest (~> 5.1)
|
63
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
64
|
+
tzinfo (~> 1.1)
|
65
|
+
arel (6.0.3)
|
66
|
+
builder (3.2.2)
|
67
|
+
carrierwave (0.11.2)
|
68
|
+
activemodel (>= 3.2.0)
|
69
|
+
activesupport (>= 3.2.0)
|
70
|
+
json (>= 1.7)
|
71
|
+
mime-types (>= 1.16)
|
72
|
+
mimemagic (>= 0.3.0)
|
73
|
+
coffee-rails (4.1.1)
|
74
|
+
coffee-script (>= 2.2.0)
|
75
|
+
railties (>= 4.0.0, < 5.1.x)
|
76
|
+
coffee-script (2.4.1)
|
77
|
+
coffee-script-source
|
78
|
+
execjs
|
79
|
+
coffee-script-source (1.10.0)
|
80
|
+
concurrent-ruby (1.0.1)
|
81
|
+
croppie_rails (1.2.0)
|
82
|
+
diff-lcs (1.2.5)
|
83
|
+
erubis (2.7.0)
|
84
|
+
execjs (2.6.0)
|
85
|
+
factory_girl (4.7.0)
|
86
|
+
activesupport (>= 3.0.0)
|
87
|
+
factory_girl_rails (4.7.0)
|
88
|
+
factory_girl (~> 4.7.0)
|
89
|
+
railties (>= 3.0.0)
|
90
|
+
font-awesome-rails (4.6.1.0)
|
91
|
+
railties (>= 3.2, < 5.1)
|
92
|
+
friendly_id (5.1.0)
|
93
|
+
activerecord (>= 4.0.0)
|
94
|
+
globalid (0.3.6)
|
95
|
+
activesupport (>= 4.1.0)
|
96
|
+
haml (4.0.7)
|
97
|
+
tilt
|
98
|
+
i18n (0.7.0)
|
99
|
+
jquery-rails (4.1.1)
|
100
|
+
rails-dom-testing (>= 1, < 3)
|
101
|
+
railties (>= 4.2.0)
|
102
|
+
thor (>= 0.14, < 2.0)
|
103
|
+
jquery-ui-rails (5.0.5)
|
104
|
+
railties (>= 3.2.16)
|
105
|
+
json (1.8.3)
|
106
|
+
kaminari (0.16.3)
|
107
|
+
actionpack (>= 3.0.0)
|
108
|
+
activesupport (>= 3.0.0)
|
109
|
+
loofah (2.0.3)
|
110
|
+
nokogiri (>= 1.5.9)
|
111
|
+
mail (2.6.4)
|
112
|
+
mime-types (>= 1.16, < 4)
|
113
|
+
medium-editor-rails (2.1.0)
|
114
|
+
railties (>= 3.0)
|
115
|
+
mime-types (3.0)
|
116
|
+
mime-types-data (~> 3.2015)
|
117
|
+
mime-types-data (3.2016.0221)
|
118
|
+
mimemagic (0.3.1)
|
119
|
+
mini_magick (4.5.1)
|
120
|
+
mini_portile2 (2.0.0)
|
121
|
+
minitest (5.8.4)
|
122
|
+
nested_form (0.3.2)
|
123
|
+
nokogiri (1.6.7.2)
|
124
|
+
mini_portile2 (~> 2.0.0.rc2)
|
125
|
+
owlcarousel-rails (0.1.31)
|
126
|
+
jquery-rails
|
127
|
+
polyglot (0.3.5)
|
128
|
+
rack (1.6.4)
|
129
|
+
rack-pjax (0.8.0)
|
130
|
+
nokogiri (~> 1.5)
|
131
|
+
rack (~> 1.1)
|
132
|
+
rack-test (0.6.3)
|
133
|
+
rack (>= 1.0)
|
134
|
+
rails (4.2.6)
|
135
|
+
actionmailer (= 4.2.6)
|
136
|
+
actionpack (= 4.2.6)
|
137
|
+
actionview (= 4.2.6)
|
138
|
+
activejob (= 4.2.6)
|
139
|
+
activemodel (= 4.2.6)
|
140
|
+
activerecord (= 4.2.6)
|
141
|
+
activesupport (= 4.2.6)
|
142
|
+
bundler (>= 1.3.0, < 2.0)
|
143
|
+
railties (= 4.2.6)
|
144
|
+
sprockets-rails
|
145
|
+
rails-deprecated_sanitizer (1.0.3)
|
146
|
+
activesupport (>= 4.2.0.alpha)
|
147
|
+
rails-dom-testing (1.0.7)
|
148
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
149
|
+
nokogiri (~> 1.6.0)
|
150
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
151
|
+
rails-html-sanitizer (1.0.3)
|
152
|
+
loofah (~> 2.0)
|
153
|
+
rails_admin (0.8.1)
|
154
|
+
builder (~> 3.1)
|
155
|
+
coffee-rails (~> 4.0)
|
156
|
+
font-awesome-rails (>= 3.0, < 5)
|
157
|
+
haml (~> 4.0)
|
158
|
+
jquery-rails (>= 3.0, < 5)
|
159
|
+
jquery-ui-rails (~> 5.0)
|
160
|
+
kaminari (~> 0.14)
|
161
|
+
nested_form (~> 0.3)
|
162
|
+
rack-pjax (~> 0.7)
|
163
|
+
rails (~> 4.0)
|
164
|
+
remotipart (~> 1.0)
|
165
|
+
safe_yaml (~> 1.0)
|
166
|
+
sass-rails (>= 4.0, < 6)
|
167
|
+
railties (4.2.6)
|
168
|
+
actionpack (= 4.2.6)
|
169
|
+
activesupport (= 4.2.6)
|
170
|
+
rake (>= 0.8.7)
|
171
|
+
thor (>= 0.18.1, < 2.0)
|
172
|
+
rake (11.1.2)
|
173
|
+
remotipart (1.2.1)
|
174
|
+
rspec-core (3.4.4)
|
175
|
+
rspec-support (~> 3.4.0)
|
176
|
+
rspec-expectations (3.4.0)
|
177
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
178
|
+
rspec-support (~> 3.4.0)
|
179
|
+
rspec-mocks (3.4.1)
|
180
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
181
|
+
rspec-support (~> 3.4.0)
|
182
|
+
rspec-rails (3.4.2)
|
183
|
+
actionpack (>= 3.0, < 4.3)
|
184
|
+
activesupport (>= 3.0, < 4.3)
|
185
|
+
railties (>= 3.0, < 4.3)
|
186
|
+
rspec-core (~> 3.4.0)
|
187
|
+
rspec-expectations (~> 3.4.0)
|
188
|
+
rspec-mocks (~> 3.4.0)
|
189
|
+
rspec-support (~> 3.4.0)
|
190
|
+
rspec-support (3.4.1)
|
191
|
+
safe_yaml (1.0.4)
|
192
|
+
sass (3.4.22)
|
193
|
+
sass-rails (5.0.4)
|
194
|
+
railties (>= 4.0.0, < 5.0)
|
195
|
+
sass (~> 3.1)
|
196
|
+
sprockets (>= 2.8, < 4.0)
|
197
|
+
sprockets-rails (>= 2.0, < 4.0)
|
198
|
+
tilt (>= 1.1, < 3)
|
199
|
+
search_cop (1.0.6)
|
200
|
+
treetop
|
201
|
+
shoulda-matchers (3.1.1)
|
202
|
+
activesupport (>= 4.0.0)
|
203
|
+
simple_form (3.2.1)
|
204
|
+
actionpack (> 4, < 5.1)
|
205
|
+
activemodel (> 4, < 5.1)
|
206
|
+
sprockets (3.6.0)
|
207
|
+
concurrent-ruby (~> 1.0)
|
208
|
+
rack (> 1, < 3)
|
209
|
+
sprockets-rails (3.0.4)
|
210
|
+
actionpack (>= 4.0)
|
211
|
+
activesupport (>= 4.0)
|
212
|
+
sprockets (>= 3.0.0)
|
213
|
+
sqlite3 (1.3.11)
|
214
|
+
thor (0.19.1)
|
215
|
+
thread_safe (0.3.5)
|
216
|
+
tilt (2.0.2)
|
217
|
+
treetop (1.6.8)
|
218
|
+
polyglot (~> 0.3)
|
219
|
+
tzinfo (1.2.2)
|
220
|
+
thread_safe (~> 0.1)
|
221
|
+
|
222
|
+
PLATFORMS
|
223
|
+
ruby
|
224
|
+
|
225
|
+
DEPENDENCIES
|
226
|
+
factory_girl_rails
|
227
|
+
rails_admin
|
228
|
+
rails_admin_content_builder!
|
229
|
+
rails_admin_featured_content!
|
230
|
+
rspec-rails
|
231
|
+
shoulda-matchers (~> 3.1)
|
232
|
+
sqlite3
|
233
|
+
|
234
|
+
BUNDLED WITH
|
235
|
+
1.12.2
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class ContentBuilderImageUploader < CarrierWave::Uploader::Base
|
4
|
+
# Include RMagick or MiniMagick support:
|
5
|
+
# include CarrierWave::RMagick
|
6
|
+
include CarrierWave::MiniMagick
|
7
|
+
|
8
|
+
# Choose what kind of storage to use for this uploader:
|
9
|
+
storage :file
|
10
|
+
# storage :fog
|
11
|
+
|
12
|
+
# Override the directory where uploaded files will be stored.
|
13
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
14
|
+
def store_dir
|
15
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
16
|
+
end
|
17
|
+
|
18
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
19
|
+
# def default_url
|
20
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
21
|
+
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
22
|
+
#
|
23
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
24
|
+
# end
|
25
|
+
|
26
|
+
# Process files as they are uploaded:
|
27
|
+
# process :scale => [200, 300]
|
28
|
+
#
|
29
|
+
# def scale(width, height)
|
30
|
+
# # do something
|
31
|
+
# end
|
32
|
+
|
33
|
+
# Create different versions of your uploaded files:
|
34
|
+
version :left_or_right do
|
35
|
+
process :resize_to_fit => [450, 450]
|
36
|
+
end
|
37
|
+
|
38
|
+
version :center do
|
39
|
+
process :resize_to_fit => [900, 900]
|
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
|
+
%w(jpg jpeg gif png)
|
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
|
+
|
54
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class FeaturedContentImageUploader < CarrierWave::Uploader::Base
|
4
|
+
# Include RMagick or MiniMagick support:
|
5
|
+
# include CarrierWave::RMagick
|
6
|
+
include CarrierWave::MiniMagick
|
7
|
+
|
8
|
+
# Choose what kind of storage to use for this uploader:
|
9
|
+
storage :file
|
10
|
+
# storage :fog
|
11
|
+
|
12
|
+
# Override the directory where uploaded files will be stored.
|
13
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
14
|
+
def store_dir
|
15
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
16
|
+
end
|
17
|
+
|
18
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
19
|
+
# def default_url
|
20
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
21
|
+
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
22
|
+
#
|
23
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
24
|
+
# end
|
25
|
+
|
26
|
+
# Process files as they are uploaded:
|
27
|
+
# process :scale => [200, 300]
|
28
|
+
#
|
29
|
+
# def scale(width, height)
|
30
|
+
# # do something
|
31
|
+
# end
|
32
|
+
|
33
|
+
# Create different versions of your uploaded files:
|
34
|
+
version :thumb do
|
35
|
+
process :resize_to_fit => [400, 400]
|
36
|
+
end
|
37
|
+
|
38
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
39
|
+
# For images you might use something like this:
|
40
|
+
def extension_white_list
|
41
|
+
%w(jpg jpeg gif png)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Override the filename of the uploaded files:
|
45
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
46
|
+
# def filename
|
47
|
+
# "something.jpg" if original_filename
|
48
|
+
# end
|
49
|
+
|
50
|
+
end
|