uploadbox 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/_image_uploader.coffee +44 -0
- data/app/assets/javascripts/file_uploader.coffee +4 -0
- data/app/assets/javascripts/jquery.fileupload.js +1315 -0
- data/app/assets/javascripts/jquery.iframe-transport.js +205 -0
- data/app/assets/javascripts/jquery.ui.widget.js +521 -0
- data/app/assets/stylesheets/bootstrap/_buttons.css +93 -0
- data/app/assets/stylesheets/bootstrap/_progress.css +207 -0
- data/app/assets/stylesheets/file_uploader.sass +134 -0
- data/app/controllers/file_uploader/application_controller.rb +4 -0
- data/app/controllers/file_uploader/images_controller.rb +20 -0
- data/app/helpers/file_uploader/application_helper.rb +4 -0
- data/app/models/concerns/image_uploadable.rb +11 -0
- data/app/models/concerns/uploadable.rb +9 -0
- data/app/uploaders/concerns/image_processing.rb +33 -0
- data/app/views/file_uploader/images/_uploader.html.slim +16 -0
- data/app/views/file_uploader/images/create.json.jbuilder +6 -0
- data/app/views/layouts/file_uploader/application.html.erb +14 -0
- data/config/routes.rb +3 -0
- data/lib/file_uploader/engine.rb +23 -0
- data/lib/file_uploader/version.rb +3 -0
- data/lib/file_uploader.rb +4 -0
- data/lib/generators/file_uploader/image/USAGE +8 -0
- data/lib/generators/file_uploader/image/image_generator.rb +34 -0
- data/lib/generators/file_uploader/image/templates/initializers/carrierwave.rb +22 -0
- data/lib/generators/file_uploader/image/templates/migrate/create_images.rb +10 -0
- data/lib/generators/file_uploader/image/templates/models/image.rb +3 -0
- data/lib/generators/file_uploader/image/templates/uploaders/image_uploader.rb +3 -0
- data/lib/tasks/file_uploader_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.coffee +3 -0
- data/test/dummy/app/assets/stylesheets/application.sass +2 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/posts_controller.rb +61 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/home_helper.rb +2 -0
- data/test/dummy/app/helpers/posts_helper.rb +2 -0
- data/test/dummy/app/models/post.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/posts/_form.slim +26 -0
- data/test/dummy/app/views/posts/edit.html.erb +6 -0
- data/test/dummy/app/views/posts/index.html.erb +32 -0
- data/test/dummy/app/views/posts/new.html.erb +5 -0
- data/test/dummy/app/views/posts/show.html.erb +19 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +11 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +6 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130624130249_create_posts.rb +10 -0
- data/test/dummy/db/schema.rb +33 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +20837 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/uploads/image/file/10/regular_tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/10/tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/11/regular_sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/11/sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/12/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/12/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/13/regular_tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/13/tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/14/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/14/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/15/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/15/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/16/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/16/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/17/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/17/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/18/regular_sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/18/sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/19/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/19/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/2/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/2/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/20/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/20/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/21/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/21/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/22/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/22/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/23/regular_sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/23/sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/27/monument1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/27/regular_monument1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/28/regular_sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/28/sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/3/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/3/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/33/regular_tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/33/tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/34/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/34/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/37/regular_sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/37/sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/38/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/38/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/4/food1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/4/regular_food1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/40/regular_tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/40/tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/5/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/5/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/50/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/50/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/51/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/51/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/56/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/56/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/57/monument1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/57/regular_monument1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/58/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/58/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/6/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/6/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/60/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/60/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/61/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/61/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/62/regular_sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/62/sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/63/food1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/63/regular_food1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/64/food1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/64/regular_food1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/65/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/65/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/66/regular_sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/66/sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/67/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/67/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/68/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/68/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/69/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/69/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/7/regular_sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/7/sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/71/regular_sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/71/sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/73/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/73/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/75/regular_sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/75/sports2.jpg +0 -0
- data/test/dummy/public/uploads/image/file/76/city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/76/regular_city1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/77/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/77/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/78/regular_tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/78/tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/79/regular_sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/79/sports3.jpg +0 -0
- data/test/dummy/public/uploads/image/file/8/regular_sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/8/sports1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/80/regular_tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/80/tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/81/food1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/81/regular_food1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/84/regular_tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/84/tree1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/9/monument1.jpg +0 -0
- data/test/dummy/public/uploads/image/file/9/regular_monument1.jpg +0 -0
- data/test/dummy/public/uploads/tmp/20130627-0910-4782-4339/regular_sports2.jpg +0 -0
- data/test/dummy/public/uploads/tmp/20130627-0910-4782-4339/sports2.jpg +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5b407eb4aa13436bd984a25ae192ac2652db5759/_buttons.cssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/5b407eb4aa13436bd984a25ae192ac2652db5759/_progress.cssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/7662e69738309f2449b5f34a623416e02bd31561/_buttons.cssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/7662e69738309f2449b5f34a623416e02bd31561/_progress.cssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/8160dfcd3114403b4930d081794c16af3ebe3ba6/file_uploader.sassc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/b3df06ca649a689a4fd2f92938f644fb80a0b76c/_bootstrap_btn.cssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/b3df06ca649a689a4fd2f92938f644fb80a0b76c/_fileupload.sassc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/b3df06ca649a689a4fd2f92938f644fb80a0b76c/application.sassc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/b3df06ca649a689a4fd2f92938f644fb80a0b76c/bootstrap.cssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sass/b3df06ca649a689a4fd2f92938f644fb80a0b76c/scaffold.cssc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/036b77eb9437a0b942e844f0664f2f4d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/17aca7a5440d34b72f7519ffa1ab8379 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1a2ba42bd8d58781c7bf0e3d7a33c3c8 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1a6ee5f7be55d7f22c31aef2af1aaad7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1c9faaf28d05409b88ad3113374d613c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1e8f75a6b5b33970fb8e397347caa0a1 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/21252e0c63eb196e8181b7754194d61a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/22a20eb270b5f0f317e13738bcb73925 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/24204f742af588c8166d3160b500d20f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2822de3b22c28bd5e718c9bf500457b2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/40fc2f3d2a468a00e463f1d313cb1683 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/416150dc3ac35079c94273cc46e90aa6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4726dfba577c185e9355be4a832efb8e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/47b830f344f953bcd6328a49ab616646 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4968b24dd091b0fd0e209d67b392be52 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4de2e83f99a4262aa0c8cc6035da959a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4fc9258d221c999ba0aa1d80dbf04e5f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/50afae431e200795f9adc76e38e6130d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5384ad85f52d3272dbc64d46ef3876a4 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/54016e9e60301e29500bab9b9815de1e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5608eba5a4ac26d717d876734486c3f5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/5b6cfeddfda27d92843b8dac8d034ed3 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/60f1e97d7008b3ed41f72855a4228bb9 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/734b52a3ac29f5ddc9f0cb98046c2315 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/80edcfeb723573fc6499580e5771bb17 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/851e2975dd2977ad620f690b923f3253 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/87cf3e4938b1fefe951ae62b201d8874 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9199b64aec237a59d258f4f149262be1 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9742c38f2d32a6142740215f517a73f5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9bccb521761b095f6c0255ab7fc9b3fb +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a4b8f7dbc861343715de9ec929b0e4ca +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a6ec7a5f259e52c790fb0f84b69a696e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a7ab4e7b3ec8c08a267319920b433fda +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a88d9c609d05fcc4670c8742b41816c0 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a9eb7874ccfec01c26d50fdc46d50639 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/a9f028f7a492b5907ed80268be8f50f4 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/abbcfa48059290465d8e74aa4fd0d4de +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/add025ab0eb13a6d4180af43d5df39df +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/b878faf942403e313a5b103e5d80488e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/bd0405b0fbaa0e8a1924bd19f9d52570 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c2a831ed79df487d6485a5c9c52766c2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/c85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d066c004d1fd26ae76a61303a7a18145 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d080d25d00bbfe7b19138cf7a648dd8c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d247dc85ce71f977c809c8b94d0223ed +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d2a1c642980b0a48bd71e7021eea73a1 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d4c6a4b4d2ce87da7c22742887071603 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d795fd4f9a32e134a5dd37f973a17176 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d87810c66e05721ba749c5901c1af296 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ebe08f689f659c024f467b77f32a1c49 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/edbef6e0d0a4742346cf479f2c522eb0 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/file_uploader_test.rb +7 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- metadata +717 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
class PostsController < ApplicationController
|
2
|
+
before_action :set_post, only: [:show, :edit, :update, :destroy]
|
3
|
+
|
4
|
+
# GET /posts
|
5
|
+
def index
|
6
|
+
@posts = Post.all
|
7
|
+
end
|
8
|
+
|
9
|
+
# GET /posts/1
|
10
|
+
def show
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /posts/new
|
14
|
+
def new
|
15
|
+
@post = Post.new
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /posts/1/edit
|
19
|
+
def edit
|
20
|
+
end
|
21
|
+
|
22
|
+
# POST /posts
|
23
|
+
def create
|
24
|
+
@post = Post.new(post_params)
|
25
|
+
@post.image = Image.find_by(id: params[:image_id])
|
26
|
+
|
27
|
+
if @post.save
|
28
|
+
redirect_to @post, notice: 'Post was successfully created.'
|
29
|
+
else
|
30
|
+
render action: 'new'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# PATCH/PUT /posts/1
|
35
|
+
def update
|
36
|
+
@post.image = Image.find_by(id: params[:image_id])
|
37
|
+
|
38
|
+
if @post.update(post_params)
|
39
|
+
redirect_to @post, notice: 'Post was successfully updated.'
|
40
|
+
else
|
41
|
+
render action: 'edit'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# DELETE /posts/1
|
46
|
+
def destroy
|
47
|
+
@post.destroy
|
48
|
+
redirect_to posts_url, notice: 'Post was successfully destroyed.'
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
53
|
+
def set_post
|
54
|
+
@post = Post.find(params[:id])
|
55
|
+
end
|
56
|
+
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
58
|
+
def post_params
|
59
|
+
params.require(:post).permit(:title, :body)
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
= form_for(@post) do |f|
|
2
|
+
- if @post.errors.any?
|
3
|
+
#error_explanation
|
4
|
+
h2 #{pluralize(@post.errors.count, "error")} prohibited this post from being saved
|
5
|
+
|
6
|
+
ul
|
7
|
+
- @post.errors.full_messages.each do |msg|
|
8
|
+
li = msg
|
9
|
+
|
10
|
+
.field
|
11
|
+
= f.image_uploader
|
12
|
+
|
13
|
+
.field
|
14
|
+
= f.label :title
|
15
|
+
= f.text_field :title
|
16
|
+
|
17
|
+
|
18
|
+
.field
|
19
|
+
= f.label :body
|
20
|
+
= f.text_area :body
|
21
|
+
|
22
|
+
|
23
|
+
.actions
|
24
|
+
= f.submit
|
25
|
+
|
26
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<h1>Listing posts</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>Image</th>
|
7
|
+
<th>Title</th>
|
8
|
+
<th>Body</th>
|
9
|
+
<th></th>
|
10
|
+
<th></th>
|
11
|
+
<th></th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
|
15
|
+
<tbody>
|
16
|
+
<% @posts.each do |post| %>
|
17
|
+
<tr>
|
18
|
+
|
19
|
+
<td><%= image_tag post.image.file.regular, width: 50, height: 50 if post.image? %></td>
|
20
|
+
<td><%= post.title %></td>
|
21
|
+
<td><%= post.body %></td>
|
22
|
+
<td><%= link_to 'Show', post %></td>
|
23
|
+
<td><%= link_to 'Edit', edit_post_path(post) %></td>
|
24
|
+
<td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
29
|
+
|
30
|
+
<br>
|
31
|
+
|
32
|
+
<%= link_to 'New Post', new_post_path %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Title:</strong>
|
5
|
+
<%= @post.title %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Image:</strong>
|
10
|
+
<%= image_tag @post.image.file.regular.url, width: 50, height: 50 if @post.image? %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<strong>Body:</strong>
|
15
|
+
<%= @post.body %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<%= link_to 'Edit', edit_post_path(@post) %> |
|
19
|
+
<%= link_to 'Back', posts_path %>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "file_uploader"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
config.cache_classes = false
|
3
|
+
config.eager_load = false
|
4
|
+
config.consider_all_requests_local = true
|
5
|
+
config.action_controller.perform_caching = false
|
6
|
+
config.action_mailer.raise_delivery_errors = false
|
7
|
+
config.active_support.deprecation = :log
|
8
|
+
config.active_record.migration_error = :page_load
|
9
|
+
config.assets.debug = true
|
10
|
+
config.action_controller.action_on_unpermitted_parameters = :raise
|
11
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both thread web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
+
# config.action_dispatch.rack_cache = true
|
21
|
+
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
+
config.serve_static_assets = false
|
24
|
+
|
25
|
+
# Compress JavaScripts and CSS.
|
26
|
+
config.assets.js_compressor = :uglifier
|
27
|
+
# config.assets.css_compressor = :sass
|
28
|
+
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
+
config.assets.compile = false
|
31
|
+
|
32
|
+
# Generate digests for assets URLs.
|
33
|
+
config.assets.digest = true
|
34
|
+
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
36
|
+
config.assets.version = '1.0'
|
37
|
+
|
38
|
+
# Specifies the header that your server uses for sending files.
|
39
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
+
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
+
# config.force_ssl = true
|
44
|
+
|
45
|
+
# Set to :debug to see everything in the log.
|
46
|
+
config.log_level = :info
|
47
|
+
|
48
|
+
# Prepend all log lines with the following tags.
|
49
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
50
|
+
|
51
|
+
# Use a different logger for distributed setups.
|
52
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
53
|
+
|
54
|
+
# Use a different cache store in production.
|
55
|
+
# config.cache_store = :mem_cache_store
|
56
|
+
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
58
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
59
|
+
|
60
|
+
# Precompile additional assets.
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
62
|
+
# config.assets.precompile += %w( search.js )
|
63
|
+
|
64
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
65
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
66
|
+
# config.action_mailer.raise_delivery_errors = false
|
67
|
+
|
68
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
70
|
+
config.i18n.fallbacks = true
|
71
|
+
|
72
|
+
# Send deprecation notices to registered listeners.
|
73
|
+
config.active_support.deprecation = :notify
|
74
|
+
|
75
|
+
# Disable automatic flushing of the log to improve performance.
|
76
|
+
# config.autoflush_log = false
|
77
|
+
|
78
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
+
config.log_formatter = ::Logger::Formatter.new
|
80
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Print deprecation notices to the stderr.
|
35
|
+
config.active_support.deprecation = :stderr
|
36
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Dummy::Application.config.secret_key_base = 'c48a3d2319fcd6695f972c8295b171c71bc4f8ab9cd0c32348f9b441f1057369685181282307707daa13d38bb2df8d4379999bc1f1fb60881c381ec5d9f78392'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
Binary file
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20130624130939) do
|
15
|
+
|
16
|
+
create_table "images", force: true do |t|
|
17
|
+
t.string "file"
|
18
|
+
t.integer "imageable_id"
|
19
|
+
t.string "imageable_type"
|
20
|
+
t.datetime "created_at"
|
21
|
+
t.datetime "updated_at"
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index "images", ["imageable_id", "imageable_type"], name: "index_images_on_imageable_id_and_imageable_type"
|
25
|
+
|
26
|
+
create_table "posts", force: true do |t|
|
27
|
+
t.string "title"
|
28
|
+
t.text "body"
|
29
|
+
t.datetime "created_at"
|
30
|
+
t.datetime "updated_at"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
Binary file
|