rich 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +163 -0
- data/Rakefile +39 -0
- data/app/assets/images/rich/images.png +0 -0
- data/app/assets/images/rich/plus-red.png +0 -0
- data/app/assets/images/rich/plus.png +0 -0
- data/app/assets/images/rich/x-red.png +0 -0
- data/app/assets/javascripts/rich/application.js +61 -0
- data/app/assets/javascripts/rich/base.js +51 -0
- data/app/assets/javascripts/rich/ckeditor_path.js +1 -0
- data/app/assets/javascripts/rich/uploader.js +59 -0
- data/app/assets/stylesheets/rich/application.css.scss +253 -0
- data/app/assets/stylesheets/rich/editor.css +20 -0
- data/app/assets/stylesheets/rich/files.css +4 -0
- data/app/assets/stylesheets/rich/mixins/reset.css.scss +58 -0
- data/app/controllers/rich/application_controller.rb +11 -0
- data/app/controllers/rich/files_controller.rb +107 -0
- data/app/helpers/rich/application_helper.rb +4 -0
- data/app/helpers/rich/files_helper.rb +4 -0
- data/app/inputs/rich_input.rb +14 -0
- data/app/models/rich/rich_image.rb +77 -0
- data/app/views/layouts/rich/application.html.erb +14 -0
- data/app/views/rich/files/_image.html.erb +9 -0
- data/app/views/rich/files/destroy.js.erb +1 -0
- data/app/views/rich/files/index.html.erb +29 -0
- data/app/views/rich/files/show.html.erb +1 -0
- data/config/routes.rb +5 -0
- data/db/migrate/20111002142937_create_rich_rich_images.rb +17 -0
- data/lib/generators/rich/install/install_generator.rb +34 -0
- data/lib/generators/rich/install/templates/rich.js +1 -0
- data/lib/generators/rich/install/templates/rich.rb.erb +69 -0
- data/lib/rich.rb +63 -0
- data/lib/rich/engine.rb +13 -0
- data/lib/rich/form_builder.rb +14 -0
- data/lib/rich/legacy_formtastic.rb +15 -0
- data/lib/rich/version.rb +3 -0
- data/lib/rich/view_helper.rb +48 -0
- data/lib/tasks/rich_tasks.rake +29 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/admin/dashboards.rb +38 -0
- data/test/dummy/app/admin/posts.rb +11 -0
- data/test/dummy/app/assets/javascripts/active_admin.js +1 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/javascripts/posts.js +2 -0
- data/test/dummy/app/assets/javascripts/rich.js +1 -0
- data/test/dummy/app/assets/stylesheets/active_admin.css.scss +10 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/assets/stylesheets/posts.css +4 -0
- data/test/dummy/app/assets/stylesheets/rich/editor.css +20 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/posts_controller.rb +83 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/posts_helper.rb +2 -0
- data/test/dummy/app/models/admin_user.rb +9 -0
- data/test/dummy/app/models/post.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/posts/_form.html.erb +29 -0
- data/test/dummy/app/views/posts/_formtastic_form.html.erb +10 -0
- data/test/dummy/app/views/posts/edit.html.erb +6 -0
- data/test/dummy/app/views/posts/index.html.erb +27 -0
- data/test/dummy/app/views/posts/new.html.erb +5 -0
- data/test/dummy/app/views/posts/show.html.erb +20 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +48 -0
- data/test/dummy/config/boot.rb +19 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +32 -0
- data/test/dummy/config/environments/production.rb +62 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/active_admin.rb +102 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/devise.rb +211 -0
- data/test/dummy/config/initializers/formtastic.rb +80 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/rich.rb +28 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/devise.en.yml +58 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +13 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20111001122048_create_posts.rb +11 -0
- data/test/dummy/db/migrate/20111003150957_create_rich_rich_images.rb +17 -0
- data/test/dummy/db/migrate/20111014123344_devise_create_admin_users.rb +31 -0
- data/test/dummy/db/migrate/20111014143348_create_admin_notes.rb +16 -0
- data/test/dummy/db/migrate/20111014143349_move_admin_notes_to_comments.rb +25 -0
- data/test/dummy/db/production.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +67 -0
- data/test/dummy/log/development.log +72064 -0
- data/test/dummy/log/production.log +2417 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/system/test +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/admin_users.yml +11 -0
- data/test/dummy/test/fixtures/posts.yml +11 -0
- data/test/dummy/test/functional/posts_controller_test.rb +49 -0
- data/test/dummy/test/unit/admin_user_test.rb +7 -0
- data/test/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
- data/test/dummy/test/unit/post_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/C2B/5B0/sprockets%2F0c71315129cf9540624929678219ee7b +0 -0
- data/test/dummy/tmp/cache/assets/C32/C40/sprockets%2Ff459d7671964c49e413971720514ba68 +0 -0
- data/test/dummy/tmp/cache/assets/C51/3D0/sprockets%2F110c288a88ab99a1399d35171079612c +0 -0
- data/test/dummy/tmp/cache/assets/C53/630/sprockets%2F0680b1b2c967d3c84970e3786800641c +0 -0
- data/test/dummy/tmp/cache/assets/C53/680/sprockets%2F03d11661470de7443c495783330d9ee7 +0 -0
- data/test/dummy/tmp/cache/assets/C7F/C10/sprockets%2F356f0929a286c961448d76c12a2e14b1 +0 -0
- data/test/dummy/tmp/cache/assets/C8D/E30/sprockets%2F24444bdc865de860f4b693233c973844 +0 -0
- data/test/dummy/tmp/cache/assets/C99/430/sprockets%2F1027b261dc3bd6202585ad4d830263c6 +0 -0
- data/test/dummy/tmp/cache/assets/CAB/440/sprockets%2Fed2218494b3b8488b7268c00e717a0c1 +0 -0
- data/test/dummy/tmp/cache/assets/CB3/920/sprockets%2Fc38c48651c972cee0be83538700535b4 +0 -0
- data/test/dummy/tmp/cache/assets/CB4/740/sprockets%2F36fd3817633b234824bc6577f25ffe01 +0 -0
- data/test/dummy/tmp/cache/assets/CBE/A80/sprockets%2F60bb9087aed9745744925f6ce01525d9 +0 -0
- data/test/dummy/tmp/cache/assets/CC4/040/sprockets%2F83a9f5f7314b761bbd7f1858d1998045 +0 -0
- data/test/dummy/tmp/cache/assets/CC4/590/sprockets%2F869369b5c848f745b23ba174ca9197a6 +0 -0
- data/test/dummy/tmp/cache/assets/CC4/BF0/sprockets%2F93d5b131135a09e48369e02ba5c01b0a +0 -0
- data/test/dummy/tmp/cache/assets/CC7/5F0/sprockets%2F8bf37168fb70e08b9e4578e72739a543 +0 -0
- data/test/dummy/tmp/cache/assets/CD5/340/sprockets%2Fae698307143f445c5011d6ad90b4cf60 +0 -0
- data/test/dummy/tmp/cache/assets/CDD/D50/sprockets%2Faee2002e4369cf20946112efcb776089 +0 -0
- data/test/dummy/tmp/cache/assets/CE4/510/sprockets%2F3271d0cbd86553a56768f4d130ec5e59 +0 -0
- data/test/dummy/tmp/cache/assets/CE8/310/sprockets%2F4ab24984d5862f28160f1f4f067e2ef4 +0 -0
- data/test/dummy/tmp/cache/assets/CEC/1A0/sprockets%2F87fdead6014b961bb870b5931890d677 +0 -0
- data/test/dummy/tmp/cache/assets/CED/2E0/sprockets%2F82382552d084b0569dfd88e34d1cb7e8 +0 -0
- data/test/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/CF0/A80/sprockets%2Fd1de761043f6d817880d4b876a73bf87 +0 -0
- data/test/dummy/tmp/cache/assets/CF9/EC0/sprockets%2F04ba1f02c639d30c53eb7b51640b937a +0 -0
- data/test/dummy/tmp/cache/assets/CFB/870/sprockets%2Feb5658a4a2c12e389e4c405f0113a0a7 +0 -0
- data/test/dummy/tmp/cache/assets/D00/7A0/sprockets%2F3ee0dfa5072b54505817cb4bf934201e +0 -0
- data/test/dummy/tmp/cache/assets/D00/C00/sprockets%2F0a61e8d7b11a463083da24605e65d5dd +0 -0
- data/test/dummy/tmp/cache/assets/D07/B30/sprockets%2F0640b99ec5e303921065ac4c0ff8b7f0 +0 -0
- data/test/dummy/tmp/cache/assets/D11/D20/sprockets%2Fcac21eac42152981882bf9e489316af4 +0 -0
- data/test/dummy/tmp/cache/assets/D13/970/sprockets%2F1fd634278255bc58382a590fd5cf24cc +0 -0
- data/test/dummy/tmp/cache/assets/D14/980/sprockets%2F85dc72862eb259cd954ab41369bc6a32 +0 -0
- data/test/dummy/tmp/cache/assets/D15/F40/sprockets%2F83d1a8006e470e79f75592d63bdedc04 +0 -0
- data/test/dummy/tmp/cache/assets/D16/C70/sprockets%2Fd3046a8979c64b4311a728da2ee8b88b +0 -0
- data/test/dummy/tmp/cache/assets/D1D/1A0/sprockets%2Fc2e11e4152a31726c2cbab7333c74ba2 +0 -0
- data/test/dummy/tmp/cache/assets/D1D/500/sprockets%2F71e1de34b5d39e4c637f0fb0619696f7 +0 -0
- data/test/dummy/tmp/cache/assets/D1F/B30/sprockets%2F6351ed750b17ed0f99fa01c32ff98878 +0 -0
- data/test/dummy/tmp/cache/assets/D2A/FA0/sprockets%2Fa5403e1fe15018cddc4435c3cac84910 +0 -0
- data/test/dummy/tmp/cache/assets/D2E/090/sprockets%2Fc54283e81ce52bf9d542ab12492a01ad +0 -0
- data/test/dummy/tmp/cache/assets/D2F/390/sprockets%2Fa02968dd653b0e650fc202c33ff42fc0 +0 -0
- data/test/dummy/tmp/cache/assets/D30/E90/sprockets%2F3a19bbe0320337a6bf29177da71bf1e7 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D34/080/sprockets%2Fe398005214c8d65a54fc19fca2c00c8b +0 -0
- data/test/dummy/tmp/cache/assets/D37/9B0/sprockets%2F0de49dd3031c50c7cf2ef74d6c392530 +0 -0
- data/test/dummy/tmp/cache/assets/D38/540/sprockets%2F86e1ad844bc9df4491a2a52b870421db +0 -0
- data/test/dummy/tmp/cache/assets/D3C/070/sprockets%2F2377eb8a729535e35abd593a6fc00ba6 +0 -0
- data/test/dummy/tmp/cache/assets/D3E/B20/sprockets%2F1f79ee84bd6d74d100c5cb018b662b67 +0 -0
- data/test/dummy/tmp/cache/assets/D40/A40/sprockets%2Feb59c65dcb7136f1cd134dac36794822 +0 -0
- data/test/dummy/tmp/cache/assets/D48/9F0/sprockets%2F6ed3c460867ee6d748edad50818d332a +0 -0
- data/test/dummy/tmp/cache/assets/D4D/650/sprockets%2Ff51d1875ad5829c7bf3ff03e920497be +0 -0
- data/test/dummy/tmp/cache/assets/D52/9B0/sprockets%2F736738bf59f956eb15c4bff06d980be0 +0 -0
- data/test/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
- data/test/dummy/tmp/cache/assets/D55/5C0/sprockets%2F97b52c1c0d1a002ac6fb9d702b7ab625 +0 -0
- data/test/dummy/tmp/cache/assets/D61/940/sprockets%2Fca03651b8f5fb1416c9945cda71ab22d +0 -0
- data/test/dummy/tmp/cache/assets/D6C/F90/sprockets%2Fcb34e531e41b981cf6ca2a5c7e70f890 +0 -0
- data/test/dummy/tmp/cache/assets/D78/9D0/sprockets%2Ff56eced46698105ad2e9d46b1e2ee228 +0 -0
- data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
- data/test/dummy/tmp/cache/assets/D86/710/sprockets%2F409dbeb796f68c91b60fe29aef7817e3 +0 -0
- data/test/dummy/tmp/cache/assets/D95/D50/sprockets%2F15e32d81de6597aad23d67d2cd1d0b7a +0 -0
- data/test/dummy/tmp/cache/assets/D96/E90/sprockets%2Ff43f31dd3e2d9f8eda108c01c42bd457 +0 -0
- data/test/dummy/tmp/cache/assets/D98/BF0/sprockets%2F132c8dc4d7ba67c8faee429e5064a02c +0 -0
- data/test/dummy/tmp/cache/assets/D9C/CD0/sprockets%2Fc85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/test/dummy/tmp/cache/assets/DB9/240/sprockets%2F689d916cf738bdb67e176fced176e3af +0 -0
- data/test/dummy/tmp/cache/assets/DBA/AB0/sprockets%2F8be4208fd77cb5ef9b6f77e5fcf18670 +0 -0
- data/test/dummy/tmp/cache/assets/DC5/450/sprockets%2F82d256faac73d9a3ec5c4f1d11be525d +0 -0
- data/test/dummy/tmp/cache/assets/DC6/890/sprockets%2F41b80fcec0c085408c41ecadc877df0f +0 -0
- data/test/dummy/tmp/cache/assets/DCE/890/sprockets%2Ffd6332ebff4dab12cdf448e195d6b381 +0 -0
- data/test/dummy/tmp/cache/assets/DD7/B50/sprockets%2F7effa89c4b23ab60109f969a9a66ccbc +0 -0
- data/test/dummy/tmp/cache/assets/DDE/420/sprockets%2Ffb8b186d5bf0307f86f65fc787d2adeb +0 -0
- data/test/dummy/tmp/cache/assets/DE7/7C0/sprockets%2F75aa5c034633c20d9c4d1bffbbbdc23d +0 -0
- data/test/dummy/tmp/cache/assets/DF0/680/sprockets%2F5e8210564bdda6fcef1fa19aa04b5e6a +0 -0
- data/test/dummy/tmp/cache/assets/DFB/0C0/sprockets%2Fd35f36529da4a7a4cf67cdbe0a3bf27e +0 -0
- data/test/dummy/tmp/cache/assets/DFF/4D0/sprockets%2F0d7eae306cc4e83ae549e96b1b6da8db +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E06/920/sprockets%2F6baa37d1c26468aef4fe5fe4bf982fa3 +0 -0
- data/test/dummy/tmp/cache/assets/E09/680/sprockets%2Fff9edf3a74399a0818b02efcff3ad0f7 +0 -0
- data/test/dummy/tmp/cache/assets/E0B/8B0/sprockets%2F35f64adcaf8786c81c0def5dd2ff47d3 +0 -0
- data/test/dummy/tmp/cache/assets/E2F/E90/sprockets%2Ff4b19e42c92a93dcaaec9fe6eae4081d +0 -0
- data/test/dummy/tmp/cache/sass/12aeefe9aeb071fe3d12ce952e92dfc373eac603/_base.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/12aeefe9aeb071fe3d12ce952e92dfc373eac603/_forms.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/12aeefe9aeb071fe3d12ce952e92dfc373eac603/_header.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/12aeefe9aeb071fe3d12ce952e92dfc373eac603/_mixins.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/12aeefe9aeb071fe3d12ce952e92dfc373eac603/_typography.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4042a1944de48cf2066ee5650a418db4b1d7f0a1/_base.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4042a1944de48cf2066ee5650a418db4b1d7f0a1/_forms.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4042a1944de48cf2066ee5650a418db4b1d7f0a1/_header.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4042a1944de48cf2066ee5650a418db4b1d7f0a1/_mixins.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4042a1944de48cf2066ee5650a418db4b1d7f0a1/_typography.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4905b1148d31ac1351d8ccf185fbd2494a596795/application.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4f667cf792197ab0525ceee5448b803db81dab90/_comments.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4f667cf792197ab0525ceee5448b803db81dab90/_date_picker.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4f667cf792197ab0525ceee5448b803db81dab90/_flash_messages.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/4f667cf792197ab0525ceee5448b803db81dab90/_tables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_all.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_buttons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_gradients.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_icons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_reset.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_rounded.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_sections.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_shadows.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/76bbe61bc8118aa78e4db81878cf11d79a964373/_variables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/9b29130c260e464c0ad2c23c77a58da7c3f9eec7/active_admin.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_all.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_buttons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_gradients.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_icons.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_reset.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_rounded.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_sections.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_shadows.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dc62b2f303532e1c32e9571414568d9c2570f335/_variables.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/ddba83cb438190ca32bf384b6eea0c3ef82ae9fa/reset.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dde0527ffef9ea409c8e8afb2306d11f2e0b6500/_comments.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dde0527ffef9ea409c8e8afb2306d11f2e0b6500/_date_picker.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dde0527ffef9ea409c8e8afb2306d11f2e0b6500/_flash_messages.css.scssc +0 -0
- data/test/dummy/tmp/cache/sass/dde0527ffef9ea409c8e8afb2306d11f2e0b6500/_tables.css.scssc +0 -0
- data/test/fixtures/rich/rich_images.yml +11 -0
- data/test/functional/rich/files_controller_test.rb +9 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/rich_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- data/test/unit/helpers/rich/files_helper_test.rb +6 -0
- data/test/unit/rich/rich_image_test.rb +9 -0
- metadata +603 -0
data/lib/rich.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "rich/engine"
|
2
|
+
|
3
|
+
module Rich
|
4
|
+
autoload :ViewHelper, 'rich/view_helper'
|
5
|
+
autoload :FormBuilder, 'rich/form_builder'
|
6
|
+
autoload :FormtasticBuilder, 'rich/legacy_formtastic'
|
7
|
+
|
8
|
+
# specify desired image styles here
|
9
|
+
mattr_accessor :image_styles
|
10
|
+
@@image_styles = {
|
11
|
+
:thumb => "100x100#"
|
12
|
+
}
|
13
|
+
|
14
|
+
mattr_accessor :allowed_styles
|
15
|
+
@@allowed_styles = :all
|
16
|
+
|
17
|
+
mattr_accessor :default_style
|
18
|
+
@@default_style = :thumb
|
19
|
+
|
20
|
+
mattr_accessor :authentication_method
|
21
|
+
@@authentication_method = :none
|
22
|
+
|
23
|
+
# Configuration defaults (these map directly to ckeditor settings)
|
24
|
+
mattr_accessor :editor
|
25
|
+
@@editor = {
|
26
|
+
:stylesSet => [],
|
27
|
+
:extraPlugins => 'stylesheetparser,richimage',
|
28
|
+
:removePlugins => 'scayt,menubutton,contextmenu,image,forms',
|
29
|
+
:contentsCss => '/assets/rich/editor.css', # TODO: make this map to the engine mount point
|
30
|
+
:removeDialogTabs => 'link:advanced;link:target',
|
31
|
+
:startupOutlineBlocks => true,
|
32
|
+
:forcePasteAsPlainText => true,
|
33
|
+
:format_tags => 'h3;p;pre',
|
34
|
+
:toolbar => [['Format','Styles'],['Bold', 'Italic', '-','NumberedList', 'BulletedList', 'Blockquote', '-', 'richImage', '-', 'Link', 'Unlink'],['Source', 'ShowBlocks']],
|
35
|
+
|
36
|
+
:richImageUrl => '/rich/files/', #todo make this map to the engine mount point
|
37
|
+
|
38
|
+
:uiColor => '#f4f4f4' # similar to Active Admin
|
39
|
+
}
|
40
|
+
# End configuration defaults
|
41
|
+
|
42
|
+
def self.setup
|
43
|
+
yield self
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.insert
|
47
|
+
|
48
|
+
# TODO: link asset to user definable entity <%= form.cktext_area :content, :swf_params=>{:assetable_type=>'User', :assetable_id=>current_user.id} %>
|
49
|
+
ActionView::Base.send(:include, Rich::ViewHelper)
|
50
|
+
ActionView::Helpers::FormBuilder.send(:include, Rich::FormBuilder)
|
51
|
+
|
52
|
+
# If we're dealing with Formtastic 1.x
|
53
|
+
if Object.const_defined?("Formtastic")
|
54
|
+
if(Gem.loaded_specs["formtastic"].version.version[0,1] == "1")
|
55
|
+
Formtastic::SemanticFormHelper.builder = Rich::CustomFormBuilder
|
56
|
+
::Formtastic::SemanticFormBuilder.send :include, Rich::FormtasticBuilder
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/lib/rich/engine.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'paperclip'
|
2
|
+
require 'rack/raw_upload'
|
3
|
+
|
4
|
+
module Rich
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
isolate_namespace Rich
|
7
|
+
|
8
|
+
initializer "rich.add_middleware" do |app|
|
9
|
+
app.middleware.use 'Rack::RawUpload', :paths => ['/rich/files'] # TODO make this path the engine mountpoint
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Rich
|
2
|
+
module FormBuilder
|
3
|
+
def self.included(base)
|
4
|
+
base.send(:include, Rich::ViewHelper)
|
5
|
+
base.send(:include, Rich::FormBuilder::ClassMethods)
|
6
|
+
end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
def rich_text_area(method, options = {})
|
10
|
+
rich_textarea(@object_name, method, objectify_options(options))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Rich
|
2
|
+
module FormtasticBuilder
|
3
|
+
def self.included(base)
|
4
|
+
base.send(:include, InstanceMethods)
|
5
|
+
end
|
6
|
+
|
7
|
+
module InstanceMethods
|
8
|
+
def rich_input(method, options)
|
9
|
+
html_options = options.delete(:input_html) || {}
|
10
|
+
self.label(method, options_for_label(options)) <<
|
11
|
+
self.send(:rich_textarea, sanitized_object_name, method, html_options)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/rich/version.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
module Rich
|
2
|
+
module ViewHelper
|
3
|
+
include ActionView::Helpers
|
4
|
+
|
5
|
+
def rich_textarea(object, field, options = {})
|
6
|
+
options = options.dup.symbolize_keys
|
7
|
+
|
8
|
+
var = options.delete(:object) if options.key?(:object)
|
9
|
+
var ||= @template.instance_variable_get("@#{object}")
|
10
|
+
|
11
|
+
value = var.send(field.to_sym) if var
|
12
|
+
value ||= options.delete(:value) || ""
|
13
|
+
|
14
|
+
element_id = options.delete(:id) || editor_element_id(object, field, options.delete(:index))
|
15
|
+
|
16
|
+
width = options.delete(:width) || '76%'
|
17
|
+
height = options.delete(:height) || '200px'
|
18
|
+
|
19
|
+
textarea_options = { :id => element_id }
|
20
|
+
|
21
|
+
textarea_options[:cols] = (options.delete(:cols) || 70).to_i
|
22
|
+
textarea_options[:rows] = (options.delete(:rows) || 20).to_i
|
23
|
+
textarea_options[:class] = (options.delete(:class) || 'editor').to_s
|
24
|
+
textarea_options[:style] = "width:#{width};height:#{height}"
|
25
|
+
|
26
|
+
# merge options with Rich.ckeditor
|
27
|
+
editor_options = Rich.editor.merge(options[:editor] || {})
|
28
|
+
editor_options[:width] = width;
|
29
|
+
editor_options[:height] = height;
|
30
|
+
|
31
|
+
output_buffer = ActiveSupport::SafeBuffer.new
|
32
|
+
output_buffer << ActionView::Base::InstanceTag.new(object, field, self, var).to_text_area_tag(textarea_options.merge(options))
|
33
|
+
|
34
|
+
# lookin' like wealth.
|
35
|
+
output_buffer << javascript_tag("$(function(){$('##{element_id}').ckeditor(function() { }, #{editor_options.to_json} );});")
|
36
|
+
|
37
|
+
output_buffer
|
38
|
+
end
|
39
|
+
|
40
|
+
protected
|
41
|
+
|
42
|
+
# construct a unique ID
|
43
|
+
def editor_element_id(object, field, index = nil)
|
44
|
+
index.blank? ? "#{object}_#{field}_editor" : "#{object}_#{index}_#{field}_editor"
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# == Assetize CKEditor
|
2
|
+
#
|
3
|
+
# This rake taks copies all CKEditor files from <tt>/vendor</tt>
|
4
|
+
# to <tt>/public/assets/</tt>. Required when running Rich in production mode.
|
5
|
+
namespace :rich do
|
6
|
+
|
7
|
+
desc "Copy CKEditor files to /public/assets for production"
|
8
|
+
task :assetize_ckeditor => :environment do
|
9
|
+
puts "Rich - Copying CKEditor to your assets folder"
|
10
|
+
mkdir_p Rails.root.join('public/assets/ckeditor')
|
11
|
+
cp_r Rich::Engine.root.join('vendor/assets/ckeditor/ckeditor/.'), Rails.root.join('public/assets/ckeditor')
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Clear CKEditor files from /public/assets"
|
15
|
+
task :clean_ckeditor => :environment do
|
16
|
+
puts "Rich - Removing CKEditor from your assets folder"
|
17
|
+
begin
|
18
|
+
rm_r Rails.root.join('public/assets/ckeditor')
|
19
|
+
rescue
|
20
|
+
# the folder may not exist
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Hook to automatically assetize ckeditor when precompiling assets
|
26
|
+
namespace :assets do
|
27
|
+
task :precompile => 'rich:assetize_ckeditor'
|
28
|
+
task :clean => 'rich:clean_ckeditor'
|
29
|
+
end
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,38 @@
|
|
1
|
+
ActiveAdmin::Dashboards.build do
|
2
|
+
|
3
|
+
# Define your dashboard sections here. Each block will be
|
4
|
+
# rendered on the dashboard in the context of the view. So just
|
5
|
+
# return the content which you would like to display.
|
6
|
+
|
7
|
+
# == Simple Dashboard Section
|
8
|
+
# Here is an example of a simple dashboard section
|
9
|
+
#
|
10
|
+
# section "Recent Posts" do
|
11
|
+
# ul do
|
12
|
+
# Post.recent(5).collect do |post|
|
13
|
+
# li link_to(post.title, admin_post_path(post))
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
|
18
|
+
# == Render Partial Section
|
19
|
+
# The block is rendered within the context of the view, so you can
|
20
|
+
# easily render a partial rather than build content in ruby.
|
21
|
+
#
|
22
|
+
# section "Recent Posts" do
|
23
|
+
# div do
|
24
|
+
# render 'recent_posts' # => this will render /app/views/admin/dashboard/_recent_posts.html.erb
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# == Section Ordering
|
29
|
+
# The dashboard sections are ordered by a given priority from top left to
|
30
|
+
# bottom right. The default priority is 10. By giving a section numerically lower
|
31
|
+
# priority it will be sorted higher. For example:
|
32
|
+
#
|
33
|
+
# section "Recent Posts", :priority => 10
|
34
|
+
# section "Recent User", :priority => 1
|
35
|
+
#
|
36
|
+
# Will render the "Recent Users" then the "Recent Posts" sections on the dashboard.
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require active_admin/base
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require jquery
|
8
|
+
//= require jquery_ujs
|
9
|
+
//= require rich
|
@@ -0,0 +1 @@
|
|
1
|
+
//=require rich/base
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require_tree .
|
7
|
+
*/
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
This file defines the default set of CSS styles available in the Rich editor
|
3
|
+
*/
|
4
|
+
|
5
|
+
p.caption {
|
6
|
+
font-style: italic;
|
7
|
+
color: grey;
|
8
|
+
}
|
9
|
+
|
10
|
+
span.highlight {
|
11
|
+
background: yellow;
|
12
|
+
}
|
13
|
+
|
14
|
+
img.left {
|
15
|
+
float: left;
|
16
|
+
}
|
17
|
+
|
18
|
+
img.right {
|
19
|
+
float: right;
|
20
|
+
}
|
@@ -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,83 @@
|
|
1
|
+
class PostsController < ApplicationController
|
2
|
+
# GET /posts
|
3
|
+
# GET /posts.json
|
4
|
+
def index
|
5
|
+
@posts = Post.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render :json => @posts }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /posts/1
|
14
|
+
# GET /posts/1.json
|
15
|
+
def show
|
16
|
+
@post = Post.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render :json => @post }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /posts/new
|
25
|
+
# GET /posts/new.json
|
26
|
+
def new
|
27
|
+
@post = Post.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render :json => @post }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /posts/1/edit
|
36
|
+
def edit
|
37
|
+
@post = Post.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /posts
|
41
|
+
# POST /posts.json
|
42
|
+
def create
|
43
|
+
@post = Post.new(params[:post])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @post.save
|
47
|
+
format.html { redirect_to @post, :notice => 'Post was successfully created.' }
|
48
|
+
format.json { render :json => @post, :status => :created, :location => @post }
|
49
|
+
else
|
50
|
+
format.html { render :action => "new" }
|
51
|
+
format.json { render :json => @post.errors, :status => :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /posts/1
|
57
|
+
# PUT /posts/1.json
|
58
|
+
def update
|
59
|
+
@post = Post.find(params[:id])
|
60
|
+
|
61
|
+
respond_to do |format|
|
62
|
+
if @post.update_attributes(params[:post])
|
63
|
+
format.html { redirect_to @post, :notice => 'Post was successfully updated.' }
|
64
|
+
format.json { head :ok }
|
65
|
+
else
|
66
|
+
format.html { render :action => "edit" }
|
67
|
+
format.json { render :json => @post.errors, :status => :unprocessable_entity }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# DELETE /posts/1
|
73
|
+
# DELETE /posts/1.json
|
74
|
+
def destroy
|
75
|
+
@post = Post.find(params[:id])
|
76
|
+
@post.destroy
|
77
|
+
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to posts_url }
|
80
|
+
format.json { head :ok }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|