pages_cms 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/stylesheets/pages_cms/select2.min.css +495 -1
  4. data/app/controllers/pages_cms/admin/images_controller.rb +6 -37
  5. data/app/models/pages_cms/image.rb +2 -20
  6. data/app/uploaders/pages_cms/image_uploader.rb +54 -0
  7. data/app/views/pages_cms/admin/images/index.html.haml +13 -23
  8. data/app/views/pages_cms/admin/pages/index.html.haml +16 -5
  9. data/app/views/pages_cms/pages/_main.html.haml +2 -2
  10. data/app/views/pages_cms/pages/_slider.html.erb +1 -1
  11. data/app/views/pages_cms/pages/show.html.haml +3 -3
  12. data/config/routes.rb +2 -2
  13. data/lib/pages_cms/engine.rb +3 -0
  14. data/lib/pages_cms/version.rb +1 -1
  15. data/test/dummy/config/initializers/carrier_wave.rb +11 -0
  16. data/test/dummy/log/development.log +7880 -0
  17. data/test/dummy/public/images/1435125556My Image +0 -0
  18. data/test/dummy/public/images/1435125755m-image +0 -0
  19. data/test/dummy/public/images/14351258131415251672879.jpg +0 -0
  20. data/test/dummy/public/images/14351267251415157913705.jpg +0 -0
  21. data/test/dummy/public/images/cadillac-6531.jpg +0 -0
  22. data/test/dummy/public/uploads/tmp/1435124724-39312-0784/cadillac-6531.jpg +0 -0
  23. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/-lOmzZ5qDC3DxWaGQU-7HJwc94N6tJIinIYAmUVIoRQ.cache +2 -0
  24. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/0xtixgpGyaq0N-WK0hMuY26ZItKdDUOkA1hHGqUdPS8.cache +0 -0
  25. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/18rRJ0LoHe3uFLatEO8ebVrfV8rnAJYU2bp9K5Ezc1g.cache +0 -0
  26. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/2KcyYqaZqTY7UgCCH_Dea1ywFlj_qga38O8cWi143cs.cache +1 -0
  27. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/52E5xcyk_DA-IV5qQuW2disy5nFXyK7pEV8ajYmgJho.cache +3 -0
  28. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/64Jv1o0gdz0OAYkqNI4C18F3NsFm8UHNfC6bWbn-0Tw.cache +0 -0
  29. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/7sBziZeN1LuYOTZTFLOuGSKfMZZuiQvIzcvXgZQsnvM.cache +1 -0
  30. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/899qsxako_YeWS0vtGY-uC2QLGEA9K7exmnTLVU5s8E.cache +1 -0
  31. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/8DFDFhGbzmUAJaBttqAcZkaWnPfxL8Kk9Ae4yflWKdk.cache +0 -0
  32. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/9Jjn2M5heYQN9ne9JtP1NwhH_EEZyic2u1-Y-2DUNfU.cache +1 -0
  33. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/9X6OoK62kCncAZFd1t6pFzJxjdt0bDjkBleNfZ0fmZM.cache +0 -0
  34. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/AfTk_3r2rT8E62rY4M9VeTmXav6QUBRf7psngW8ZIPg.cache +0 -0
  35. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/BGKtfYQsfkOfr9ifegWHnsVXqQzgk6ATmdSbWncI8q0.cache +1 -0
  36. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/C6XB49ObB7e6JwnbQFKLIe_sSaXRjiLRm4cT-vuQuAo.cache +0 -0
  37. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/Efbo3UpXTn66pa0sNUN5MVk_a__zFpeh08j4HAabZ9w.cache +1 -0
  38. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/HctsZjTAda61VX-mppvzp89Nr_LLK_hJ2GF6gsSJmsQ.cache +0 -0
  39. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/IAitp9yd5ssqxqvFD7-FRSnMALLvW5GIpidZ0bjaybk.cache +1 -0
  40. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/J2YjR7WH4pBb37JtVAbShtVajuVqjRx2udO7hrgNO6M.cache +0 -0
  41. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/O7E0_fHAP-btAD-grcVQPnMV8OI4lDEpiz4L5hdeCkc.cache +1 -0
  42. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/PU4VUqLa2hhY1VchXLQb64cqbaoxH6Pl2T6g0ABOnVA.cache +1 -0
  43. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/Pa6DsLOg2-bLSNAlEThDDEmbWCMxAdPu-PdZswXwNJM.cache +0 -0
  44. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/Q1XuPZHU6X2sUU6vMOxgX5wrKWvm5igMR-rr9jMeTKk.cache +0 -0
  45. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/RJ-0rs6u2wqJ74gO4wcOucSIu-S05IrUtyFuztGu04k.cache +0 -0
  46. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/SFHemPd80mlY3aSBTcYzVZ0ctNI2TKfwte0eY3EF9TE.cache +0 -0
  47. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/UA3kym8Vb6S_cQEWPfPccyOFRpaQLOINGgzO1RtxgcY.cache +1 -0
  48. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/V_GZ9PxDGuUTaZ80QqA292-PAdR0P-Ds4lU49NHxgg0.cache +1 -0
  49. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/Vdyi8tBM4Jkjbb4SwTqvKpZ9hjB-nWe7Do-CC6yBF6w.cache +0 -0
  50. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/WpDfY1Qq5jOVvzeZHeO8mbRuKAF7pK69sstcriijjVE.cache +0 -0
  51. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/XUk0EKo0R7KpGwFBZwm6pXUA8gfPaBPHv7_rTMNVa0o.cache +0 -0
  52. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/_g8R2-QouLzovkcCMY6F8IS2wcsT-PgCNUOoUgcyC1o.cache +1 -0
  53. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/dPuSdPXYe1vtESmL9JPDF4VQzV675qyY4FIJHxG3Cs4.cache +0 -0
  54. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/dXy1IkeRkbXjdbL_33caR_fU-1A25nnU-Anu_IhWwHg.cache +0 -0
  55. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/e2YRtLBJ8YrSbmJl8UCtB31PTTl8w6w-moXBbJLS8o0.cache +0 -0
  56. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/i8Az0cVSg5ilKfOyr7n9B3ZWHI8etJAn08-2ST-z03s.cache +0 -0
  57. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ihUFz-KtyQkiGrCDOgyEnx5kuAwFs5zQS7MAq5Tu5D4.cache +0 -0
  58. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/oflwcRDRlItrtOMmp-MiNBdyxULUeI35Zb9OR-4s5ig.cache +2 -0
  59. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/uD8ZYRXYZ957QscomKWi9XODs8OoBge7CIJLPZPSu2M.cache +0 -0
  60. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/upNaW3h5pUPw2lICsLSEI9RZYx8sBa3quA1cCqBpprI.cache +1 -0
  61. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/yiFjyMoN9cT2aeQ7Eq6PxcZu9-pZDIysc3c5GM7oeCs.cache +1 -0
  62. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/zJWLyxLfgkHfFH0kRPuRhpaEySAXVMGFNnqdICyS4Zo.cache +1 -0
  63. data/test/dummy/tmp/pids/server.pid +1 -1
  64. metadata +124 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1057c88ead89073766b04778b7164726e8cfeccd
