ueditor_rails 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.markdown +36 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/ueditor_rails/config.js.erb +207 -0
- data/app/assets/javascripts/ueditor_rails/init.js +12 -0
- data/app/controllers/ueditor_rails/application_controller.rb +5 -0
- data/app/controllers/ueditor_rails/dialogs_controller.rb +13 -0
- data/app/controllers/ueditor_rails/libs_controller.rb +20 -0
- data/app/helpers/ueditor_rails/application_helper.rb +4 -0
- data/app/views/ueditor_rails/dialogs/attachment.html.erb +128 -0
- data/app/views/ueditor_rails/dialogs/image.html.erb +205 -0
- data/config/routes.rb +11 -0
- data/lib/generators/ueditor_rails/USAGE +8 -0
- data/lib/generators/ueditor_rails/install_generator.rb +15 -0
- data/lib/generators/ueditor_rails/templates/ueditor_config.js.erb +204 -0
- data/lib/tasks/ueditor_rails_tasks.rake +4 -0
- data/lib/ueditor_rails.rb +25 -0
- data/lib/ueditor_rails/engine.rb +17 -0
- data/lib/ueditor_rails/helpers/form_builder.rb +11 -0
- data/lib/ueditor_rails/helpers/form_helper.rb +26 -0
- data/lib/ueditor_rails/helpers/view_helper.rb +21 -0
- data/lib/ueditor_rails/util.rb +32 -0
- data/lib/ueditor_rails/version.rb +3 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +17 -0
- data/test/dummy/app/assets/javascripts/posts.js +2 -0
- data/test/dummy/app/assets/javascripts/ueditor_config.js.erb +201 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/posts.css +4 -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/post.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/posts/_form.html.erb +25 -0
- data/test/dummy/app/views/posts/edit.html.erb +6 -0
- data/test/dummy/app/views/posts/index.html.erb +29 -0
- data/test/dummy/app/views/posts/new.html.erb +5 -0
- data/test/dummy/app/views/posts/show.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -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/en.yml +5 -0
- data/test/dummy/config/routes.rb +8 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130327173045_create_posts.rb +10 -0
- data/test/dummy/db/schema.rb +23 -0
- data/test/dummy/log/development.log +12037 -0
- data/test/dummy/log/production.log +7 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/posts.yml +9 -0
- data/test/dummy/test/functional/posts_controller_test.rb +49 -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/BDF/630/sprockets%2F5614511158c119e0843a3290422f62c4 +0 -0
- data/test/dummy/tmp/cache/assets/C2B/2B0/sprockets%2F6197f74231bf6577350613931d3f68d2 +0 -0
- data/test/dummy/tmp/cache/assets/C45/6F0/sprockets%2F8d0029260fa306414726778ccc2114f5 +0 -0
- data/test/dummy/tmp/cache/assets/C54/700/sprockets%2Ff3a117b56f12646d477370198ef50526 +0 -0
- data/test/dummy/tmp/cache/assets/C5C/D10/sprockets%2F46f8f094709b1722d4b908743489c22b +0 -0
- data/test/dummy/tmp/cache/assets/C60/B40/sprockets%2F54d01774a089b4d6669dee7038085556 +0 -0
- data/test/dummy/tmp/cache/assets/C6D/9D0/sprockets%2F0c0b92de372485111abd31809d680064 +0 -0
- data/test/dummy/tmp/cache/assets/C72/EA0/sprockets%2Fe282c06e62457331c3b56d36c320615d +0 -0
- data/test/dummy/tmp/cache/assets/C7A/940/sprockets%2F5799f5e28166414991897d6f9127d5fc +0 -0
- data/test/dummy/tmp/cache/assets/C7A/9C0/sprockets%2F492d15f65b17b6cfa0b7351378602147 +0 -0
- data/test/dummy/tmp/cache/assets/C84/AA0/sprockets%2F98093181296cc04f03f7580efb00c973 +0 -0
- data/test/dummy/tmp/cache/assets/C89/310/sprockets%2Fd1d06f948d748a7068c0e146154d8229 +0 -0
- data/test/dummy/tmp/cache/assets/C8A/8E0/sprockets%2F646396c661345dcc625cc575bf061577 +0 -0
- data/test/dummy/tmp/cache/assets/C8C/B80/sprockets%2F371bf96e99717688ed7313a0c53f4212 +0 -0
- data/test/dummy/tmp/cache/assets/C99/A70/sprockets%2F015fa15293ee9b3456140aa71fa44160 +0 -0
- data/test/dummy/tmp/cache/assets/CA7/4B0/sprockets%2Fa126b67ca393a693b7520818dc36c404 +0 -0
- data/test/dummy/tmp/cache/assets/CAC/3D0/sprockets%2F0839a13780ffe1bba453564492f04f70 +0 -0
- data/test/dummy/tmp/cache/assets/CAC/F50/sprockets%2Fd2c5808102c08c0f1626871aa59d796b +0 -0
- data/test/dummy/tmp/cache/assets/CC4/520/sprockets%2F985cf9f9b78b2869f70270770b134c3a +0 -0
- data/test/dummy/tmp/cache/assets/CC4/9A0/sprockets%2F2479c7a9ae4286405682d75dcb378d48 +0 -0
- data/test/dummy/tmp/cache/assets/CC7/220/sprockets%2Fd066c004d1fd26ae76a61303a7a18145 +0 -0
- data/test/dummy/tmp/cache/assets/CD1/E30/sprockets%2F07e2a3e7922a96e0bf582b3ed2160214 +0 -0
- data/test/dummy/tmp/cache/assets/CD4/5E0/sprockets%2F9bb402071b005bd61ca675149f1bf697 +0 -0
- data/test/dummy/tmp/cache/assets/CD5/B70/sprockets%2F416150dc3ac35079c94273cc46e90aa6 +0 -0
- data/test/dummy/tmp/cache/assets/CD6/630/sprockets%2Fe020a12eeaf2399ab542086e57d74056 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/4D0/sprockets%2Fa24d9ba34e6c16d99323053382f150df +0 -0
- data/test/dummy/tmp/cache/assets/CDC/F80/sprockets%2F7bd94371d531b3f85d02c7a9427841aa +0 -0
- data/test/dummy/tmp/cache/assets/CDE/4B0/sprockets%2F342f1d7b7ca0569074f9128b9bda7125 +0 -0
- data/test/dummy/tmp/cache/assets/CDE/550/sprockets%2F6a69b27076b361fd10f64874f2c1b46b +0 -0
- data/test/dummy/tmp/cache/assets/CDF/860/sprockets%2F8a563174551315a923fc9a78d22fcb7a +0 -0
- data/test/dummy/tmp/cache/assets/CE1/3B0/sprockets%2F11a824a4c96529c2912f753ecf8b506d +0 -0
- data/test/dummy/tmp/cache/assets/CE3/A20/sprockets%2F9154bb14d747165e7f19d8161d4d2e4b +0 -0
- data/test/dummy/tmp/cache/assets/CE4/5E0/sprockets%2F1d31011d7c1599edc54d31d597f856e3 +0 -0
- data/test/dummy/tmp/cache/assets/CE5/8C0/sprockets%2F5abcadff90738332520786578cf1733c +0 -0
- data/test/dummy/tmp/cache/assets/CE6/070/sprockets%2F85808d5f0458f045dea0e9036d7f53c1 +0 -0
- data/test/dummy/tmp/cache/assets/CE7/DB0/sprockets%2F8e9537e225fe8d0a543dbf320c949325 +0 -0
- data/test/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/CF0/C10/sprockets%2Fba2886d474f933456975a52ed2f1c66d +0 -0
- data/test/dummy/tmp/cache/assets/CF4/050/sprockets%2F07e64101425f48db3e2b5a4a61d02cc3 +0 -0
- data/test/dummy/tmp/cache/assets/CF6/2D0/sprockets%2Ffeef88a45781660a21645e8fbe276297 +0 -0
- data/test/dummy/tmp/cache/assets/CF9/3D0/sprockets%2Fd3a2bd3092fe687b0687869fe956493b +0 -0
- data/test/dummy/tmp/cache/assets/CF9/970/sprockets%2Fca43c206a5f90a0505194d56e635a1da +0 -0
- data/test/dummy/tmp/cache/assets/D04/9C0/sprockets%2F826e5acfd685ead033361021fa9723c1 +0 -0
- data/test/dummy/tmp/cache/assets/D07/000/sprockets%2F31610287c7cc1435a7c99f3e132abdc7 +0 -0
- data/test/dummy/tmp/cache/assets/D07/BB0/sprockets%2Ff7bbd33ae141463d938437050ac3d5d8 +0 -0
- data/test/dummy/tmp/cache/assets/D09/590/sprockets%2F0f074320e9adb54e1f4f69cb6392e420 +0 -0
- data/test/dummy/tmp/cache/assets/D0A/5D0/sprockets%2F131bc060fc89d617bc9c9571d2537ab3 +0 -0
- data/test/dummy/tmp/cache/assets/D10/3A0/sprockets%2F158f48165ddb9cfa4518a02159a4ec19 +0 -0
- data/test/dummy/tmp/cache/assets/D11/3D0/sprockets%2F95e3f52aa53952013be443db8d395c7e +0 -0
- data/test/dummy/tmp/cache/assets/D11/A80/sprockets%2Fc2fb6624be686158b2401b4d4a885e7d +0 -0
- data/test/dummy/tmp/cache/assets/D11/E20/sprockets%2Fbdd46b652f74de0b46055c41948c2d84 +0 -0
- data/test/dummy/tmp/cache/assets/D12/0B0/sprockets%2F671f91009e9f5a07db9c719430ed02cf +0 -0
- data/test/dummy/tmp/cache/assets/D12/F90/sprockets%2F397710de23c0f7b3f6cc3ad8635f7812 +0 -0
- data/test/dummy/tmp/cache/assets/D1A/310/sprockets%2F5384ad85f52d3272dbc64d46ef3876a4 +0 -0
- data/test/dummy/tmp/cache/assets/D1B/EA0/sprockets%2F5110d4ac9e35fe6749c40d2f99bf9191 +0 -0
- data/test/dummy/tmp/cache/assets/D1C/910/sprockets%2F0fb26515c30c3b1656a3f4410afb1d2b +0 -0
- data/test/dummy/tmp/cache/assets/D1C/C30/sprockets%2F6c41af8340e06f9fd28928991fea3c42 +0 -0
- data/test/dummy/tmp/cache/assets/D21/A00/sprockets%2F3207bde101a4d88963b9df6e869e267f +0 -0
- data/test/dummy/tmp/cache/assets/D22/DA0/sprockets%2F8a5776bdd0a1e1690c2e7f8bd5798908 +0 -0
- data/test/dummy/tmp/cache/assets/D25/7D0/sprockets%2F560b2b61bc3cb739ccb701c2b657311c +0 -0
- data/test/dummy/tmp/cache/assets/D28/A40/sprockets%2Fbba251ea4d111ae85160c127f4ab8756 +0 -0
- data/test/dummy/tmp/cache/assets/D2A/A10/sprockets%2F0459c22963b25c20faa51ac6dad617d2 +0 -0
- data/test/dummy/tmp/cache/assets/D2A/B10/sprockets%2F84f48544cf0b378928b7d6f59e392ccc +0 -0
- data/test/dummy/tmp/cache/assets/D31/800/sprockets%2F1e3ed31b0bc5875c2b1557f20b169ad7 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A50/sprockets%2F11b9b104e2626ae5b506fd28b0b68af8 +0 -0
- data/test/dummy/tmp/cache/assets/D38/840/sprockets%2F12b5bf92ed12d821b47e92fa804855aa +0 -0
- data/test/dummy/tmp/cache/assets/D39/CF0/sprockets%2F8571123a9e73ccd7c112e35e39aca6a7 +0 -0
- data/test/dummy/tmp/cache/assets/D3A/F30/sprockets%2F15a0362cc0f96f824d2e192dc23c4fd9 +0 -0
- data/test/dummy/tmp/cache/assets/D3C/170/sprockets%2F916c8d4a702e456a3963151dcfd8bfa0 +0 -0
- data/test/dummy/tmp/cache/assets/D3C/9C0/sprockets%2Fab97a93e34581b3aa9fd71ac1f384019 +0 -0
- data/test/dummy/tmp/cache/assets/D3F/6C0/sprockets%2Ffb767a73ef0afcc0165723ec081903f9 +0 -0
- data/test/dummy/tmp/cache/assets/D3F/C90/sprockets%2F9da014b6c3ba9a861d11299abe96d476 +0 -0
- data/test/dummy/tmp/cache/assets/D3F/DC0/sprockets%2F82ef6bb4f2ec0237011ff08c692e429f +0 -0
- data/test/dummy/tmp/cache/assets/D41/4D0/sprockets%2F4b5e8493a27349a2c6b62acf462b58dd +0 -0
- data/test/dummy/tmp/cache/assets/D42/5C0/sprockets%2F054be4bebb7d59a4a747b3464e91f329 +0 -0
- data/test/dummy/tmp/cache/assets/D42/7C0/sprockets%2Ffcae5059b63412f6b286ddf1715e4b94 +0 -0
- data/test/dummy/tmp/cache/assets/D43/CF0/sprockets%2Fa8f40f4e4b38284009db82d3ee59a3c7 +0 -0
- data/test/dummy/tmp/cache/assets/D43/FB0/sprockets%2F400daf4968c6654111b9a7fd0a5f96fd +0 -0
- data/test/dummy/tmp/cache/assets/D44/400/sprockets%2F9f62068ab2f5e6f245e6090cbcda5845 +0 -0
- data/test/dummy/tmp/cache/assets/D45/A50/sprockets%2Fe86f7863ca9e1239c3a0cc78cc81209a +0 -0
- data/test/dummy/tmp/cache/assets/D4A/400/sprockets%2F9d22629fae12423fde39a8bc663796ea +0 -0
- data/test/dummy/tmp/cache/assets/D4B/710/sprockets%2Fe191069e1e69dbe5206ce3893d0fb6e8 +0 -0
- data/test/dummy/tmp/cache/assets/D4C/370/sprockets%2F9f8871ddc326d27fb2444e2b9e630c8e +0 -0
- data/test/dummy/tmp/cache/assets/D4C/730/sprockets%2F63a49b3364c4469aefe69ade635508fb +0 -0
- data/test/dummy/tmp/cache/assets/D4D/060/sprockets%2Fdf8071fd9e383d72ba1f17b5d5e98516 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D51/190/sprockets%2Fbde53d033a467778f7e5d2095d78fb4f +0 -0
- data/test/dummy/tmp/cache/assets/D52/080/sprockets%2Fbdb460a11eea94fd16071a7ea1f35210 +0 -0
- data/test/dummy/tmp/cache/assets/D52/890/sprockets%2Fbdd9c7f2d6d70b352f318578941ef9a7 +0 -0
- data/test/dummy/tmp/cache/assets/D53/E70/sprockets%2F856560debef90857ce907e1ae35fd079 +0 -0
- data/test/dummy/tmp/cache/assets/D57/580/sprockets%2Fc693d77ad959894ad2460c9eeb958a2a +0 -0
- data/test/dummy/tmp/cache/assets/D5A/630/sprockets%2F4ac0ab0666b16174df72ccb05c742ad7 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D5B/6E0/sprockets%2F01f2ef3b2303b7c39612f0755dcdda3c +0 -0
- data/test/dummy/tmp/cache/assets/D5E/C40/sprockets%2F3dd04e28364ca3b9aff00660e3028caf +0 -0
- data/test/dummy/tmp/cache/assets/D5E/E70/sprockets%2F85bf39edf8bd33f53b98060c75979cc9 +0 -0
- data/test/dummy/tmp/cache/assets/D63/E30/sprockets%2F8bb9b1b4042fa39f01e8b7a2d0388ca5 +0 -0
- data/test/dummy/tmp/cache/assets/D68/E70/sprockets%2F0d2ae672147c167b2c2f42d8cbe8c7b5 +0 -0
- data/test/dummy/tmp/cache/assets/D69/B40/sprockets%2F60528372c4d9ea38ee60b3fde0d0ba84 +0 -0
- data/test/dummy/tmp/cache/assets/D69/C00/sprockets%2Fb71f8a5e0942ae7d4b2b814238ff2e0c +0 -0
- data/test/dummy/tmp/cache/assets/D6A/660/sprockets%2F498dedb0ef6a80d452a4b07782d6b1a4 +0 -0
- data/test/dummy/tmp/cache/assets/D6C/0A0/sprockets%2F21ec0bf9b2152153f3942fcf8eba9f09 +0 -0
- data/test/dummy/tmp/cache/assets/D6D/570/sprockets%2Fb37f4aac840a59d278d8c57a338ccd20 +0 -0
- data/test/dummy/tmp/cache/assets/D6E/920/sprockets%2F9ebedf09390f21a580b35c937e24cb1f +0 -0
- data/test/dummy/tmp/cache/assets/D6E/AD0/sprockets%2F1dc84fc453b1ddb966271ae54d6b54d5 +0 -0
- data/test/dummy/tmp/cache/assets/D6E/F20/sprockets%2F2bb516def8c3a08b7174648da9dd40f3 +0 -0
- data/test/dummy/tmp/cache/assets/D70/B70/sprockets%2F6ebaed371aa715b95667e416378cba4d +0 -0
- data/test/dummy/tmp/cache/assets/D71/740/sprockets%2F1db90d964be0b67d1b79f5a5e5391ce1 +0 -0
- data/test/dummy/tmp/cache/assets/D75/860/sprockets%2Fe8fa1c4ebb9335f1fa16379c842fe750 +0 -0
- data/test/dummy/tmp/cache/assets/D75/EF0/sprockets%2F1d96674c67d405c6b50cddfd3b6c3e39 +0 -0
- data/test/dummy/tmp/cache/assets/D78/010/sprockets%2Faef73289dfbc84248a6aa0183feb8772 +0 -0
- data/test/dummy/tmp/cache/assets/D78/550/sprockets%2F0331b677d4885ee27b9c418f4fedaea4 +0 -0
- data/test/dummy/tmp/cache/assets/D7B/B50/sprockets%2F4685b399157deeddba90ea877df710b2 +0 -0
- data/test/dummy/tmp/cache/assets/D7C/2E0/sprockets%2Fbf5c619eecd922259e6b45e2f8e02b86 +0 -0
- data/test/dummy/tmp/cache/assets/D7C/8A0/sprockets%2Fcaf9df030f62b864de4e3944a9d477d4 +0 -0
- data/test/dummy/tmp/cache/assets/D7C/DE0/sprockets%2F4f4705ac7f29f60e99355fb3abf0af78 +0 -0
- data/test/dummy/tmp/cache/assets/D7D/510/sprockets%2Fee497e95e73cc27afe781b6bb90b5424 +0 -0
- data/test/dummy/tmp/cache/assets/D81/F00/sprockets%2Fac659dac860cb3646df9806f668ac39d +0 -0
- data/test/dummy/tmp/cache/assets/D86/620/sprockets%2F01395e5b7993cede6976336b9cfa9bbe +0 -0
- data/test/dummy/tmp/cache/assets/D86/6F0/sprockets%2F1526f063df1a7cc0e4fa0460cb6ba44d +0 -0
- data/test/dummy/tmp/cache/assets/D87/BB0/sprockets%2Fcd4ae785e2fdf9282a2f36c9543995de +0 -0
- data/test/dummy/tmp/cache/assets/D88/E00/sprockets%2Ff5b3e902fad33c44ff6a0e9db20501a0 +0 -0
- data/test/dummy/tmp/cache/assets/D8C/6D0/sprockets%2F0ead4d15ad8a9d31d33a14dc191da657 +0 -0
- data/test/dummy/tmp/cache/assets/D92/1B0/sprockets%2F1fa31cfb668a21f6d4bb0f6b2536e34e +0 -0
- data/test/dummy/tmp/cache/assets/D98/C50/sprockets%2Fcfa37bd769d589c2da1d3116a6db0b90 +0 -0
- data/test/dummy/tmp/cache/assets/D9C/790/sprockets%2Fc1bb1797c7e487ea4a940cfd3423da5c +0 -0
- data/test/dummy/tmp/cache/assets/D9C/CD0/sprockets%2Fc85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/test/dummy/tmp/cache/assets/D9D/0A0/sprockets%2Fcf40aaefd8ac6ea638790e4a2d367541 +0 -0
- data/test/dummy/tmp/cache/assets/D9D/930/sprockets%2F1229f6eab13c794c3ce94ad629d3bbb6 +0 -0
- data/test/dummy/tmp/cache/assets/D9D/CB0/sprockets%2F5ffa3729fab74e9b171334f933bbcd2a +0 -0
- data/test/dummy/tmp/cache/assets/D9D/D30/sprockets%2F7c202fe7098da9201fe66d37cc60eadd +0 -0
- data/test/dummy/tmp/cache/assets/D9E/1F0/sprockets%2Fb913f5de5b049aa041b8ad77ca576b9f +0 -0
- data/test/dummy/tmp/cache/assets/DA0/870/sprockets%2F92b550d7b5e47436b5d1db5b47daec8e +0 -0
- data/test/dummy/tmp/cache/assets/DA0/C70/sprockets%2Fd04dbacd60d1e2be636849d485b8d75b +0 -0
- data/test/dummy/tmp/cache/assets/DA1/C50/sprockets%2F2f73ec238cc2edfeecf185428d06435b +0 -0
- data/test/dummy/tmp/cache/assets/DA2/9C0/sprockets%2F5d2fe3ca5cf7ad9e2c5939a291f214a7 +0 -0
- data/test/dummy/tmp/cache/assets/DA4/390/sprockets%2F5cdc49a8aad8844bdc5b0a55b28666d8 +0 -0
- data/test/dummy/tmp/cache/assets/DA5/850/sprockets%2Ffedd0769ffb447639ab123e2db9a3c29 +0 -0
- data/test/dummy/tmp/cache/assets/DAE/160/sprockets%2F6cec68e7a5a848c93ade0e89e7c3501e +0 -0
- data/test/dummy/tmp/cache/assets/DAE/260/sprockets%2Fce5fe9569d7e18ea8a136cac298e3f12 +0 -0
- data/test/dummy/tmp/cache/assets/DB0/DB0/sprockets%2Fc39fd8a8e5ea5f6a1636c4707c9ef4a7 +0 -0
- data/test/dummy/tmp/cache/assets/DB3/C60/sprockets%2F0b0030d24fc428acb4c74c3edd0b94eb +0 -0
- data/test/dummy/tmp/cache/assets/DB8/F30/sprockets%2F91c7bb3a08ba6cd159d4b02313deaa7d +0 -0
- data/test/dummy/tmp/cache/assets/DC1/E50/sprockets%2F92af4d6d0bafa3ab109c5856ed14e34b +0 -0
- data/test/dummy/tmp/cache/assets/DC7/A30/sprockets%2Ff1eccc7f669f63b03bbb55750b50edc1 +0 -0
- data/test/dummy/tmp/cache/assets/DC8/B40/sprockets%2F9af180717bb0bacb7e27ce5d53fd1d74 +0 -0
- data/test/dummy/tmp/cache/assets/DC9/540/sprockets%2F608262feadebbf52a6d81168ab76b0fd +0 -0
- data/test/dummy/tmp/cache/assets/DC9/C10/sprockets%2Fa94c69d0007efe2ef0dbec32e82c942a +0 -0
- data/test/dummy/tmp/cache/assets/DCB/790/sprockets%2Ffa6e0afb98324ab70f6f2add80ab9546 +0 -0
- data/test/dummy/tmp/cache/assets/DCE/F10/sprockets%2Fa10ef3bf2ea4459a641b3fedfa78785b +0 -0
- data/test/dummy/tmp/cache/assets/DD5/A40/sprockets%2F773b57e8cbaba49a2858c9acd5ed930a +0 -0
- data/test/dummy/tmp/cache/assets/DD7/600/sprockets%2F0cec2cc545e1d3bd889d195f68dea4b7 +0 -0
- data/test/dummy/tmp/cache/assets/DDA/AC0/sprockets%2F8cce49d0b8e0a2de9cbc08fc2279865f +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DDE/500/sprockets%2Fcff617ff0b83b5a38c991e1a2bff589f +0 -0
- data/test/dummy/tmp/cache/assets/DE0/790/sprockets%2Fe508b8ce9b8ef49ab69cf5bbc3d09680 +0 -0
- data/test/dummy/tmp/cache/assets/DFA/3D0/sprockets%2F969dbba9b0b881d0fe3ead044ce6b6a4 +0 -0
- data/test/dummy/tmp/cache/assets/DFD/610/sprockets%2F5fa40e7fbec251546395f4adbb7aecf4 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E0C/D50/sprockets%2Fdd746cdf1870fea2d4fef3db2c96c694 +0 -0
- data/test/dummy/tmp/cache/assets/E0E/0D0/sprockets%2F9fab330147d57668f6aff14ccefbfe9e +0 -0
- data/test/dummy/tmp/cache/assets/E12/430/sprockets%2F83cde7e665d636ba5b5f98d2dec7fdc3 +0 -0
- data/test/dummy/tmp/cache/assets/E23/590/sprockets%2F467d2a58abfbf81d715fdacd6ac3b2b2 +0 -0
- data/test/dummy/tmp/cache/assets/E30/F10/sprockets%2Feb96e11c82be8b736df1fcccbcaa8529 +0 -0
- data/test/dummy/tmp/cache/assets/E33/680/sprockets%2F1c62bdad5d5cc668bc73eeadc944c97c +0 -0
- data/test/dummy/tmp/cache/assets/E34/9F0/sprockets%2F2dbdbaffe3f466f85cee37cee4331f34 +0 -0
- data/test/dummy/tmp/cache/assets/E44/410/sprockets%2Fcfdd750d7776be51e48bfefe3cbc99e4 +0 -0
- data/test/dummy/tmp/cache/assets/E44/560/sprockets%2Fd728f19f2f5dfac9f555babd49ebb89d +0 -0
- data/test/dummy/tmp/cache/assets/E6C/C10/sprockets%2F837ca65eade4def9af9b6ada7cb394f4 +0 -0
- data/test/dummy/tmp/cache/assets/E86/510/sprockets%2F6de0e7ce2c9b7e2c7ced4bcfac2b2d06 +0 -0
- data/test/functional/ueditor_rails/dialogs_controller_test.rb +16 -0
- data/test/functional/ueditor_rails/libs_controller_test.rb +21 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/ueditor_rails_test.rb +7 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.css.erb +130 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/attachment.html.erb +128 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/callbacks.js +166 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/attachment/fileTypeMaps.js +29 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.css.erb +44 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.html.erb +54 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.js +186 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/help/help.css +7 -0
- data/vendor/assets/javascripts/ueditor/dialogs/help/help.html.erb +82 -0
- data/vendor/assets/javascripts/ueditor/dialogs/help/help.js +54 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/image.css.erb +74 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/image.html.erb +204 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/image.js +712 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/imageUploader.swf +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/images/center_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/images/left_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/images/none_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/image/images/right_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/internal.js +79 -0
- data/vendor/assets/javascripts/ueditor/dialogs/link/link.html.erb +126 -0
- data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.html.erb +21 -0
- data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.js +56 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/dragicon.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.css +75 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.html.erb +56 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.js +182 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittd.html.erb +50 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittip.html.erb +33 -0
- data/vendor/assets/javascripts/ueditor/dialogs/tangram.js +1238 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/center_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/left_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/none_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/right_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/video.css +59 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/video.html.erb +67 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/video.js +402 -0
- data/vendor/assets/javascripts/ueditor/editor_all.js.erb +17707 -0
- data/vendor/assets/javascripts/ueditor/editor_config.js +238 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/copy.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/imglabel.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/localimage.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/music.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/upload.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/zh-cn.js +492 -0
- data/vendor/assets/javascripts/ueditor/themes/default/css/ueditor.css +1582 -0
- data/vendor/assets/javascripts/ueditor/themes/default/dialogbase.css.erb +100 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/anchor.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/arrow.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/button-bg.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cancelbutton.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_h.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_h.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_v.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/cursor_v.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/dialog-title-bg.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/filescan.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/highlighted.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/icons-all.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/icons.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/icons.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/lock.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/neweditor-tab-bg.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/pagebreak.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/scale.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/spacer.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/sparator_v.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/toolbar_bg.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/unhighlighted.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/upload.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/videologo.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/word.gif +0 -0
- data/vendor/assets/javascripts/ueditor/themes/default/images/wordpaste.png +0 -0
- data/vendor/assets/javascripts/ueditor/themes/iframe.css +1 -0
- data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.css +104 -0
- data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.js +3581 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/fileprogress.js +215 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.cookies.js +53 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.js +1132 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.proxy.js +96 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.queue.js +98 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.speed.js +346 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.swf +0 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload_fp9.swf +0 -0
- data/vendor/assets/javascripts/ueditor/uparse.js +358 -0
- metadata +674 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
require "ueditor_rails/engine"
|
2
|
+
|
3
|
+
module UeditorRails
|
4
|
+
autoload :Util, 'ueditor_rails/util'
|
5
|
+
|
6
|
+
module Helpers
|
7
|
+
autoload :ViewHelper, 'ueditor_rails/helpers/view_helper'
|
8
|
+
autoload :FormHelper, 'ueditor_rails/helpers/form_helper'
|
9
|
+
autoload :FormBuilder, 'ueditor_rails/helpers/form_builder'
|
10
|
+
end
|
11
|
+
|
12
|
+
class<< self
|
13
|
+
def root_path
|
14
|
+
@root_path ||= Pathname.new(File.dirname(File.expand_path('../', __FILE__)))
|
15
|
+
end
|
16
|
+
|
17
|
+
def assets
|
18
|
+
@assets ||= Util.select_assets << 'ckeditor/init.js'
|
19
|
+
end
|
20
|
+
|
21
|
+
def ueditor_base_path
|
22
|
+
@ueditor_base_path ||= self.root_path.join('vendor/assets/javascripts/ueditor')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module UeditorRails
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace UeditorRails
|
4
|
+
|
5
|
+
initializer "ueditor_rails.assets_precompile", :group => :all do |app|
|
6
|
+
app.config.assets.precompile += UeditorRails.assets
|
7
|
+
end
|
8
|
+
|
9
|
+
initializer "ueditor_rails.helpers" do
|
10
|
+
ActiveSupport.on_load :action_view do
|
11
|
+
ActionView::Base.send :include, UeditorRails::Helpers::ViewHelper
|
12
|
+
ActionView::Base.send :include, UeditorRails::Helpers::FormHelper
|
13
|
+
ActionView::Helpers::FormBuilder.send :include, UeditorRails::Helpers::FormBuilder
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module UeditorRails
|
2
|
+
module Helpers
|
3
|
+
module FormHelper
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
include ActionView::Helpers::TagHelper
|
7
|
+
include ActionView::Helpers::JavaScriptHelper
|
8
|
+
|
9
|
+
def ueditor_text(object_name, method = nil, options = {})
|
10
|
+
instance_tag = ActionView::Base::InstanceTag.new(object_name, method, self, options.delete(:object))
|
11
|
+
instance_tag.send(:add_default_name_and_id, options) if options[:id].blank?
|
12
|
+
|
13
|
+
element_id = options.delete('id')
|
14
|
+
ue_tag_attributes = {:type => 'text/plain', :id => element_id, :name => options.delete('name')}
|
15
|
+
options[:initialFrameWidth] = options.delete(:width) unless options[:width].blank?
|
16
|
+
options[:initialFrameHeight] = options.delete(:height) unless options[:height].blank?
|
17
|
+
|
18
|
+
output_buffer = ActiveSupport::SafeBuffer.new
|
19
|
+
#output_buffer << instance_tag.to_content_tag(:script, ue_tag_attributes)
|
20
|
+
output_buffer << instance_tag.to_text_area_tag(ue_tag_attributes)
|
21
|
+
output_buffer << javascript_tag {Util.js_replace(element_id, options.stringify_keys)}
|
22
|
+
output_buffer
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module UeditorRails
|
2
|
+
module Helpers
|
3
|
+
module ViewHelper
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def ueditor_text_tag(name, content = nil, options = {})
|
7
|
+
element_id = sanitize_to_id(options.delete(:id) || name)
|
8
|
+
input_html = { :id => element_id, :name => name, :type => 'text/plain' }
|
9
|
+
|
10
|
+
options['initialFrameWidth'] = options.delete(:width) unless options[:width].blank?
|
11
|
+
options['initialFrameHeight'] = options.delete(:height) unless options[:height].blank?
|
12
|
+
|
13
|
+
output_buffer = ActiveSupport::SafeBuffer.new
|
14
|
+
#output_buffer << content_tag(:script, content, input_html.stringify_keys)
|
15
|
+
output_buffer << content_tag(:script, content, input_html.stringify_keys)
|
16
|
+
output_buffer << javascript_tag { Util.js_replace(element_id, options.stringify_keys) }
|
17
|
+
output_buffer
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'active_support/json/encoding'
|
3
|
+
|
4
|
+
module UeditorRails
|
5
|
+
module Util
|
6
|
+
class << self
|
7
|
+
def js_replace(dom_id, options = nil)
|
8
|
+
js_options = (options && !options.keys.empty?)? ActiveSupport::JSON.encode(options) : '{}'
|
9
|
+
js = <<-JS
|
10
|
+
if(window.UEDITOR_FIELDS === undefined) {
|
11
|
+
window.UEDITOR_FIELDS = [];
|
12
|
+
}
|
13
|
+
window.UEDITOR_FIELDS.push({id: '#{dom_id}', opt: #{js_options}})
|
14
|
+
JS
|
15
|
+
js.html_safe
|
16
|
+
end
|
17
|
+
|
18
|
+
def select_assets
|
19
|
+
assets = []
|
20
|
+
|
21
|
+
Dir[UeditorRails.root_path.join('vendor/assets/javascripts/**/**.*')].each do |path|
|
22
|
+
ext = File.extname(path)
|
23
|
+
path = path[0..-ext.length-1] if %w(.scss .sass .coffee .erb).include? ext
|
24
|
+
|
25
|
+
assets << Pathname.new(path).relative_path_from(UeditorRails.root_path.join('vendor/assets/javascripts'))
|
26
|
+
end
|
27
|
+
|
28
|
+
assets
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,261 @@
|
|
1
|
+
== Welcome to Rails
|
2
|
+
|
3
|
+
Rails is a web-application framework that includes everything needed to create
|
4
|
+
database-backed web applications according to the Model-View-Control pattern.
|
5
|
+
|
6
|
+
This pattern splits the view (also called the presentation) into "dumb"
|
7
|
+
templates that are primarily responsible for inserting pre-built data in between
|
8
|
+
HTML tags. The model contains the "smart" domain objects (such as Account,
|
9
|
+
Product, Person, Post) that holds all the business logic and knows how to
|
10
|
+
persist themselves to a database. The controller handles the incoming requests
|
11
|
+
(such as Save New Account, Update Product, Show Post) by manipulating the model
|
12
|
+
and directing data to the view.
|
13
|
+
|
14
|
+
In Rails, the model is handled by what's called an object-relational mapping
|
15
|
+
layer entitled Active Record. This layer allows you to present the data from
|
16
|
+
database rows as objects and embellish these data objects with business logic
|
17
|
+
methods. You can read more about Active Record in
|
18
|
+
link:files/vendor/rails/activerecord/README.html.
|
19
|
+
|
20
|
+
The controller and view are handled by the Action Pack, which handles both
|
21
|
+
layers by its two parts: Action View and Action Controller. These two layers
|
22
|
+
are bundled in a single package due to their heavy interdependence. This is
|
23
|
+
unlike the relationship between the Active Record and Action Pack that is much
|
24
|
+
more separate. Each of these packages can be used independently outside of
|
25
|
+
Rails. You can read more about Action Pack in
|
26
|
+
link:files/vendor/rails/actionpack/README.html.
|
27
|
+
|
28
|
+
|
29
|
+
== Getting Started
|
30
|
+
|
31
|
+
1. At the command prompt, create a new Rails application:
|
32
|
+
<tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
|
33
|
+
|
34
|
+
2. Change directory to <tt>myapp</tt> and start the web server:
|
35
|
+
<tt>cd myapp; rails server</tt> (run with --help for options)
|
36
|
+
|
37
|
+
3. Go to http://localhost:3000/ and you'll see:
|
38
|
+
"Welcome aboard: You're riding Ruby on Rails!"
|
39
|
+
|
40
|
+
4. Follow the guidelines to start developing your application. You can find
|
41
|
+
the following resources handy:
|
42
|
+
|
43
|
+
* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
|
44
|
+
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
45
|
+
|
46
|
+
|
47
|
+
== Debugging Rails
|
48
|
+
|
49
|
+
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
50
|
+
will help you debug it and get it back on the rails.
|
51
|
+
|
52
|
+
First area to check is the application log files. Have "tail -f" commands
|
53
|
+
running on the server.log and development.log. Rails will automatically display
|
54
|
+
debugging and runtime information to these files. Debugging info will also be
|
55
|
+
shown in the browser on requests from 127.0.0.1.
|
56
|
+
|
57
|
+
You can also log your own messages directly into the log file from your code
|
58
|
+
using the Ruby logger class from inside your controllers. Example:
|
59
|
+
|
60
|
+
class WeblogController < ActionController::Base
|
61
|
+
def destroy
|
62
|
+
@weblog = Weblog.find(params[:id])
|
63
|
+
@weblog.destroy
|
64
|
+
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
The result will be a message in your log file along the lines of:
|
69
|
+
|
70
|
+
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
|
71
|
+
|
72
|
+
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
73
|
+
|
74
|
+
Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
|
75
|
+
several books available online as well:
|
76
|
+
|
77
|
+
* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
|
78
|
+
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
79
|
+
|
80
|
+
These two books will bring you up to speed on the Ruby language and also on
|
81
|
+
programming in general.
|
82
|
+
|
83
|
+
|
84
|
+
== Debugger
|
85
|
+
|
86
|
+
Debugger support is available through the debugger command when you start your
|
87
|
+
Mongrel or WEBrick server with --debugger. This means that you can break out of
|
88
|
+
execution at any point in the code, investigate and change the model, and then,
|
89
|
+
resume execution! You need to install ruby-debug to run the server in debugging
|
90
|
+
mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
|
91
|
+
|
92
|
+
class WeblogController < ActionController::Base
|
93
|
+
def index
|
94
|
+
@posts = Post.all
|
95
|
+
debugger
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
So the controller will accept the action, run the first line, then present you
|
100
|
+
with a IRB prompt in the server window. Here you can do things like:
|
101
|
+
|
102
|
+
>> @posts.inspect
|
103
|
+
=> "[#<Post:0x14a6be8
|
104
|
+
@attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
|
105
|
+
#<Post:0x14a6620
|
106
|
+
@attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
|
107
|
+
>> @posts.first.title = "hello from a debugger"
|
108
|
+
=> "hello from a debugger"
|
109
|
+
|
110
|
+
...and even better, you can examine how your runtime objects actually work:
|
111
|
+
|
112
|
+
>> f = @posts.first
|
113
|
+
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
114
|
+
>> f.
|
115
|
+
Display all 152 possibilities? (y or n)
|
116
|
+
|
117
|
+
Finally, when you're ready to resume execution, you can enter "cont".
|
118
|
+
|
119
|
+
|
120
|
+
== Console
|
121
|
+
|
122
|
+
The console is a Ruby shell, which allows you to interact with your
|
123
|
+
application's domain model. Here you'll have all parts of the application
|
124
|
+
configured, just like it is when the application is running. You can inspect
|
125
|
+
domain models, change values, and save to the database. Starting the script
|
126
|
+
without arguments will launch it in the development environment.
|
127
|
+
|
128
|
+
To start the console, run <tt>rails console</tt> from the application
|
129
|
+
directory.
|
130
|
+
|
131
|
+
Options:
|
132
|
+
|
133
|
+
* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
|
134
|
+
made to the database.
|
135
|
+
* Passing an environment name as an argument will load the corresponding
|
136
|
+
environment. Example: <tt>rails console production</tt>.
|
137
|
+
|
138
|
+
To reload your controllers and models after launching the console run
|
139
|
+
<tt>reload!</tt>
|
140
|
+
|
141
|
+
More information about irb can be found at:
|
142
|
+
link:http://www.rubycentral.org/pickaxe/irb.html
|
143
|
+
|
144
|
+
|
145
|
+
== dbconsole
|
146
|
+
|
147
|
+
You can go to the command line of your database directly through <tt>rails
|
148
|
+
dbconsole</tt>. You would be connected to the database with the credentials
|
149
|
+
defined in database.yml. Starting the script without arguments will connect you
|
150
|
+
to the development database. Passing an argument will connect you to a different
|
151
|
+
database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
|
152
|
+
PostgreSQL and SQLite 3.
|
153
|
+
|
154
|
+
== Description of Contents
|
155
|
+
|
156
|
+
The default directory structure of a generated Ruby on Rails application:
|
157
|
+
|
158
|
+
|-- app
|
159
|
+
| |-- assets
|
160
|
+
| | |-- images
|
161
|
+
| | |-- javascripts
|
162
|
+
| | `-- stylesheets
|
163
|
+
| |-- controllers
|
164
|
+
| |-- helpers
|
165
|
+
| |-- mailers
|
166
|
+
| |-- models
|
167
|
+
| `-- views
|
168
|
+
| `-- layouts
|
169
|
+
|-- config
|
170
|
+
| |-- environments
|
171
|
+
| |-- initializers
|
172
|
+
| `-- locales
|
173
|
+
|-- db
|
174
|
+
|-- doc
|
175
|
+
|-- lib
|
176
|
+
| |-- assets
|
177
|
+
| `-- tasks
|
178
|
+
|-- log
|
179
|
+
|-- public
|
180
|
+
|-- script
|
181
|
+
|-- test
|
182
|
+
| |-- fixtures
|
183
|
+
| |-- functional
|
184
|
+
| |-- integration
|
185
|
+
| |-- performance
|
186
|
+
| `-- unit
|
187
|
+
|-- tmp
|
188
|
+
| `-- cache
|
189
|
+
| `-- assets
|
190
|
+
`-- vendor
|
191
|
+
|-- assets
|
192
|
+
| |-- javascripts
|
193
|
+
| `-- stylesheets
|
194
|
+
`-- plugins
|
195
|
+
|
196
|
+
app
|
197
|
+
Holds all the code that's specific to this particular application.
|
198
|
+
|
199
|
+
app/assets
|
200
|
+
Contains subdirectories for images, stylesheets, and JavaScript files.
|
201
|
+
|
202
|
+
app/controllers
|
203
|
+
Holds controllers that should be named like weblogs_controller.rb for
|
204
|
+
automated URL mapping. All controllers should descend from
|
205
|
+
ApplicationController which itself descends from ActionController::Base.
|
206
|
+
|
207
|
+
app/models
|
208
|
+
Holds models that should be named like post.rb. Models descend from
|
209
|
+
ActiveRecord::Base by default.
|
210
|
+
|
211
|
+
app/views
|
212
|
+
Holds the template files for the view that should be named like
|
213
|
+
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
214
|
+
eRuby syntax by default.
|
215
|
+
|
216
|
+
app/views/layouts
|
217
|
+
Holds the template files for layouts to be used with views. This models the
|
218
|
+
common header/footer method of wrapping views. In your views, define a layout
|
219
|
+
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
220
|
+
Inside default.html.erb, call <% yield %> to render the view using this
|
221
|
+
layout.
|
222
|
+
|
223
|
+
app/helpers
|
224
|
+
Holds view helpers that should be named like weblogs_helper.rb. These are
|
225
|
+
generated for you automatically when using generators for controllers.
|
226
|
+
Helpers can be used to wrap functionality for your views into methods.
|
227
|
+
|
228
|
+
config
|
229
|
+
Configuration files for the Rails environment, the routing map, the database,
|
230
|
+
and other dependencies.
|
231
|
+
|
232
|
+
db
|
233
|
+
Contains the database schema in schema.rb. db/migrate contains all the
|
234
|
+
sequence of Migrations for your schema.
|
235
|
+
|
236
|
+
doc
|
237
|
+
This directory is where your application documentation will be stored when
|
238
|
+
generated using <tt>rake doc:app</tt>
|
239
|
+
|
240
|
+
lib
|
241
|
+
Application specific libraries. Basically, any kind of custom code that
|
242
|
+
doesn't belong under controllers, models, or helpers. This directory is in
|
243
|
+
the load path.
|
244
|
+
|
245
|
+
public
|
246
|
+
The directory available for the web server. Also contains the dispatchers and the
|
247
|
+
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
248
|
+
server.
|
249
|
+
|
250
|
+
script
|
251
|
+
Helper scripts for automation and generation.
|
252
|
+
|
253
|
+
test
|
254
|
+
Unit and functional tests along with fixtures. When using the rails generate
|
255
|
+
command, template test files will be generated for you and placed in this
|
256
|
+
directory.
|
257
|
+
|
258
|
+
vendor
|
259
|
+
External libraries that the application depends on. Also includes the plugins
|
260
|
+
subdirectory. If the app has frozen rails, those gems also go here, under
|
261
|
+
vendor/rails/. This directory is in the load path.
|
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,17 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require ./ueditor_config
|
16
|
+
//= require ueditor_rails/init
|
17
|
+
//= require_self
|