rich 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +57 -25
- data/app/assets/javascripts/rich/{base.js → base.js.erb} +0 -0
- data/app/assets/javascripts/rich/browser/filebrowser.js +6 -3
- data/app/assets/javascripts/rich/editor/ckeditor_path.js.erb +1 -0
- data/app/assets/javascripts/rich/editor/rich_picker.js +11 -3
- data/app/assets/stylesheets/rich/{rich_editor.css → editor.css} +0 -0
- data/app/inputs/rich_picker_input.rb +73 -13
- data/app/views/rails_admin/main/_form_rich_picker.html.haml +4 -6
- data/lib/generators/rich/install/install_generator.rb +1 -1
- data/lib/generators/rich/install/templates/rich.rb.erb +1 -0
- data/lib/rich.rb +24 -18
- data/lib/rich/engine.rb +1 -1
- data/lib/rich/rails_admin/config/fields/types/rich_picker.rb +22 -1
- data/lib/rich/version.rb +1 -1
- data/test/dummy/app/views/posts/_formtastic_form.html.erb +10 -4
- data/test/dummy/config/initializers/rich.rb +1 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20111001122048_create_posts.rb +1 -0
- data/test/dummy/db/migrate/20111014123344_devise_create_admin_users.rb +7 -7
- data/test/dummy/db/schema.rb +10 -21
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +3990 -0
- data/test/dummy/public/system/rich_files/1/large/paspoort.jpg +0 -0
- data/test/dummy/public/system/rich_files/1/original/paspoort.jpg +0 -0
- data/test/dummy/public/system/rich_files/1/rich_thumb/paspoort.jpg +0 -0
- data/test/dummy/public/system/rich_files/1/thumb/paspoort.jpg +0 -0
- data/test/dummy/public/system/rich_files/2/large/1929972.jpeg +0 -0
- data/test/dummy/public/system/rich_files/2/original/1929972.jpeg +0 -0
- data/test/dummy/public/system/rich_files/2/rich_thumb/1929972.jpeg +0 -0
- data/test/dummy/public/system/rich_files/2/thumb/1929972.jpeg +0 -0
- data/test/dummy/public/system/rich_files/3/original/paspoort.jpg +0 -0
- data/test/dummy/public/system/rich_files/4/original/d3-v2-min.js +4 -0
- data/test/dummy/tmp/cache/assets/BF4/950/sprockets%2F279775537473209052518901fda5e5a1 +0 -0
- data/test/dummy/tmp/cache/assets/C29/300/sprockets%2F3729f3d7fce29242810892915661a262 +0 -0
- data/test/dummy/tmp/cache/assets/C2F/090/sprockets%2Fc61816290571577f2f4a2c476847d807 +0 -0
- data/test/dummy/tmp/cache/assets/C31/900/sprockets%2Fc586d3032a8673516910f47977f9f070 +0 -0
- data/test/dummy/tmp/cache/assets/C84/A30/sprockets%2F3e052243992e2b2f4923c6744e9175cc +0 -0
- data/test/dummy/tmp/cache/assets/C89/8E0/sprockets%2F2081e160d573e2ed9157993275c8ca65 +0 -0
- data/test/dummy/tmp/cache/assets/C9B/0E0/sprockets%2Fd413f24d52536a30411fdf08b8012e64 +0 -0
- data/test/dummy/tmp/cache/assets/CB0/7F0/sprockets%2F030ddebb53f465bd92468484664b5423 +0 -0
- data/test/dummy/tmp/cache/assets/CBE/A80/sprockets%2F60bb9087aed9745744925f6ce01525d9 +0 -0
- data/test/dummy/tmp/cache/assets/CC5/B40/sprockets%2F86e8761dec921377f8464dcf53537a60 +0 -0
- data/test/dummy/tmp/cache/assets/CC8/C00/sprockets%2F9f734a5508b65f099f7937015cc89cf1 +0 -0
- data/test/dummy/tmp/cache/assets/CCE/1C0/sprockets%2F3a5bcb00510e1b91a7d66520366fb785 +0 -0
- data/test/dummy/tmp/cache/assets/CCF/6C0/sprockets%2F34887a70ed879847179a444c7a56cfc9 +0 -0
- data/test/dummy/tmp/cache/assets/CD6/760/sprockets%2Fab21e1c075fd534458ec9080a54e4633 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/890/sprockets%2F90f2441e542d36833d34b3fda6c1807c +0 -0
- data/test/dummy/tmp/cache/assets/CDB/D60/sprockets%2F4273349cf5ab3029bd61e3284f9a05f2 +0 -0
- data/test/dummy/tmp/cache/assets/CDF/0D0/sprockets%2Ff754896efa407b27407ad234541ae1e5 +0 -0
- data/test/dummy/tmp/cache/assets/CE1/BA0/sprockets%2Fb5073884f7c7735f13a952d5ed1b3a33 +0 -0
- data/test/dummy/tmp/cache/assets/CE7/D50/sprockets%2F57481e9a368f6ae733d04053d05f9ae5 +0 -0
- data/test/dummy/tmp/cache/assets/CEC/F70/sprockets%2Fefe73006fd5745345e6803f58a437e4d +0 -0
- data/test/dummy/tmp/cache/assets/CF2/EA0/sprockets%2F0f75c59b187071b1f866cc77cc65b795 +0 -0
- data/test/dummy/tmp/cache/assets/CFC/000/sprockets%2Ff21ac4179fc480c359b31450b03db3d4 +0 -0
- data/test/dummy/tmp/cache/assets/D01/DF0/sprockets%2F2d3f41532a462ca17f3ce53e392e03d6 +0 -0
- data/test/dummy/tmp/cache/assets/D02/FC0/sprockets%2Fd85d016666059b01532f0f02d7af7bca +0 -0
- data/test/dummy/tmp/cache/assets/D08/AE0/sprockets%2F1255a035cdf231616f8b38db46fda385 +0 -0
- data/test/dummy/tmp/cache/assets/D0D/E20/sprockets%2F1bd13848679c440870b4e4b7c653ccab +0 -0
- data/test/dummy/tmp/cache/assets/D0E/260/sprockets%2F2aa865ba708b500cbf867d5365c88e21 +0 -0
- data/test/dummy/tmp/cache/assets/D10/5B0/sprockets%2F71a5b85023d2c258980f73d3ebc356ee +0 -0
- data/test/dummy/tmp/cache/assets/D16/C80/sprockets%2Ff7542a59245ae529e0377e4aa5d54df5 +0 -0
- data/test/dummy/tmp/cache/assets/D24/B30/sprockets%2F315f97ad7a5a978d6b6e1ffb53970637 +0 -0
- data/test/dummy/tmp/cache/assets/D27/8A0/sprockets%2Fb9e667ccf42b578538e680b5d7790ce3 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D36/050/sprockets%2Fe1c34750a8f112dff2eb056d13e5825f +0 -0
- data/test/dummy/tmp/cache/assets/D39/6E0/sprockets%2F8c058f3c6b43ca121e86ac6044af48c7 +0 -0
- data/test/dummy/tmp/cache/assets/D44/980/sprockets%2F261b3df39ab7b58818b36d8d6a0f656a +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D56/A00/sprockets%2F9e930eed9e78fa64a8873e9b3d2d2055 +0 -0
- data/test/dummy/tmp/cache/assets/D58/9C0/sprockets%2F40ff3a83660eaba43aff203d3ca43364 +0 -0
- data/test/dummy/tmp/cache/assets/D59/D70/sprockets%2Fed9f0de1b65ae8d7ef89087c83728461 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D6B/130/sprockets%2F4bb79ff7b89877876d8d1e5d9a5138ff +0 -0
- data/test/dummy/tmp/cache/assets/D74/420/sprockets%2F6dcbdaabb925c57d84451076bd846e48 +0 -0
- data/test/dummy/tmp/cache/assets/D74/DB0/sprockets%2Fd149e93e9dcaa4153ece7c289b54b442 +0 -0
- data/test/dummy/tmp/cache/assets/D78/5E0/sprockets%2Fd8e4db6d4b7de69d0d28f4a627124f81 +0 -0
- data/test/dummy/tmp/cache/assets/D7A/390/sprockets%2F54bb70197fd826cd344acdd6891ec6f5 +0 -0
- data/test/dummy/tmp/cache/assets/D8F/A80/sprockets%2Fd10cfce4d91187c2c0d1a3b181da7f93 +0 -0
- data/test/dummy/tmp/cache/assets/D93/4C0/sprockets%2F857ecd2092cee11f740b3cf2e373ad2a +0 -0
- data/test/dummy/tmp/cache/assets/D98/0B0/sprockets%2Fbf5fd5300d361da05fa7eeb9737d16b4 +0 -0
- data/test/dummy/tmp/cache/assets/D9E/2A0/sprockets%2F59eadf021b1fa89ef2087fe4e1537cc0 +0 -0
- data/test/dummy/tmp/cache/assets/DA5/B80/sprockets%2Fb4a57c05989fb47caffafad57c549022 +0 -0
- data/test/dummy/tmp/cache/assets/DAA/BC0/sprockets%2Fa7f5da0437b83b8e8fe5ab9f28048bf4 +0 -0
- data/test/dummy/tmp/cache/assets/DAC/520/sprockets%2Fb6badb6fbadf13b52b1333fd722210a4 +0 -0
- data/test/dummy/tmp/cache/assets/DAE/620/sprockets%2F9be804f3b5257d6758bf4fba22def5f7 +0 -0
- data/test/dummy/tmp/cache/assets/DC7/8F0/sprockets%2F3a0c984ffdc1bc40de43cd32b37d0e89 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DDE/420/sprockets%2Ffb8b186d5bf0307f86f65fc787d2adeb +0 -0
- data/test/dummy/tmp/cache/assets/DE5/1A0/sprockets%2F4cef6cd4ff6fb6e565513ff9f478af12 +0 -0
- data/test/dummy/tmp/cache/assets/DF5/A60/sprockets%2Fd42474f12cb2b09f5db2dc0ae7f96fab +0 -0
- data/test/dummy/tmp/cache/assets/DF9/760/sprockets%2Fb530b9d0f6dbaa38bc862b9c71bc88bc +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E2F/780/sprockets%2Fd05c4de61ff731bc3ebc9ed0d7e92cb8 +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_all.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_buttons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_gradients.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_icons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_reset.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_rounded.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_sections.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_shadows.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_typography.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/066cc9c58d540580d17434d076e43e4cf9a2e0c3/_variables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/1874a11a5f837c78a1fd54169ce30f7c58d299c0/_button.scssc +0 -0
- data/test/dummy/tmp/cache/sass/1874a11a5f837c78a1fd54169ce30f7c58d299c0/_clearfix.scssc +0 -0
- data/test/dummy/tmp/cache/sass/1874a11a5f837c78a1fd54169ce30f7c58d299c0/_font-face.scssc +0 -0
- data/test/dummy/tmp/cache/sass/1874a11a5f837c78a1fd54169ce30f7c58d299c0/_font-family.scssc +0 -0
- data/test/dummy/tmp/cache/sass/1874a11a5f837c78a1fd54169ce30f7c58d299c0/_hide-text.scssc +0 -0
- data/test/dummy/tmp/cache/sass/1874a11a5f837c78a1fd54169ce30f7c58d299c0/_html5-input-types.scssc +0 -0
- data/test/dummy/tmp/cache/sass/1874a11a5f837c78a1fd54169ce30f7c58d299c0/_position.scssc +0 -0
- data/test/dummy/tmp/cache/sass/1874a11a5f837c78a1fd54169ce30f7c58d299c0/_timing-functions.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_batch_actions.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_blank_slates.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_breadcrumbs.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_buttons.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_columns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_comments.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_date_picker.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_dropdown_menu.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_flash_messages.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_links.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_pagination.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_panels.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_popovers.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_scopes.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_status_tags.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_table_tools.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/226c14edf5187b4371b9716abffe0f2936c67d13/_tables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/355804974a778824d46a13b58d8de14dce78c77c/_dashboard.scssc +0 -0
- data/test/dummy/tmp/cache/sass/355804974a778824d46a13b58d8de14dce78c77c/_logged_out.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_animation.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_appearance.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_background-image.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_background-size.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_background.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_border-image.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_border-radius.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_box-shadow.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_box-sizing.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_columns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_flex-box.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_inline-block.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_linear-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_prefixer.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_radial-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_transform.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_transition.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3ef594d3054ab5924037077f46cd34744387bdda/_user-select.scssc +0 -0
- data/test/dummy/tmp/cache/sass/50638ed8e7e96fafc58a8fddeb8812b007f36fba/_dashboard.scssc +0 -0
- data/test/dummy/tmp/cache/sass/50638ed8e7e96fafc58a8fddeb8812b007f36fba/_logged_out.scssc +0 -0
- data/test/dummy/tmp/cache/sass/5f1cc16f20967db372aad51aad304a55875e3e7a/reset.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/607c6472103bfee11ee6ba9dc2ec0f9b27207a19/_button.scssc +0 -0
- data/test/dummy/tmp/cache/sass/607c6472103bfee11ee6ba9dc2ec0f9b27207a19/_clearfix.scssc +0 -0
- data/test/dummy/tmp/cache/sass/607c6472103bfee11ee6ba9dc2ec0f9b27207a19/_font-face.scssc +0 -0
- data/test/dummy/tmp/cache/sass/607c6472103bfee11ee6ba9dc2ec0f9b27207a19/_font-family.scssc +0 -0
- data/test/dummy/tmp/cache/sass/607c6472103bfee11ee6ba9dc2ec0f9b27207a19/_hide-text.scssc +0 -0
- data/test/dummy/tmp/cache/sass/607c6472103bfee11ee6ba9dc2ec0f9b27207a19/_html5-input-types.scssc +0 -0
- data/test/dummy/tmp/cache/sass/607c6472103bfee11ee6ba9dc2ec0f9b27207a19/_position.scssc +0 -0
- data/test/dummy/tmp/cache/sass/607c6472103bfee11ee6ba9dc2ec0f9b27207a19/_timing-functions.scssc +0 -0
- data/test/dummy/tmp/cache/sass/735114de67eda3be5eaa34cd96c8cf4cffc5af9e/application.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/774ef60b9ed95f625c88a3b45ac34afb4847d5be/_footer.scssc +0 -0
- data/test/dummy/tmp/cache/sass/774ef60b9ed95f625c88a3b45ac34afb4847d5be/_main_structure.scssc +0 -0
- data/test/dummy/tmp/cache/sass/774ef60b9ed95f625c88a3b45ac34afb4847d5be/_title_bar.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_all.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_buttons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_gradients.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_icons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_reset.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_rounded.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_sections.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_shadows.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_typography.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/7b1a349e0c344125e58272a89773b3a827b806b0/_variables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9b2f428a42b29326a69d34f55aee7199d1940d78/_base.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9b2f428a42b29326a69d34f55aee7199d1940d78/_forms.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9b2f428a42b29326a69d34f55aee7199d1940d78/_header.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9b2f428a42b29326a69d34f55aee7199d1940d78/_mixins.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9b2f428a42b29326a69d34f55aee7199d1940d78/_typography.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_batch_actions.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_blank_slates.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_breadcrumbs.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_buttons.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_columns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_comments.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_date_picker.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_dropdown_menu.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_flash_messages.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_links.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_pagination.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_panels.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_popovers.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_scopes.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_status_tags.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_table_tools.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9e75803f6185b39ff2433fbb967d9c9068b23681/_tables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/a4d83294a701fc3f143bafe459845d4d4f3c18f9/_bourbon.scssc +0 -0
- data/test/dummy/tmp/cache/sass/a59b2f1bcbb1937e11c06b2ac7631c2028d51c9e/_footer.scssc +0 -0
- data/test/dummy/tmp/cache/sass/a59b2f1bcbb1937e11c06b2ac7631c2028d51c9e/_main_structure.scssc +0 -0
- data/test/dummy/tmp/cache/sass/a59b2f1bcbb1937e11c06b2ac7631c2028d51c9e/_title_bar.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ad6cfe7d85d6657cc013f0b35b2ecec7392330dc/_deprecated-webkit-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ad6cfe7d85d6657cc013f0b35b2ecec7392330dc/_flex-grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ad6cfe7d85d6657cc013f0b35b2ecec7392330dc/_grid-width.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ad6cfe7d85d6657cc013f0b35b2ecec7392330dc/_linear-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ad6cfe7d85d6657cc013f0b35b2ecec7392330dc/_modular-scale.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ad6cfe7d85d6657cc013f0b35b2ecec7392330dc/_radial-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ad6cfe7d85d6657cc013f0b35b2ecec7392330dc/_render-gradients.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ad6cfe7d85d6657cc013f0b35b2ecec7392330dc/_tint-shade.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ad6cfe7d85d6657cc013f0b35b2ecec7392330dc/_transition-property-name.scssc +0 -0
- data/test/dummy/tmp/cache/sass/d667a49c365c07e051a935fb3451d6efbd5fd1b8/_bourbon.scssc +0 -0
- data/test/dummy/tmp/cache/sass/e54c568f927604a54fb310a2834727ae5400d1c6/_deprecated-webkit-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/e54c568f927604a54fb310a2834727ae5400d1c6/_flex-grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/e54c568f927604a54fb310a2834727ae5400d1c6/_grid-width.scssc +0 -0
- data/test/dummy/tmp/cache/sass/e54c568f927604a54fb310a2834727ae5400d1c6/_linear-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/e54c568f927604a54fb310a2834727ae5400d1c6/_modular-scale.scssc +0 -0
- data/test/dummy/tmp/cache/sass/e54c568f927604a54fb310a2834727ae5400d1c6/_radial-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/e54c568f927604a54fb310a2834727ae5400d1c6/_render-gradients.scssc +0 -0
- data/test/dummy/tmp/cache/sass/e54c568f927604a54fb310a2834727ae5400d1c6/_tint-shade.scssc +0 -0
- data/test/dummy/tmp/cache/sass/e54c568f927604a54fb310a2834727ae5400d1c6/_transition-property-name.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ebe7fc6b174f17eda39b1e27facf42a7b425860e/_base.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ebe7fc6b174f17eda39b1e27facf42a7b425860e/_forms.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ebe7fc6b174f17eda39b1e27facf42a7b425860e/_header.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ebe7fc6b174f17eda39b1e27facf42a7b425860e/_mixins.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ebe7fc6b174f17eda39b1e27facf42a7b425860e/_typography.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ebe7fc6b174f17eda39b1e27facf42a7b425860e/print.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_animation.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_appearance.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_background-image.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_background-size.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_background.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_border-image.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_border-radius.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_box-shadow.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_box-sizing.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_columns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_flex-box.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_inline-block.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_linear-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_prefixer.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_radial-gradient.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_transform.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_transition.scssc +0 -0
- data/test/dummy/tmp/cache/sass/f9703f822f603d031cc5d49a82ea8d38faa70942/_user-select.scssc +0 -0
- data/vendor/assets/ckeditor/ckeditor-contrib/plugins/MediaEmbed/plugin.js +1 -1
- data/vendor/assets/ckeditor/ckeditor-contrib/skins/BootstrapCK/editor.css +4 -4
- metadata +479 -20
- data/app/assets/javascripts/rich/editor/ckeditor_path.js +0 -1
data/README.rdoc
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
{<img src="https://github.com/bastiaanterhorst/rich/raw/master/app/assets/images/rich/rich.png" />}[https://github.com/bastiaanterhorst/rich/] Rich is an opinionated implementation of CKEditor for Rails 3.2 and up. It includes a stripped down toolbar, simplified dialogs and a custom file manager. The file manager can also be used separate from CKEditor.
|
4
4
|
|
5
|
-
Presently, Rich integrates with Active Admin, Rails Admin and vanilla Formtastic (versions 1 and 2).
|
5
|
+
Presently, Rich integrates with Active Admin, Rails Admin and vanilla Formtastic (versions 1 and 2). Uploaded files can be stored on the filesystem, or on S3 (via Paperclips built-in S3 support).
|
6
6
|
|
7
7
|
== Goals
|
8
8
|
|
@@ -26,7 +26,7 @@ Rich is available as a Ruby Gem, which makes installation very easy.
|
|
26
26
|
gem 'rich'
|
27
27
|
# the edge (unstable) version can be had using:
|
28
28
|
# gem 'rich', :git => 'https://github.com/bastiaanterhorst/rich.git'
|
29
|
-
|
29
|
+
|
30
30
|
After updating your bundle, run the installer.
|
31
31
|
|
32
32
|
$> rails generate rich:install
|
@@ -34,10 +34,10 @@ After updating your bundle, run the installer.
|
|
34
34
|
The installer sets up a route, creates an initializer for configuration and adds a javascript and CSS file. It also creates a migration, so we need to migrate the database.
|
35
35
|
|
36
36
|
$> rake db:migrate
|
37
|
-
|
37
|
+
|
38
38
|
As a last step, secure the file manager by setting your authentication method in <tt>/config/initializers/rich.rb</tt>. If you're using Devise with an AdminUser model (incidentally, the Active Admin defaults):
|
39
39
|
config.authentication_method = :authenticate_admin_user!
|
40
|
-
|
40
|
+
|
41
41
|
You're good to go.
|
42
42
|
|
43
43
|
== Usage
|
@@ -51,17 +51,17 @@ To use Rich, it's javascript file must be loaded. By default, this is already se
|
|
51
51
|
In your formtastic form, use <tt>:as => :rich</tt> to insert Rich. Like so:
|
52
52
|
|
53
53
|
<%= semantic_form_for @post do |f| %>
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
54
|
+
<%= f.inputs do %>
|
55
|
+
<%= f.input :name %>
|
56
|
+
<%= f.input :title %>
|
57
|
+
<%= f.input :featured_image, :as => :rich_picker %>
|
58
|
+
<%= f.input :body, :as => :rich, :config => { :default_style => "myCrazyPaperclipStyle" } %>
|
59
|
+
<% end %>
|
60
|
+
<%= f.buttons do %>
|
61
|
+
<%= f.commit_button %>
|
62
|
+
<% end %>
|
63
|
+
<% end %>
|
64
|
+
|
65
65
|
=== Active Admin
|
66
66
|
|
67
67
|
Since Active Admin actually uses Formtastic, you can use it with Rich out of the box. In your model configuration file, set up your form like this. Make sure you add <tt>//= require rich</tt> to your <tt>app/assets/javascripts/active_admin.js</tt>.
|
@@ -70,11 +70,11 @@ Since Active Admin actually uses Formtastic, you can use it with Rich out of the
|
|
70
70
|
f.inputs "Basic info" do
|
71
71
|
f.input :title
|
72
72
|
f.input :featured_image, :as => :rich_picker, :config => { :style => 'width: 400px !important;' }
|
73
|
-
|
73
|
+
f.input :body, :as => :rich, :config => { :width => '76%', :height => '400px' }
|
74
74
|
end
|
75
75
|
f.buttons
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
=== Rails Admin
|
79
79
|
|
80
80
|
To use Rich in your RA forms, use the following in your initializer:
|
@@ -83,9 +83,9 @@ To use Rich in your RA forms, use the following in your initializer:
|
|
83
83
|
edit do
|
84
84
|
field :title
|
85
85
|
field :body, :rich_editor do
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
config({
|
87
|
+
:insert_many => true
|
88
|
+
})
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -98,7 +98,7 @@ To use the image picker on a string field, do this:
|
|
98
98
|
:view_mode => "list"
|
99
99
|
})
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
== Screenshots
|
103
103
|
|
104
104
|
This is the editor with default settings (shown here in Rails Admin).
|
@@ -119,7 +119,7 @@ Rich works just fine in production mode. To accomodate the structure of the CKEd
|
|
119
119
|
Rich will also clean up these CKEditor files when you clean your assets. Like this:
|
120
120
|
|
121
121
|
rake assets:clean
|
122
|
-
|
122
|
+
|
123
123
|
Although generally not necessary, the underlying Rich tasks can be invoked directly.
|
124
124
|
|
125
125
|
rake rich:assetize_ckeditor
|
@@ -153,7 +153,25 @@ When you change styles after uploading files, you will need to re-process those
|
|
153
153
|
|
154
154
|
=== Using the file manager without CKEditor
|
155
155
|
|
156
|
-
Besides from within the editor, the file manager can also be used on it's own. See the <tt>rich_picker</tt> examples above. One important thing to note is that this requires a string field on the receiving object.
|
156
|
+
Besides from within the editor, the file manager can also be used on it's own. See the <tt>rich_picker</tt> examples above. One important thing to note is that this requires a string field on the receiving object. If you provide an input field that's #ID ends in <tt>_id</tt>, the picker will return the ID of the <tt>Rich::RichFile</tt> object (for use in a relation perhaps?). If the #ID of the input ends in anything else, it will return the URL of the asset you selected.
|
157
|
+
|
158
|
+
Pass the config option <tt>:hidden_input => true</tt> to use a hidden text field.
|
159
|
+
|
160
|
+
Pass the config option <tt>:preview_size => '100px'</tt> to specify the size of the image you want to preview, otherwise the full size version of the image you pick will be shown.
|
161
|
+
|
162
|
+
Pass the config option <tt>:placeholder_image => image_path('placeholder.png')</tt> to show a placeholder image that will be replaced when an asset has been selected.
|
163
|
+
|
164
|
+
You might use this in a relation like this in ActiveAdmin:
|
165
|
+
|
166
|
+
form do |f|
|
167
|
+
f.inputs do
|
168
|
+
f.input :title
|
169
|
+
end
|
170
|
+
f.has_many :assets do |asset_form|
|
171
|
+
asset_form.input :rich_file_id, :as => :rich_picker, :config => {:style => 'width: 400px !important;', :hidden_input => true, :placeholder_image => image_path('placeholder.png'), :preview_size => :thumb}
|
172
|
+
end
|
173
|
+
f.buttons
|
174
|
+
end
|
157
175
|
|
158
176
|
=== Non-image uploads
|
159
177
|
|
@@ -186,7 +204,7 @@ It is possible to limit the files available in the file manager to a more releva
|
|
186
204
|
To scope the file manager to a collection of your choosing, pass the collection name into the <tt>:scoped</tt> configuration option. This collection name is just a string; pick anything you like. In Rails Admin:
|
187
205
|
|
188
206
|
field :cover_images, :rich_editor do
|
189
|
-
config({
|
207
|
+
config({
|
190
208
|
:scoped => "book covers"
|
191
209
|
})
|
192
210
|
end
|
@@ -194,7 +212,7 @@ To scope the file manager to a collection of your choosing, pass the collection
|
|
194
212
|
To scope the filemanager to a specific object, simply pass in <tt>true</tt>. Again for Rails Admin:
|
195
213
|
|
196
214
|
field :body, :rich_editor do
|
197
|
-
config({
|
215
|
+
config({
|
198
216
|
:scoped => true
|
199
217
|
})
|
200
218
|
end
|
@@ -203,6 +221,20 @@ In the latter example (scoping to an object), it is up to you to determine if sc
|
|
203
221
|
|
204
222
|
Also note that none of this is secure. At all. It is purely meant as a convenience to save you from wading through tons of irrelevant files. If need to hide files from prying eyes, you need something else.
|
205
223
|
|
224
|
+
=== Uploading to S3
|
225
|
+
|
226
|
+
Paperclip (which Rich uses to handle uploads) supports S3 out of the box. Just add the following to you environment:
|
227
|
+
|
228
|
+
Paperclip::Attachment.default_options.merge!(
|
229
|
+
:storage => :s3,
|
230
|
+
:bucket => ENV['S3_BUCKET'],
|
231
|
+
:url => "/system/:class/:attachment/:id/:style/:filename",
|
232
|
+
:s3_credentials => {
|
233
|
+
:access_key_id => ENV['S3_ACCESS_KEY_ID'],
|
234
|
+
:secret_access_key => ENV['S3_SECRET_ACCESS_KEY']
|
235
|
+
}
|
236
|
+
)
|
237
|
+
|
206
238
|
== Planned features & ideas
|
207
239
|
|
208
240
|
* drag & drop uploading
|
File without changes
|
@@ -34,8 +34,11 @@ rich.Browser.prototype = {
|
|
34
34
|
});
|
35
35
|
|
36
36
|
browser.selectStyle(def);
|
37
|
-
|
38
|
-
|
37
|
+
|
38
|
+
//check if we are inserting an object
|
39
|
+
var split_field_name = $.QueryString["dom_id"].split('_');
|
40
|
+
|
41
|
+
if(opt.length < 2 || split_field_name[split_field_name.length - 1] == "id") {
|
39
42
|
$('#styles').hide();
|
40
43
|
browser.selectStyle(opt[0]);
|
41
44
|
}
|
@@ -96,7 +99,7 @@ rich.Browser.prototype = {
|
|
96
99
|
|
97
100
|
|
98
101
|
if($.QueryString["CKEditor"]=='picker') {
|
99
|
-
window.opener.assetPicker.setAsset($.QueryString["dom_id"], url)
|
102
|
+
window.opener.assetPicker.setAsset($.QueryString["dom_id"], url, id, type);
|
100
103
|
} else {
|
101
104
|
window.opener.CKEDITOR.tools.callFunction($.QueryString["CKEditorFuncNum"], url, id, name);
|
102
105
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
var CKEDITOR_BASEPATH = '<%= asset_path("ckeditor/") %>';
|
@@ -26,9 +26,17 @@ rich.AssetPicker.prototype = {
|
|
26
26
|
window.open(url, 'filebrowser', "width=860,height=500")
|
27
27
|
},
|
28
28
|
|
29
|
-
setAsset: function(dom_id, asset){
|
30
|
-
$(dom_id).
|
31
|
-
|
29
|
+
setAsset: function(dom_id, asset, id, type){
|
30
|
+
var split_field_name = $(dom_id).attr('id').split('_')
|
31
|
+
if (split_field_name[split_field_name.length - 1] == "id") {
|
32
|
+
$(dom_id).val(id);
|
33
|
+
} else {
|
34
|
+
$(dom_id).val(asset);
|
35
|
+
}
|
36
|
+
|
37
|
+
if(type=='image') {
|
38
|
+
$(dom_id).siblings('img.rich-image-preview').first().attr({src: asset});
|
39
|
+
}
|
32
40
|
}
|
33
41
|
|
34
42
|
};
|
File without changes
|
@@ -1,28 +1,88 @@
|
|
1
1
|
if (Object.const_defined?("Formtastic") && Gem.loaded_specs["formtastic"].version.version[0,1] == "2")
|
2
|
-
|
2
|
+
|
3
3
|
class RichPickerInput < ::Formtastic::Inputs::StringInput
|
4
|
+
include Formtastic::Helpers::InputHelper
|
5
|
+
attr_reader :editor_options
|
6
|
+
|
7
|
+
def to_html
|
8
|
+
@editor_options = Rich.options(options[:config], object_name, object.id)
|
4
9
|
|
5
|
-
def to_html
|
6
|
-
scope_type = object_name
|
7
|
-
scope_id = object.id
|
8
|
-
editor_options = Rich.options(options[:config], scope_type, scope_id)
|
9
|
-
|
10
10
|
local_input_options = {
|
11
11
|
:class => 'rich-picker',
|
12
12
|
:style => editor_options[:style]
|
13
13
|
}
|
14
14
|
|
15
15
|
input_wrapping do
|
16
|
-
|
17
16
|
label_html <<
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
input_field(local_input_options) <<
|
18
|
+
button <<
|
19
|
+
preview <<
|
20
|
+
javascript
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
private
|
22
25
|
|
26
|
+
def input_field(local_input_options)
|
27
|
+
if editor_options[:hidden_input] == true
|
28
|
+
builder.hidden_field(method, local_input_options.merge(input_html_options))
|
29
|
+
else
|
30
|
+
builder.text_field(method, local_input_options.merge(input_html_options))
|
23
31
|
end
|
24
32
|
end
|
25
33
|
|
34
|
+
def preview_image_path
|
35
|
+
method_value = object.send(method)
|
36
|
+
|
37
|
+
# return placeholder image if this is a non-image picker OR if there is no value set
|
38
|
+
return editor_options[:placeholder_image] if editor_options[:type].to_s == 'file'
|
39
|
+
return editor_options[:placeholder_image] unless method_value.present?
|
40
|
+
|
41
|
+
column_type = column_for(method).type
|
42
|
+
if column_type == :integer
|
43
|
+
file = Rich::RichFile.find(method_value)
|
44
|
+
file.rich_file.url(:rich_thumb) #we ask paperclip directly for the file, so asset paths should not be an issue
|
45
|
+
else # should be :string
|
46
|
+
method_value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def button
|
51
|
+
%Q{
|
52
|
+
<a href='#{Rich.editor[:richBrowserUrl]}' class='button'>
|
53
|
+
#{I18n.t('picker_browse')}
|
54
|
+
</a>
|
55
|
+
}.html_safe
|
56
|
+
end
|
57
|
+
|
58
|
+
def javascript
|
59
|
+
%Q{
|
60
|
+
<script>
|
61
|
+
$(function(){
|
62
|
+
$('##{input_html_options[:id]}_input a').click(function(e){
|
63
|
+
e.preventDefault(); assetPicker.showFinder('##{input_html_options[:id]}', #{editor_options.to_json})
|
64
|
+
});
|
65
|
+
});
|
66
|
+
</script>
|
67
|
+
}.html_safe
|
68
|
+
end
|
69
|
+
|
70
|
+
def preview
|
71
|
+
return unless editor_options[:type] != 'file'
|
72
|
+
|
73
|
+
path = preview_image_path
|
74
|
+
klass = "class='rich-image-preview'"
|
75
|
+
style = "style='max-width:#{editor_options[:preview_size]}; max-height:#{editor_options[:preview_size]};'"
|
76
|
+
if path
|
77
|
+
%Q{
|
78
|
+
</br></br><img src='#{preview_image_path}' #{klass} #{style} />
|
79
|
+
}.html_safe
|
80
|
+
else
|
81
|
+
%Q{
|
82
|
+
</br></br><div #{klass} #{style}></div>
|
83
|
+
}.html_safe
|
84
|
+
end
|
85
|
+
end
|
26
86
|
end
|
27
|
-
|
28
|
-
end
|
87
|
+
|
88
|
+
end
|
@@ -1,9 +1,7 @@
|
|
1
1
|
= javascript_include_tag "rich/base.js"
|
2
|
-
= form.send field.view_helper, field.method_name, field.html_attributes
|
2
|
+
= form.send field.view_helper, field.method_name, field.html_attributes.merge({:style=> (if field.editor_options[:hidden_input]==true then "visibility:hidden;position:absolute" else "" end )})
|
3
3
|
= link_to t('picker_browse').capitalize, Rich.editor[:richBrowserUrl], :class => "btn create"
|
4
|
-
- unless field.
|
5
|
-
|
6
|
-
%br
|
7
|
-
%img{:src => field.value.html_safe, :style => 'height: 100px', :class => 'rich-image-preview'}
|
4
|
+
- unless field.editor_options[:type]==:file
|
5
|
+
%img{:src => field.preview_image_path, :style => "padding: 10px 0; display: block; max-width: #{field.editor_options[:preview_size]}; max-width: #{field.editor_options[:preview_size]};", :class => 'rich-image-preview'}
|
8
6
|
= javascript_tag do
|
9
|
-
|
7
|
+
$(function(){$('##{form.dom_id(field)}_field a').click(function(e){ e.preventDefault(); assetPicker.showFinder('##{form.dom_id(field)}', #{field.editor_options.to_json.html_safe})})})
|
@@ -18,7 +18,7 @@ module Rich
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def install_editor_styles
|
21
|
-
copy_file '../../../../../app/assets/stylesheets/rich/
|
21
|
+
copy_file '../../../../../app/assets/stylesheets/rich/editor.css', 'app/assets/stylesheets/rich/editor.css'
|
22
22
|
end
|
23
23
|
|
24
24
|
def install_javascript
|
data/lib/rich.rb
CHANGED
@@ -6,7 +6,7 @@ end
|
|
6
6
|
require "rich/engine"
|
7
7
|
|
8
8
|
module Rich
|
9
|
-
|
9
|
+
|
10
10
|
# configure image styles
|
11
11
|
def self.image_styles
|
12
12
|
@@image_styles.merge({ :rich_thumb => "100x100#" })
|
@@ -44,16 +44,21 @@ module Rich
|
|
44
44
|
|
45
45
|
mattr_accessor :allowed_document_types
|
46
46
|
@@allowed_document_types = :all
|
47
|
-
|
48
|
-
mattr_accessor :file_storage
|
49
|
-
@@file_storage
|
50
|
-
|
51
|
-
mattr_accessor :s3_credentials
|
52
|
-
@@s3_credentials
|
53
|
-
|
47
|
+
|
54
48
|
mattr_accessor :file_path
|
55
49
|
@@file_path
|
56
|
-
|
50
|
+
|
51
|
+
# configuration for picker
|
52
|
+
mattr_accessor :placeholder_image
|
53
|
+
@@placeholder_image = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" # a transparent pixel
|
54
|
+
|
55
|
+
mattr_accessor :preview_size
|
56
|
+
@@preview_size = "100px"
|
57
|
+
|
58
|
+
mattr_accessor :hidden_input
|
59
|
+
@@hidden_input = false
|
60
|
+
# end configuration for picker
|
61
|
+
|
57
62
|
# Configuration defaults (these map directly to ckeditor settings)
|
58
63
|
mattr_accessor :editor
|
59
64
|
@@editor = {
|
@@ -61,7 +66,7 @@ module Rich
|
|
61
66
|
:stylesSet => [],
|
62
67
|
:extraPlugins => 'stylesheetparser,richfile,MediaEmbed,audio',
|
63
68
|
:removePlugins => 'scayt,menubutton,contextmenu,image,forms',
|
64
|
-
:contentsCss =>
|
69
|
+
:contentsCss => :default,
|
65
70
|
:removeDialogTabs => 'link:advanced;link:target',
|
66
71
|
:startupOutlineBlocks => true,
|
67
72
|
:forcePasteAsPlainText => true,
|
@@ -88,13 +93,20 @@ module Rich
|
|
88
93
|
:default_style => self.default_style,
|
89
94
|
:insert_many => self.insert_many,
|
90
95
|
:allow_document_uploads => self.allow_document_uploads,
|
91
|
-
:allow_embeds => self.allow_embeds
|
96
|
+
:allow_embeds => self.allow_embeds,
|
97
|
+
:placeholder_image => self.placeholder_image,
|
98
|
+
:preview_size => self.preview_size,
|
99
|
+
:hidden_input => self.hidden_input
|
92
100
|
}
|
93
101
|
editor_options = self.editor.merge(base)
|
94
102
|
|
95
103
|
# merge in local overrides
|
96
104
|
editor_options.merge!(overrides) if overrides
|
97
|
-
|
105
|
+
|
106
|
+
# if the contentcss is set to :default, use the asset pipeline
|
107
|
+
editor_options[:contentsCss] = ActionController::Base.helpers.stylesheet_path('rich/editor.css') if editor_options[:contentsCss] == :default
|
108
|
+
|
109
|
+
|
98
110
|
# update the language to the currently selected locale
|
99
111
|
editor_options[:language] = I18n.locale
|
100
112
|
|
@@ -155,7 +167,6 @@ module Rich
|
|
155
167
|
true
|
156
168
|
end
|
157
169
|
end
|
158
|
-
|
159
170
|
end
|
160
171
|
|
161
172
|
def self.setup
|
@@ -163,11 +174,6 @@ module Rich
|
|
163
174
|
end
|
164
175
|
|
165
176
|
def self.insert
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
177
|
# manually inject into Formtastic 1. V2 is extended autmatically.
|
172
178
|
if Object.const_defined?("Formtastic")
|
173
179
|
if(Gem.loaded_specs["formtastic"].version.version[0,1] == "1")
|
data/lib/rich/engine.rb
CHANGED
@@ -7,7 +7,7 @@ module Rich
|
|
7
7
|
isolate_namespace Rich
|
8
8
|
|
9
9
|
initializer "rich.add_middleware" do |app|
|
10
|
-
app.config.assets.precompile += %w(rich/base.js rich/editor.css
|
10
|
+
app.config.assets.precompile += %w(rich/base.js rich/editor.css)
|
11
11
|
app.middleware.use 'Rack::RawUpload', :paths => ['/rich/files']
|
12
12
|
end
|
13
13
|
|