4
- data.tar.gz: 0cb41b0c2c2db5ab568f2f2ef5c3da20dfc082c7
3
+ metadata.gz: 5967ae3034c56c1ddcb9bc163f4cf822bd8cecc8
4
+ data.tar.gz: a53cca7cd73b664042fb909ffed833a1bd25ffc9
5
5
  SHA512:
6
- metadata.gz: 61dd4f45fde713c17dc1720b5dff86bb7a10611e427e3c6d895a2245bb2868d1e8c6dca09829d15a385b7230738bf44bcdda6351fc0bf9040d2c356e8ef019ac
7
- data.tar.gz: d742f1052f8a6b0c80433c672357814a31e52c98d8f4fd634a561e1ae7986318fc3fa1c523b1a9378ab95ec2a09ddfca95447d0041124772abd5551c8db1379b
6
+ metadata.gz: f0c90c57471ef085b3723edbb059c75ec2f47e805361c98ab545728bd4fd42575c230ed949a3e39b7ae4495e2fc2722d2a0e66b1b2d0cd9cbf5bd144781d0f97
7
+ data.tar.gz: 2c7498f0f03dcb1ccf7d9cd18d8ab030de9aff3ca09f7041ca987202b4cd12fb8cfd43660763fe5d206bbeea98706e68c9f4013795f798742ed3bf890afc753b
data/README.md CHANGED
@@ -25,7 +25,7 @@ These content types can be interpreted by a designer to create a unique look and
25
25
 
26
26
  ## Installation
27
27
 
28
- 1. Add: `gem 'pages_cms', '~> 1.2.3'` to your `Gemfile`
28
+ 1. Add: `gem 'pages_cms', '~> 2.0.1'` to your `Gemfile`
29
29
  2. Run: `$ rails generate pages_cms:install`
30
30
  3. Add: `//= require cocoon` to your `application.js` file
31
31
 
@@ -1 +1,495 @@
1
- .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle;}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px;}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none;}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap;}.select2-container .select2-search--inline{float:left;}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051;}.select2-results{display:block;}.select2-results__options{list-style:none;margin:0;padding:0;}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none;}.select2-results__option[aria-selected]{cursor:pointer;}.select2-container--open .select2-dropdown{left:0;}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-search--dropdown{display:block;padding:4px;}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box;}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}.select2-search--dropdown.select2-search--hide{display:none;}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0);}.select2-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px;}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px;}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto;}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none;}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%;}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left;}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder{float:right;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0;}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default;}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none;}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0;}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa;}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--default .select2-results__option[role=group]{padding:0;}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999;}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd;}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em;}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em;}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white;}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic .select2-selection--single{background-color:#f6f6f6;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:-o-linear-gradient(top, #ffffff 50%, #eeeeee 100%);background-image:linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px;}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px;}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999;}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0);}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left;}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto;}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none;}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:-o-linear-gradient(top, #ffffff 0%, #eeeeee 50%);background-image:linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:-o-linear-gradient(top, #eeeeee 50%, #ffffff 100%);background-image:linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb;}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none;}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px;}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto;}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto;}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb;}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0;}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0;}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;}.select2-container--classic .select2-dropdown{background-color:white;border:1px solid transparent;}.select2-container--classic .select2-dropdown--above{border-bottom:none;}.select2-container--classic .select2-dropdown--below{border-top:none;}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto;}.select2-container--classic .select2-results__option[role=group]{padding:0;}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey;}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:white;}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px;}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb;}
1
+ /*! Select2 Bootstrap 3 CSS v1.4.6 | MIT License | github.com/t0m/select2-bootstrap-css */
2
+ /**
3
+ * Reset Bootstrap 3 .form-control styles which - if applied to the
4
+ * original <select>-element the Select2-plugin may be run against -
5
+ * are copied to the .select2-container.
6
+ *
7
+ * 1. Overwrite .select2-container's original display:inline-block
8
+ * with Bootstrap 3's default for .form-control, display:block;
9
+ * courtesy of @juristr (@see https://github.com/fk/select2-bootstrap-css/pull/1)
10
+ */
11
+ .select2-container.form-control {
12
+ background: transparent;
13
+ box-shadow: none;
14
+ border: none;
15
+ display: block;
16
+ /* 1 */
17
+ margin: 0;
18
+ padding: 0;
19
+ }
20
+
21
+ /**
22
+ * Adjust Select2 inputs to fit Bootstrap 3 default .form-control appearance.
23
+ */
24
+ .select2-container .select2-choices .select2-search-field input,
25
+ .select2-container .select2-choice,
26
+ .select2-container .select2-choices {
27
+ background: none;
28
+ padding: 0;
29
+ border-color: #cccccc;
30
+ border-radius: 4px;
31
+ color: #555555;
32
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
33
+ background-color: white;
34
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
35
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
36
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
37
+ }
38
+
39
+ .select2-search input {
40
+ border-color: #cccccc;
41
+ border-radius: 4px;
42
+ color: #555555;
43
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
44
+ background-color: white;
45
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
46
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
47
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
48
+ }
49
+
50
+ .select2-container .select2-choices .select2-search-field input {
51
+ -webkit-box-shadow: none;
52
+ box-shadow: none;
53
+ }
54
+
55
+ /**
56
+ * Adjust Select2 input heights to match the Bootstrap default.
57
+ */
58
+ .select2-container .select2-choice {
59
+ height: 34px;
60
+ line-height: 1.42857;
61
+ }
62
+
63
+ /**
64
+ * Address Multi Select2's height which - depending on how many elements have been selected -
65
+ * may grown higher than their initial size.
66
+ */
67
+ .select2-container.select2-container-multi.form-control {
68
+ height: auto;
69
+ }
70
+
71
+ /**
72
+ * Address Bootstrap 3 control sizing classes
73
+ * @see http://getbootstrap.com/css/#forms-control-sizes
74
+ */
75
+ .select2-container.input-sm .select2-choice,
76
+ .input-group-sm .select2-container .select2-choice {
77
+ height: 30px;
78
+ line-height: 1.5;
79
+ border-radius: 3px;
80
+ }
81
+
82
+ .select2-container.input-lg .select2-choice,
83
+ .input-group-lg .select2-container .select2-choice {
84
+ height: 46px;
85
+ line-height: 1.33333;
86
+ border-radius: 6px;
87
+ }
88
+
89
+ .select2-container-multi .select2-choices .select2-search-field input {
90
+ height: 32px;
91
+ }
92
+
93
+ .select2-container-multi.input-sm .select2-choices .select2-search-field input,
94
+ .input-group-sm .select2-container-multi .select2-choices .select2-search-field input {
95
+ height: 28px;
96
+ }
97
+
98
+ .select2-container-multi.input-lg .select2-choices .select2-search-field input,
99
+ .input-group-lg .select2-container-multi .select2-choices .select2-search-field input {
100
+ height: 44px;
101
+ }
102
+
103
+ /**
104
+ * Adjust height and line-height for .select2-search-field amd multi-select Select2 widgets.
105
+ *
106
+ * 1. Class repetition to address missing .select2-chosen in Select2 < 3.3.2.
107
+ */
108
+ .select2-container-multi .select2-choices .select2-search-field input {
109
+ margin: 0;
110
+ }
111
+
112
+ .select2-chosen,
113
+ .select2-choice > span:first-child,
114
+ .select2-container .select2-choices .select2-search-field input {
115
+ padding: 6px 12px;
116
+ }
117
+
118
+ .input-sm .select2-chosen,
119
+ .input-group-sm .select2-chosen,
120
+ .input-sm .select2-choice > span:first-child,
121
+ .input-group-sm .select2-choice > span:first-child,
122
+ .input-sm .select2-choices .select2-search-field input,
123
+ .input-group-sm .select2-choices .select2-search-field input {
124
+ padding: 5px 10px;
125
+ }
126
+
127
+ .input-lg .select2-chosen,
128
+ .input-group-lg .select2-chosen,
129
+ .input-lg .select2-choice > span:first-child,
130
+ .input-group-lg .select2-choice > span:first-child,
131
+ .input-lg .select2-choices .select2-search-field input,
132
+ .input-group-lg .select2-choices .select2-search-field input {
133
+ padding: 10px 16px;
134
+ }
135
+
136
+ .select2-container-multi .select2-choices .select2-search-choice {
137
+ margin-top: 5px;
138
+ margin-bottom: 3px;
139
+ }
140
+
141
+ .select2-container-multi.input-sm .select2-choices .select2-search-choice,
142
+ .input-group-sm .select2-container-multi .select2-choices .select2-search-choice {
143
+ margin-top: 3px;
144
+ margin-bottom: 2px;
145
+ }
146
+
147
+ .select2-container-multi.input-lg .select2-choices .select2-search-choice,
148
+ .input-group-lg .select2-container-multi .select2-choices .select2-search-choice {
149
+ line-height: 24px;
150
+ }
151
+
152
+ /**
153
+ * Adjust the single Select2's dropdown arrow button appearance.
154
+ *
155
+ * 1. For Select2 v.3.3.2.
156
+ */
157
+ .select2-container .select2-choice .select2-arrow,
158
+ .select2-container .select2-choice div {
159
+ border-left: none;
160
+ background: none;
161
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
162
+ }
163
+
164
+ .select2-dropdown-open .select2-choice .select2-arrow,
165
+ .select2-dropdown-open .select2-choice div {
166
+ border-left-color: transparent;
167
+ background: none;
168
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
169
+ }
170
+
171
+ /**
172
+ * Adjust the dropdown arrow button icon position for the single-select Select2 elements
173
+ * to make it line up vertically now that we increased the height of .select2-container.
174
+ *
175
+ * 1. Class repetition to address missing .select2-chosen in Select2 v.3.3.2.
176
+ */
177
+ .select2-container .select2-choice .select2-arrow b,
178
+ .select2-container .select2-choice div b {
179
+ background-position: 0 3px;
180
+ }
181
+
182
+ .select2-dropdown-open .select2-choice .select2-arrow b,
183
+ .select2-dropdown-open .select2-choice div b {
184
+ background-position: -18px 3px;
185
+ }
186
+
187
+ .select2-container.input-sm .select2-choice .select2-arrow b,
188
+ .input-group-sm .select2-container .select2-choice .select2-arrow b,
189
+ .select2-container.input-sm .select2-choice div b,
190
+ .input-group-sm .select2-container .select2-choice div b {
191
+ background-position: 0 1px;
192
+ }
193
+
194
+ .select2-dropdown-open.input-sm .select2-choice .select2-arrow b,
195
+ .input-group-sm .select2-dropdown-open .select2-choice .select2-arrow b,
196
+ .select2-dropdown-open.input-sm .select2-choice div b,
197
+ .input-group-sm .select2-dropdown-open .select2-choice div b {
198
+ background-position: -18px 1px;
199
+ }
200
+
201
+ .select2-container.input-lg .select2-choice .select2-arrow b,
202
+ .input-group-lg .select2-container .select2-choice .select2-arrow b,
203
+ .select2-container.input-lg .select2-choice div b,
204
+ .input-group-lg .select2-container .select2-choice div b {
205
+ background-position: 0 9px;
206
+ }
207
+
208
+ .select2-dropdown-open.input-lg .select2-choice .select2-arrow b,
209
+ .input-group-lg .select2-dropdown-open .select2-choice .select2-arrow b,
210
+ .select2-dropdown-open.input-lg .select2-choice div b,
211
+ .input-group-lg .select2-dropdown-open .select2-choice div b {
212
+ background-position: -18px 9px;
213
+ }
214
+
215
+ /**
216
+ * Address Bootstrap's validation states and change Select2's border colors and focus states.
217
+ * Apply .has-warning, .has-danger or .has-succes to #select2-drop to match Bootstraps' colors.
218
+ */
219
+ .has-warning .select2-choice,
220
+ .has-warning .select2-choices {
221
+ border-color: #8a6d3b;
222
+ }
223
+ .has-warning .select2-container-active .select2-choice,
224
+ .has-warning .select2-container-multi.select2-container-active .select2-choices {
225
+ border-color: #66512c;
226
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b;
227
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b;
228
+ }
229
+ .has-warning.select2-drop-active {
230
+ border-color: #66512c;
231
+ }
232
+ .has-warning.select2-drop-active.select2-drop.select2-drop-above {
233
+ border-top-color: #66512c;
234
+ }
235
+
236
+ .has-error .select2-choice,
237
+ .has-error .select2-choices {
238
+ border-color: #a94442;
239
+ }
240
+ .has-error .select2-container-active .select2-choice,
241
+ .has-error .select2-container-multi.select2-container-active .select2-choices {
242
+ border-color: #843534;
243
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
244
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
245
+ }
246
+ .has-error.select2-drop-active {
247
+ border-color: #843534;
248
+ }
249
+ .has-error.select2-drop-active.select2-drop.select2-drop-above {
250
+ border-top-color: #843534;
251
+ }
252
+
253
+ .has-success .select2-choice,
254
+ .has-success .select2-choices {
255
+ border-color: #3c763d;
256
+ }
257
+ .has-success .select2-container-active .select2-choice,
258
+ .has-success .select2-container-multi.select2-container-active .select2-choices {
259
+ border-color: #2b542c;
260
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
261
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
262
+ }
263
+ .has-success.select2-drop-active {
264
+ border-color: #2b542c;
265
+ }
266
+ .has-success.select2-drop-active.select2-drop.select2-drop-above {
267
+ border-top-color: #2b542c;
268
+ }
269
+
270
+ /**
271
+ * Make Select2's active-styles - applied to .select2-container when the widget receives focus -
272
+ * fit Bootstrap 3's .form-element:focus appearance.
273
+ */
274
+ .select2-container-active .select2-choice,
275
+ .select2-container-multi.select2-container-active .select2-choices {
276
+ border-color: #66afe9;
277
+ outline: none;
278
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
279
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
280
+ -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
281
+ -o-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
282
+ transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
283
+ }
284
+
285
+ .select2-drop-active {
286
+ border-color: #66afe9;
287
+ }
288
+
289
+ .select2-drop-auto-width,
290
+ .select2-drop.select2-drop-above.select2-drop-active {
291
+ border-top-color: #66afe9;
292
+ }
293
+
294
+ /**
295
+ * Select2 widgets in Bootstrap Input Groups
296
+ *
297
+ * When Select2 widgets are combined with other elements using Bootstrap 3's
298
+ * "Input Group" component, we don't want specific edges of the Select2 container
299
+ * to have a border-radius.
300
+ *
301
+ * In Bootstrap 2, input groups required a markup where these style adjustments
302
+ * could be bound to a CSS-class identifying if the additional elements are appended,
303
+ * prepended or both.
304
+ *
305
+ * Bootstrap 3 doesn't rely on these classes anymore, so we have to use our own.
306
+ * Use .select2-bootstrap-prepend and .select2-bootstrap-append on a Bootstrap 3 .input-group
307
+ * to let the contained Select2 widget know which edges should not be rounded as they are
308
+ * directly followed by another element.
309
+ *
310
+ * @see http://getbootstrap.com/components/#input-groups
311
+ */
312
+ .input-group.select2-bootstrap-prepend [class^="select2-choice"] {
313
+ border-bottom-left-radius: 0 !important;
314
+ border-top-left-radius: 0 !important;
315
+ }
316
+
317
+ .input-group.select2-bootstrap-append [class^="select2-choice"] {
318
+ border-bottom-right-radius: 0 !important;
319
+ border-top-right-radius: 0 !important;
320
+ }
321
+
322
+ .select2-dropdown-open [class^="select2-choice"] {
323
+ border-bottom-right-radius: 0 !important;
324
+ border-bottom-left-radius: 0 !important;
325
+ }
326
+
327
+ .select2-dropdown-open.select2-drop-above [class^="select2-choice"] {
328
+ border-top-right-radius: 0 !important;
329
+ border-top-left-radius: 0 !important;
330
+ border-bottom-right-radius: 4px !important;
331
+ border-bottom-left-radius: 4px !important;
332
+ background: white;
333
+ filter: none;
334
+ }
335
+ .input-group.select2-bootstrap-prepend .select2-dropdown-open.select2-drop-above [class^="select2-choice"] {
336
+ border-bottom-left-radius: 0 !important;
337
+ border-top-left-radius: 0 !important;
338
+ }
339
+ .input-group.select2-bootstrap-append .select2-dropdown-open.select2-drop-above [class^="select2-choice"] {
340
+ border-bottom-right-radius: 0 !important;
341
+ border-top-right-radius: 0 !important;
342
+ }
343
+ .input-group.input-group-sm.select2-bootstrap-prepend .select2-dropdown-open.select2-drop-above [class^="select2-choice"] {
344
+ border-bottom-right-radius: 3px !important;
345
+ }
346
+ .input-group.input-group-lg.select2-bootstrap-prepend .select2-dropdown-open.select2-drop-above [class^="select2-choice"] {
347
+ border-bottom-right-radius: 6px !important;
348
+ }
349
+ .input-group.input-group-sm.select2-bootstrap-append .select2-dropdown-open.select2-drop-above [class^="select2-choice"] {
350
+ border-bottom-left-radius: 3px !important;
351
+ }
352
+ .input-group.input-group-lg.select2-bootstrap-append .select2-dropdown-open.select2-drop-above [class^="select2-choice"] {
353
+ border-bottom-left-radius: 6px !important;
354
+ }
355
+
356
+ /**
357
+ * Adjust Select2's choices hover and selected styles to match Bootstrap 3's default dropdown styles.
358
+ */
359
+ .select2-results .select2-highlighted {
360
+ color: white;
361
+ background-color: #337ab7;
362
+ }
363
+
364
+ /**
365
+ * Adjust alignment of Bootstrap 3 buttons in Bootstrap 3 Input Groups to address
366
+ * Multi Select2's height which - depending on how many elements have been selected -
367
+ * may grown higher than their initial size.
368
+ */
369
+ .select2-bootstrap-append .select2-container-multiple,
370
+ .select2-bootstrap-append .input-group-btn,
371
+ .select2-bootstrap-append .input-group-btn .btn,
372
+ .select2-bootstrap-prepend .select2-container-multiple,
373
+ .select2-bootstrap-prepend .input-group-btn,
374
+ .select2-bootstrap-prepend .input-group-btn .btn {
375
+ vertical-align: top;
376
+ }
377
+
378
+ /**
379
+ * Make Multi Select2's choices match Bootstrap 3's default button styles.
380
+ */
381
+ .select2-container-multi .select2-choices .select2-search-choice {
382
+ color: #555555;
383
+ background: white;
384
+ border-color: #cccccc;
385
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
386
+ -webkit-box-shadow: none;
387
+ box-shadow: none;
388
+ }
389
+
390
+ .select2-container-multi .select2-choices .select2-search-choice-focus {
391
+ background: #ebebeb;
392
+ border-color: #adadad;
393
+ color: #333333;
394
+ -webkit-box-shadow: none;
395
+ box-shadow: none;
396
+ }
397
+
398
+ /**
399
+ * Address Multi Select2's choice close-button vertical alignment.
400
+ */
401
+ .select2-search-choice-close {
402
+ margin-top: -7px;
403
+ top: 50%;
404
+ }
405
+
406
+ /**
407
+ * Adjust the single Select2's clear button position (used to reset the select box
408
+ * back to the placeholder value and visible once a selection is made
409
+ * activated by Select2's "allowClear" option).
410
+ */
411
+ .select2-container .select2-choice abbr {
412
+ top: 50%;
413
+ }
414
+
415
+ /**
416
+ * Adjust "no results" and "selection limit" messages to make use
417
+ * of Bootstrap 3's default "Alert" style.
418
+ *
419
+ * @see http://getbootstrap.com/components/#alerts-default
420
+ */
421
+ .select2-results .select2-no-results,
422
+ .select2-results .select2-searching,
423
+ .select2-results .select2-selection-limit {
424
+ background-color: #fcf8e3;
425
+ color: #8a6d3b;
426
+ }
427
+
428
+ /**
429
+ * Address disabled Select2 styles.
430
+ *
431
+ * 1. For Select2 v.3.3.2.
432
+ * 2. Revert border-left:0 inherited from Select2's CSS to prevent the arrow
433
+ * from jumping when switching from disabled to enabled state and vice versa.
434
+ */
435
+ .select2-container.select2-container-disabled .select2-choice,
436
+ .select2-container.select2-container-disabled .select2-choices {
437
+ cursor: not-allowed;
438
+ background-color: #eeeeee;
439
+ border-color: #cccccc;
440
+ }
441
+ .select2-container.select2-container-disabled .select2-choice .select2-arrow,
442
+ .select2-container.select2-container-disabled .select2-choice div,
443
+ .select2-container.select2-container-disabled .select2-choices .select2-arrow,
444
+ .select2-container.select2-container-disabled .select2-choices div {
445
+ background-color: transparent;
446
+ border-left: 1px solid transparent;
447
+ /* 2 */
448
+ }
449
+
450
+ /**
451
+ * Address Select2's loading indicator position - which should not stick
452
+ * to the right edge of Select2's search input.
453
+ *
454
+ * 1. in .select2-search input
455
+ * 2. in Multi Select2's .select2-search-field input
456
+ * 3. in the status-message of infinite-scroll with remote data (@see http://ivaynberg.github.io/select2/#infinite)
457
+ *
458
+ * These styles alter Select2's default background-position of 100%
459
+ * and supply the new background-position syntax to browsers which support it:
460
+ *
461
+ * 1. Android, Safari < 6/Mobile, IE<9: change to a relative background-position of 99%
462
+ * 2. Chrome 25+, Firefox 13+, IE 9+, Opera 10.5+: use the new CSS3-background-position syntax
463
+ *
464
+ * @see http://www.w3.org/TR/css3-background/#background-position
465
+ *
466
+ * @todo Since both Select2 and Bootstrap 3 only support IE8 and above,
467
+ * we could use the :after-pseudo-element to display the loading indicator.
468
+ * Alternatively, we could supply an altered loading indicator image which already
469
+ * contains an offset to the right.
470
+ */
471
+ .select2-search input.select2-active,
472
+ .select2-container-multi .select2-choices .select2-search-field input.select2-active,
473
+ .select2-more-results.select2-active {
474
+ background-position: 99%;
475
+ /* 4 */
476
+ background-position: right 4px center;
477
+ /* 5 */
478
+ }
479
+
480
+ /**
481
+ * To support Select2 pre v3.4.2 in combination with Bootstrap v3.2.0,
482
+ * ensure that .select2-offscreen width, height and position can not be overwritten.
483
+ *
484
+ * This adresses changes in Bootstrap somewhere after the initial v3.0.0 which -
485
+ * in combination with Select2's pre-v3.4.2 CSS missing the "!important" after
486
+ * the following rules - allow Bootstrap to overwrite the latter, which results in
487
+ * the original <select> element Select2 is replacing not be properly being hidden
488
+ * when used in a "Bootstrap Input Group with Addon".
489
+ **/
490
+ .select2-offscreen,
491
+ .select2-offscreen:focus {
492
+ width: 1px !important;
493
+ height: 1px !important;
494
+ position: absolute !important;
495
+ }
@@ -11,50 +11,19 @@ module PagesCms
11
11
  end
12
12
 
13
13
  def create
14
- if params[:image][:is_url]
15
- image = current_account.images.build(image_params)
16
- if image.save
17
- flash[:success] = 'Successfully uploaded file.'
18
- redirect_to admin_images_path
19
- else
20
- flash[:danger] = 'Failed to create file'
21
- redirect_to admin_images_path
22
- end
14
+ @image = current_account.images.build(image_params)
15
+ if @image.save
16
+ flash[:success] = 'Successfully uploaded file.'
17
+ redirect_to admin_images_path
23
18
  else
24
- validate_image = Image.new(image_params)
25
- if validate_image.validate_file_type(params[:image][:file])
26
- user_named = params[:image][:name]
27
- uploaded_io = params[:image][:file]
28
- extension = uploaded_io.original_filename.split('.')[1]
29
- name = "#{Time.now.to_i}_#{user_named}.#{extension}"
30
- @image = current_account.images.build(file: "/images/#{name}", name: user_named)
31
- if @image.save
32
- File.open(Rails.root.join('public', 'images', name), 'wb') do |file|
33
- file.write(uploaded_io.read)
34
- end
35
- if File.exists?(Rails.root.join('public', 'images', name))
36
- flash[:success] = 'Successfully uploaded file.'
37
- redirect_to admin_images_path
38
- else
39
- @image.destroy
40
- flash[:danger] = 'Failed to create file'
41
- redirect_to admin_images_path
42
- end
43
- else
44
- flash[:danger] = "Error: #{@image.errors.full_messages.to_sentence}"
45
- redirect_to admin_images_path
46
- end
47
- else
48
- flash[:danger] = "Error #{validate_image.errors.full_messages.to_sentence}"
49
- redirect_to admin_images_path
50
- end
19
+ flash[:danger] = 'Failed to create file'
20
+ redirect_to admin_images_path
51
21
  end
52
22
  end
53
23
 
54
24
  def destroy
55
25
  image = Image.find(params[:id])
56
26
  image.destroy
57
- FileUtils.rm(Rails.root.join('public', 'images', image.file))
58
27
  flash[:success] = 'Image deleted'
59
28
  redirect_to admin_images_path
60
29
  end
@@ -1,24 +1,6 @@
1
1
  module PagesCms
2
2
  class Image < ActiveRecord::Base
3
- belongs_to :account
4
- has_many :thumbnails, dependent: :destroy
5
-
6
- validates :file, presence: true
7
- validates_format_of :file, with: /png|jpg|jpeg/, message: 'is not an image.'
8
- validate :file_no_spaces
9
-
10
- def validate_file_type(file)
11
- Image.validators_on(:file).each do |validator|
12
- validator.validate_each(self, :file, file)
13
- end
14
- end
15
-
16
- private
17
- def file_no_spaces
18
- if file.split(' ').count > 1
19
- errors.add(:file, "has an improper name, file:#{file.split(' ').count}")
20
- end
21
- end
22
-
3
+ belongs_to :account
4
+ mount_uploader :file, ImageUploader
23
5
  end
24
6
  end
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+ module PagesCms
3
+ class ImageUploader < CarrierWave::Uploader::Base
4
+
5
+ # Include RMagick or MiniMagick support:
6
+ # include CarrierWave::RMagick
7
+ # include CarrierWave::MiniMagick
8
+
9
+ # choose the storage system
10
+ if Rails.env.production?
11
+ storage :fog
12
+ else
13
+ storage :file
14
+ end
15
+
16
+ # Override the directory where uploaded files will be stored.
17
+ def store_dir
18
+ "images/"
19
+ end
20
+
21
+ # Provide a default URL as a default if there hasn't been a file uploaded:
22
+ # def default_url
23
+ # # For Rails 3.1+ asset pipeline compatibility:
24
+ # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
25
+ #
26
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
27
+ # end
28
+
29
+ # Process files as they are uploaded:
30
+ # process :scale => [200, 300]
31
+ #
32
+ # def scale(width, height)
33
+ # # do something
34
+ # end
35
+
36
+ # Create different versions of your uploaded files:
37
+ # version :thumb do
38
+ # process :resize_to_fit => [50, 50]
39
+ # end
40
+
41
+ # Add a white list of extensions which are allowed to be uploaded.
42
+ # For images you might use something like this:
43
+ def extension_white_list
44
+ %w(jpg jpeg gif png)
45
+ end
46
+
47
+ # Override the filename of the uploaded files:
48
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
49
+ def filename
50
+ "#{Time.now.to_i}#{original_filename}" if original_filename
51
+ end
52
+
53
+ end
54
+ end