ds-kitsune 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.specification +447 -0
- data/README.textile +16 -0
- data/Rakefile +30 -0
- data/VERSION +1 -0
- data/app/controllers/admin/kitsune/application_controller.rb +3 -0
- data/app/controllers/admin/kitsune/kitsune_controller.rb +87 -0
- data/app/controllers/admin/kitsune/kitsune_users_controller.rb +20 -0
- data/app/controllers/admin/kitsune/media_controller.rb +27 -0
- data/app/controllers/admin/kitsune/models_controller.rb +10 -0
- data/app/controllers/admin/kitsune/pages_controller.rb +35 -0
- data/app/controllers/admin/kitsune/records_controller.rb +98 -0
- data/app/controllers/admin/kitsune/sessions_controller.rb +23 -0
- data/app/controllers/kitsune_controller.rb +8 -0
- data/app/helpers/admin/kitsune/records_helper.rb +39 -0
- data/app/views/admin/kitsune/kitsune_users/index.html.haml +19 -0
- data/app/views/admin/kitsune/kitsune_users/new.html.haml +19 -0
- data/app/views/admin/kitsune/media/new.html.erb +49 -0
- data/app/views/admin/kitsune/models/index.html.haml +1 -0
- data/app/views/admin/kitsune/pages/_form.html.erb +13 -0
- data/app/views/admin/kitsune/pages/edit.html.erb +7 -0
- data/app/views/admin/kitsune/pages/index.html.erb +5 -0
- data/app/views/admin/kitsune/pages/new.html.erb +7 -0
- data/app/views/admin/kitsune/records/_form.html.haml +27 -0
- data/app/views/admin/kitsune/records/_list.html.haml +26 -0
- data/app/views/admin/kitsune/records/edit.html.haml +6 -0
- data/app/views/admin/kitsune/records/index.html.haml +13 -0
- data/app/views/admin/kitsune/records/new.html.haml +6 -0
- data/app/views/admin/kitsune/records/show.html.haml +11 -0
- data/app/views/admin/kitsune/sessions/new.html.haml +12 -0
- data/app/views/admin/kitsune/shared/_flashes.html.haml +6 -0
- data/app/views/kitsune/show.html.erb +8 -0
- data/app/views/kitsune/show.html.haml +5 -0
- data/app/views/layouts/admin/kitsune.html.erb +66 -0
- data/config/kitsune_routes.rb +21 -0
- data/doc/developers.html +38 -0
- data/generators/kitsune/USAGE +1 -0
- data/generators/kitsune/kitsune_generator.rb +67 -0
- data/generators/kitsune/lib/insert_commands.rb +31 -0
- data/generators/kitsune/templates/README +18 -0
- data/generators/kitsune/templates/VERSIONED_README +19 -0
- data/generators/kitsune/templates/images/back-arrow.gif +0 -0
- data/generators/kitsune/templates/images/bg.jpg +0 -0
- data/generators/kitsune/templates/images/box-shadow.png +0 -0
- data/generators/kitsune/templates/images/content-bg.gif +0 -0
- data/generators/kitsune/templates/images/form-bg.gif +0 -0
- data/generators/kitsune/templates/images/grey-btn.png +0 -0
- data/generators/kitsune/templates/images/header-bg.gif +0 -0
- data/generators/kitsune/templates/images/header-link.png +0 -0
- data/generators/kitsune/templates/images/nicEditorIcons.gif +0 -0
- data/generators/kitsune/templates/javascripts/jquery.js +19 -0
- data/generators/kitsune/templates/javascripts/kitsune_jquery.js +10 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/langs/en.js +154 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/license.txt +504 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/css/advhr.css +5 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js +54 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/js/rule.js +43 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +5 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advhr/rule.htm +62 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/css/advimage.css +13 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +47 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/image.htm +237 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/img/sample.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/js/image.js +443 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +43 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/css/advlink.css +8 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js +58 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/js/advlink.js +528 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +52 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/advlink/link.htm +338 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +114 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js +51 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +117 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +95 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js +79 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js +40 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/emotions.htm +40 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/js/emotions.js +22 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/dialog.htm +27 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +81 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/js/dialog.js +19 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/langs/en.js +3 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css +182 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +146 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/fullpage.htm +576 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +461 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +145 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +110 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/iespell/editor_plugin_src.js +51 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +632 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +80 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/layer/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/layer/editor_plugin_src.js +209 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/css/content.css +6 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/css/media.css +16 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +411 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/flash.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/realmedia.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/trans.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/img/windowsmedia.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/js/embed.js +73 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/js/media.js +630 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/langs/en_dlg.js +103 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/media/media.htm +822 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +50 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +87 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/css/content.css +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +74 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/editor_plugin_src.js +531 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/pastetext.htm +33 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/paste/pasteword.htm +27 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js +50 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/example.html +28 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/preview/preview.html +17 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/print/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/print/editor_plugin_src.js +31 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/safari/blank.htm +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/safari/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/safari/editor_plugin_src.js +438 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/save/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/save/editor_plugin_src.js +98 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +54 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +126 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/searchreplace/searchreplace.htm +104 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/spellchecker/css/content.css +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +338 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/css/props.css +13 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/editor_plugin_src.js +52 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/js/props.js +641 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +63 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/style/props.htm +730 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +109 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/cell.htm +183 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/css/cell.css +17 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/css/row.css +25 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/css/table.css +13 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/editor_plugin_src.js +1202 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/js/cell.js +269 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/js/merge_cells.js +29 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/js/row.js +212 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/js/table.js +440 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +74 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/merge_cells.htm +37 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/row.htm +160 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/table/table.htm +192 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/blank.htm +12 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/css/template.css +23 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/editor_plugin_src.js +156 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/js/template.js +106 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/template/template.htm +38 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +73 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +95 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +148 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +148 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +153 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/cite.htm +148 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/del.htm +169 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +136 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/ins.htm +169 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +25 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +25 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +123 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +25 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/del.js +60 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +231 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +59 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/about.htm +56 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/anchor.htm +31 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/charmap.htm +53 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/color_picker.htm +75 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/editor_template_src.js +1153 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/image.htm +85 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/about.js +72 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/anchor.js +37 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/charmap.js +325 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/color_picker.js +253 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/image.js +245 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/link.js +156 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/js/source_editor.js +62 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/langs/en.js +62 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +51 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/link.htm +63 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/content.css +32 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +116 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +214 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +32 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +115 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +215 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/advanced/source_editor.htm +31 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/about.htm +56 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/anchor.htm +31 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/charmap.htm +53 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/color_picker.htm +75 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/editor_template.js +1153 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/editor_template_src.js +1153 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/image.htm +65 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/images.json +8 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/img/colorpicker.jpg +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/img/icons.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/js/about.js +72 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/js/anchor.js +37 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/js/charmap.js +325 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/js/color_picker.js +253 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/js/image.js +260 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/js/link.js +156 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/js/source_editor.js +62 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/langs/en.js +62 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/langs/en_dlg.js +51 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/link.htm +63 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/default/content.css +32 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/default/dialog.css +184 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/default/img/buttons.png +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/default/img/items.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/default/img/menu_arrow.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/default/img/menu_check.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/default/img/progress.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/default/img/tabs.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/default/ui.css +214 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/o2k7/content.css +32 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/o2k7/dialog.css +115 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/o2k7/img/button_bg.png +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/o2k7/img/button_bg_black.png +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/o2k7/img/button_bg_silver.png +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/o2k7/ui.css +215 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/o2k7/ui_black.css +8 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/skins/o2k7/ui_silver.css +5 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/kitsune/source_editor.htm +31 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/editor_template.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/editor_template_src.js +85 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/img/icons.gif +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/langs/en.js +11 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/default/content.css +25 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/default/ui.css +32 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/tiny_mce.js +1 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/tiny_mce_popup.js +5 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/tiny_mce_src.js +13231 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/utils/editable_selects.js +69 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/utils/form_utils.js +199 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/utils/mctabs.js +76 -0
- data/generators/kitsune/templates/javascripts/tiny_mce/utils/validate.js +219 -0
- data/generators/kitsune/templates/javascripts/upload_maker.js +19 -0
- data/generators/kitsune/templates/kitsune_user.rb +3 -0
- data/generators/kitsune/templates/migrations/create_kitsune_users.rb +15 -0
- data/generators/kitsune/templates/migrations/create_pages.rb +16 -0
- data/generators/kitsune/templates/page.rb +3 -0
- data/generators/kitsune/templates/stylesheets/global.css +445 -0
- data/generators/kitsune/templates/stylesheets/ie.css +3 -0
- data/generators/kitsune_flat_files/kitsune_flat_files_generator.rb +8 -0
- data/generators/kitsune_flat_files/templates/index.html.erb +35 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/models/_form.html.erb +16 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/models/index.html.erb +2 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/pages/_form.html.erb +13 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/pages/edit.html.erb +7 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/pages/index.html.erb +5 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/pages/new.html.erb +7 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/records/_form.html.erb +21 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/records/_list.html.erb +38 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/records/edit.html.erb +15 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/records/index.html.erb +13 -0
- data/generators/kitsune_flat_files/templates/views/erb/admin/kitsune/records/new.html.erb +8 -0
- data/generators/kitsune_flat_files/templates/views/erb/kitsune/show.html.erb +1 -0
- data/generators/kitsune_flat_files/templates/views/erb/layouts/admin/kitsune.html.erb +46 -0
- data/kitsune.gemspec +419 -0
- data/lib/kitsune/active_record.rb +36 -0
- data/lib/kitsune/builder.rb +236 -0
- data/lib/kitsune/extensions/routes.rb +15 -0
- data/lib/kitsune/faux_column.rb +8 -0
- data/lib/kitsune/form_helper_ext.rb +23 -0
- data/lib/kitsune/inspector.rb +268 -0
- data/lib/kitsune/layout.rb +15 -0
- data/lib/kitsune/mongo_mapper.rb +49 -0
- data/lib/kitsune/page.rb +70 -0
- data/lib/kitsune.rb +53 -0
- data/lib/kitsune_user.rb +49 -0
- data/rails/init.rb +7 -0
- data/test/builder_test.rb +9 -0
- data/test/inspector_test.rb +13 -0
- data/test/schema.rb +23 -0
- data/test/test_helper.rb +11 -0
- metadata +451 -0
@@ -0,0 +1,236 @@
|
|
1
|
+
module Kitsune
|
2
|
+
class TypeError < StandardError; end
|
3
|
+
class Builder
|
4
|
+
|
5
|
+
TYPES = [:check_box, :datetime_select, :password_field, :text_area, :text_field, :wysiwyg, :collection_select]
|
6
|
+
def initialize(resource, &block)
|
7
|
+
@resource = resource
|
8
|
+
self.instance_eval &block
|
9
|
+
end
|
10
|
+
|
11
|
+
def category category
|
12
|
+
@resource.kitsune_admin[:category] = category
|
13
|
+
end
|
14
|
+
|
15
|
+
def name name
|
16
|
+
@resource.kitsune_admin[:name] = name
|
17
|
+
end
|
18
|
+
|
19
|
+
def media media
|
20
|
+
@resource.kitsune_admin[:media] = media
|
21
|
+
end
|
22
|
+
|
23
|
+
def on_edit &block
|
24
|
+
@resource.kitsune_admin[:on_edit] = block
|
25
|
+
end
|
26
|
+
|
27
|
+
def on_new &block
|
28
|
+
@resource.kitsune_admin[:on_new] = block
|
29
|
+
end
|
30
|
+
|
31
|
+
def before_save &block
|
32
|
+
@resource.kitsune_admin[:before_save] = block
|
33
|
+
end
|
34
|
+
|
35
|
+
def no_menu
|
36
|
+
no_admin
|
37
|
+
end
|
38
|
+
|
39
|
+
def order_by(order)
|
40
|
+
order = {order => :asc} unless order.is_a?(Hash)
|
41
|
+
@resource.kitsune_admin[:order_by] = order
|
42
|
+
end
|
43
|
+
|
44
|
+
def versioned
|
45
|
+
@resource.send(:versioned)
|
46
|
+
@resource.kitsune_admin[:versioned] = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def add_faux_method method_name
|
50
|
+
@resource.kitsune_admin[:faux_methods] ||= []
|
51
|
+
@resource.kitsune_admin[:faux_methods]<<method_name
|
52
|
+
end
|
53
|
+
|
54
|
+
def remove_faux_methods
|
55
|
+
if @resource.kitsune_admin[:faux_methods]
|
56
|
+
@resource.kitsune_admin[:faux_methods].each do |fm|
|
57
|
+
@resource.send(:remove_method, fm) if @resource.methods.include?(fm.to_sym)
|
58
|
+
if @resource.kitsune_admin[:edit][:fields]
|
59
|
+
@resource.kitsune_admin[:edit][:fields].delete fm.to_sym if @resource.kitsune_admin[:edit][:fields].include?(fm.to_sym)
|
60
|
+
@resource.kitsune_admin[:fields].delete fm.to_sym if @resource.kitsune_admin[:fields].keys.include?(fm)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
@resource.kitsune_admin[:faux_methods].clear
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def no_admin
|
68
|
+
@resource.kitsune_admin[:no_admin] = true
|
69
|
+
end
|
70
|
+
|
71
|
+
def tabs(tabs)
|
72
|
+
@resource.kitsune_admin[:tabs] = tabs
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.generate(resource, &block)
|
76
|
+
Builder.new(resource, &block)
|
77
|
+
end
|
78
|
+
|
79
|
+
def definitions
|
80
|
+
yield # should be it's own builder
|
81
|
+
end
|
82
|
+
|
83
|
+
def columns(type = nil)
|
84
|
+
@resource.columns
|
85
|
+
end
|
86
|
+
|
87
|
+
def disable(*types)
|
88
|
+
types.each do |type|
|
89
|
+
@resource.kitsune_admin[:disabled] << type.to_sym
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def sortable(*fields)
|
94
|
+
@resource.kitsune_admin[:sortable] ||= []
|
95
|
+
fields.each do |field|
|
96
|
+
@resource.kitsune_admin[:sortable] << field.to_sym
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def always(*fields)
|
101
|
+
@resource.kitsune_admin[:always] ||= []
|
102
|
+
fields.each do |field|
|
103
|
+
@resource.kitsune_admin[:always] << field.to_sym
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def linked(*fields) # link to resource
|
108
|
+
@resource.kitsune_admin[:linked] ||= []
|
109
|
+
fields.each do |field|
|
110
|
+
@resource.kitsune_admin[:linked] << field.to_sym
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def file(field)
|
115
|
+
add :file_field, field
|
116
|
+
multipart
|
117
|
+
end
|
118
|
+
|
119
|
+
def image(field)
|
120
|
+
add :image_field, field
|
121
|
+
multipart
|
122
|
+
end
|
123
|
+
|
124
|
+
def multipart(value = true)
|
125
|
+
@resource.kitsune_admin[:multipart] = value
|
126
|
+
end
|
127
|
+
|
128
|
+
def select(field, choices, options = {}, html_options = {})
|
129
|
+
add :select, field, {:options => [choices, options, html_options]}
|
130
|
+
end
|
131
|
+
|
132
|
+
def collection_select(field, collection, value_method, text_method, options = {}, html_options = {})
|
133
|
+
add :collection_select, field, {:options => [collection, value_method, text_method, options, html_options]}
|
134
|
+
end
|
135
|
+
|
136
|
+
def string(field)
|
137
|
+
add :text_field, field
|
138
|
+
end
|
139
|
+
|
140
|
+
def text(field)
|
141
|
+
add :text_area, field
|
142
|
+
end
|
143
|
+
|
144
|
+
def sti(field, options = {})
|
145
|
+
add :sti, field, {:options => options}
|
146
|
+
is_sti field
|
147
|
+
end
|
148
|
+
|
149
|
+
def is_sti(field)
|
150
|
+
@resource.kitsune_admin[:is_sti] = true
|
151
|
+
@resource.kitsune_admin[:sti_column] = field
|
152
|
+
end
|
153
|
+
|
154
|
+
def display_and_edit(*args)
|
155
|
+
display *args
|
156
|
+
edit *args
|
157
|
+
end
|
158
|
+
|
159
|
+
def display(*fields)
|
160
|
+
fields.each do |field|
|
161
|
+
if field.is_a?(Hash)
|
162
|
+
field.each do |key, value|
|
163
|
+
set :display, key
|
164
|
+
set_attributes(key, value)
|
165
|
+
end
|
166
|
+
else
|
167
|
+
set :display, field
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def show(*fields)
|
173
|
+
fields.each do |field|
|
174
|
+
if field.is_a?(Hash)
|
175
|
+
field.each do |key, value|
|
176
|
+
set :show, key
|
177
|
+
set_attributes(key, value)
|
178
|
+
end
|
179
|
+
else
|
180
|
+
set :show, field
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def set_attributes(field, attributes)
|
186
|
+
[attributes].flatten.each do |attribute|
|
187
|
+
send(attribute.to_sym, field)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def edit(*fields)
|
192
|
+
fields.each do |field|
|
193
|
+
if field.is_a?(Hash)
|
194
|
+
field.each do |key, value|
|
195
|
+
type = @resource.reflections[key.to_sym] ? :reflections : :edit
|
196
|
+
set(type, key)
|
197
|
+
set_attributes(key, value)
|
198
|
+
end
|
199
|
+
else
|
200
|
+
type = @resource.reflections[field.to_sym] ? :reflections : :edit
|
201
|
+
set type, field
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def no_edit(*fields)
|
207
|
+
set :no_edit, fields
|
208
|
+
end
|
209
|
+
|
210
|
+
def method_missing(method, *args, &block)
|
211
|
+
if TYPES.include?(method)
|
212
|
+
add method, *args
|
213
|
+
else
|
214
|
+
raise Exception, "THIS IS WRONG@! #{method.to_s}"
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
private
|
219
|
+
def add(type, field, options = {})
|
220
|
+
@resource.kitsune_admin[:fields] ||= {}
|
221
|
+
@resource.kitsune_admin[:fields][field] = options.merge(:type => type)
|
222
|
+
end
|
223
|
+
|
224
|
+
def set(type, fields)
|
225
|
+
@resource.kitsune_admin[type] = {} unless @resource.kitsune_admin[type]
|
226
|
+
@resource.kitsune_admin[type][:fields] ||= []
|
227
|
+
[fields].flatten.each do |field|
|
228
|
+
unless field.is_a?(Hash)
|
229
|
+
@resource.kitsune_admin[type][:fields] << field unless @resource.kitsune_admin[type][:fields].include?(field)
|
230
|
+
else
|
231
|
+
@resource.kitsune_admin[type].merge!(field)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
if defined?(ActionController::Routing::RouteSet)
|
2
|
+
class ActionController::Routing::RouteSet
|
3
|
+
def add_configuration_file_with_kitsune(file)
|
4
|
+
lib_path = File.dirname(__FILE__)
|
5
|
+
kitsune_routes = File.join(lib_path, *%w[.. .. .. config kitsune_routes.rb])
|
6
|
+
if configuration_files.include?(kitsune_routes)
|
7
|
+
self.configuration_files.delete(kitsune_routes)
|
8
|
+
end
|
9
|
+
add_configuration_file_without_kitsune(file)
|
10
|
+
add_configuration_file_without_kitsune(kitsune_routes)
|
11
|
+
end
|
12
|
+
|
13
|
+
alias_method_chain :add_configuration_file, :kitsune
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
class FormBuilder
|
4
|
+
def wysiwyg(method, options={})
|
5
|
+
sanitized_object_name = @object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/, "_").sub(/_$/, "")
|
6
|
+
sanitized_method_name = method.to_s.sub(/\?$/,"")
|
7
|
+
id = "#{sanitized_object_name}_#{sanitized_method_name}"
|
8
|
+
if @object.kitsune_admin[:media]
|
9
|
+
@template.content_for(:head) do
|
10
|
+
@template.capture do
|
11
|
+
"<script>
|
12
|
+
$(function() {
|
13
|
+
$('textarea.wysiwyg').upload_maker('#{@template.url_for({:id => @object.kitsune_admin[:media].keys.first.to_s.classify, :action=>"new", :controller=>"admin/kitsune/media"})}');
|
14
|
+
})
|
15
|
+
</script>"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
@template.send('text_area', @object_name, method, objectify_options(options.merge({:class => 'wysiwyg'}))) + @template.content_tag('script', "tinyMCE.execCommand('mceAddControl', true, '#{id}');")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,268 @@
|
|
1
|
+
module Kitsune
|
2
|
+
# Inspector is a proxy for adding additional methods. These should only be
|
3
|
+
# available within the Kitsune admin.
|
4
|
+
|
5
|
+
class Inspector
|
6
|
+
attr_reader :object
|
7
|
+
def initialize(object)
|
8
|
+
@object = object
|
9
|
+
@collection_label_methods = %w[to_label display_name full_name name title username login value to_s]
|
10
|
+
end
|
11
|
+
|
12
|
+
def admin_name
|
13
|
+
kitsune_admin[:name] || @object.to_s.pluralize
|
14
|
+
end
|
15
|
+
|
16
|
+
def order_by
|
17
|
+
order_by_hash ? order_by_hash.map{|k,v| "#{k} #{v}"}.join(' ') : nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def order_by_hash
|
21
|
+
kitsune_admin[:order_by] || nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def category
|
25
|
+
kitsune_admin[:category] || nil
|
26
|
+
end
|
27
|
+
|
28
|
+
def versioned?
|
29
|
+
!!kitsune_admin[:versioned]
|
30
|
+
end
|
31
|
+
|
32
|
+
def disabled?(type)
|
33
|
+
kitsune_admin[:disabled].include?(type.to_sym)
|
34
|
+
end
|
35
|
+
|
36
|
+
def run_hooks(type, *args)
|
37
|
+
kitsune_admin[type.to_sym].call(*args) if kitsune_admin[type.to_sym]
|
38
|
+
end
|
39
|
+
|
40
|
+
def is_sti?
|
41
|
+
kitsune_admin[:is_sti]
|
42
|
+
end
|
43
|
+
|
44
|
+
def is_sti_child?
|
45
|
+
if defined? ::ActiveRecord
|
46
|
+
@object.ancestors[1] != ::ActiveRecord::Base
|
47
|
+
else
|
48
|
+
false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def sti_column
|
53
|
+
kitsune_admin[:sti_column]
|
54
|
+
end
|
55
|
+
|
56
|
+
def tabs
|
57
|
+
kitsune_admin[:tabs]
|
58
|
+
end
|
59
|
+
|
60
|
+
def object_class
|
61
|
+
@object.to_s
|
62
|
+
end
|
63
|
+
|
64
|
+
def new_record(*args)
|
65
|
+
@object.new(*args)
|
66
|
+
end
|
67
|
+
|
68
|
+
def columns(type = nil, include_pk = false)
|
69
|
+
unless type
|
70
|
+
kolumns = @object.columns.dup
|
71
|
+
else
|
72
|
+
kolumns = send("columns_for_#{type}") if respond_to?("columns_for_#{type}")
|
73
|
+
end
|
74
|
+
include_pk ? kolumns : (kolumns || []).reject{|c| c.primary }
|
75
|
+
end
|
76
|
+
|
77
|
+
def columns_for_edit
|
78
|
+
kolumns = @object.columns.dup
|
79
|
+
if kitsune_admin[:no_edit] && kitsune_admin[:no_edit][:fields]
|
80
|
+
kolumns.reject{|c| kitsune_admin[:no_edit][:fields].include?(c.name.to_sym)}
|
81
|
+
elsif kitsune_admin[:edit] && kitsune_admin[:edit][:fields]
|
82
|
+
kolumns = kolumns.select{|c| kitsune_admin[:edit][:fields].include?(c.name.to_sym)}
|
83
|
+
kolumn_names = kolumns.map{|c| c.name.to_sym}
|
84
|
+
fields_to_add = kitsune_admin[:edit][:fields].reject{|f| kolumn_names.include?(f)}
|
85
|
+
fields_to_add.each do |field|
|
86
|
+
kolumns << Kitsune::FauxColumn.new(field, :string)
|
87
|
+
end
|
88
|
+
kolumns
|
89
|
+
else
|
90
|
+
kolumns
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def columns_for_display
|
95
|
+
columns = @object.columns.dup
|
96
|
+
if kitsune_admin[:display] && kitsune_admin[:display][:fields]
|
97
|
+
columns = columns.select{|c| kitsune_admin[:display][:fields].include?(c.name.to_sym)}
|
98
|
+
column_names = columns.map{|c| c.name.to_sym}
|
99
|
+
fields_to_add = kitsune_admin[:display][:fields].reject{|f| column_names.include?(f)}
|
100
|
+
fields_to_add.each do |field|
|
101
|
+
columns << Kitsune::FauxColumn.new(field, :string)
|
102
|
+
end
|
103
|
+
columns
|
104
|
+
else
|
105
|
+
columns
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def columns_for_show
|
110
|
+
columns = @object.columns.dup
|
111
|
+
if kitsune_admin[:show] && kitsune_admin[:show][:fields]
|
112
|
+
columns = columns.select{|c| kitsune_admin[:show][:fields].include?(c.name.to_sym)}
|
113
|
+
column_names = columns.map{|c| c.name.to_sym}
|
114
|
+
fields_to_add = kitsune_admin[:show][:fields].reject{|f| column_names.include?(f)}
|
115
|
+
fields_to_add.each do |field|
|
116
|
+
columns << Kitsune::FauxColumn.new(field, :string)
|
117
|
+
end
|
118
|
+
columns
|
119
|
+
else
|
120
|
+
columns
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def columns_for_reflections
|
125
|
+
if kitsune_admin[:reflections] && kitsune_admin[:reflections][:fields]
|
126
|
+
kitsune_admin[:reflections][:fields].map do |field|
|
127
|
+
Kitsune::FauxColumn.new(field, :string)
|
128
|
+
end
|
129
|
+
else
|
130
|
+
[]
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def column_sortable(column)
|
135
|
+
# move to column proxy
|
136
|
+
kitsune_admin[:sortable] && kitsune_admin[:sortable].include?(column.name.to_sym)
|
137
|
+
end
|
138
|
+
|
139
|
+
def always?(column)
|
140
|
+
# move to column proxy
|
141
|
+
kitsune_admin[:always] && kitsune_admin[:always].include?(column.name.to_sym)
|
142
|
+
end
|
143
|
+
|
144
|
+
def column_linked?(column)
|
145
|
+
# move to column proxy
|
146
|
+
kitsune_admin[:linked] && kitsune_admin[:linked].include?(column.name.to_sym)
|
147
|
+
end
|
148
|
+
|
149
|
+
def method_missing(method, *args, &block)
|
150
|
+
@object.send(method, *args, &block)
|
151
|
+
end
|
152
|
+
|
153
|
+
def form_type(column)
|
154
|
+
field = column.name
|
155
|
+
if type = field_type(column.name)
|
156
|
+
case type
|
157
|
+
when :sti
|
158
|
+
if (options = field_options(field)) && options[:classes]
|
159
|
+
:select
|
160
|
+
else
|
161
|
+
:text_field
|
162
|
+
end
|
163
|
+
when :image_field
|
164
|
+
:file_field
|
165
|
+
else
|
166
|
+
kitsune_admin[:fields][column.name.to_sym][:type]
|
167
|
+
end
|
168
|
+
elsif column.name =~ /._id$/
|
169
|
+
:select
|
170
|
+
else
|
171
|
+
case column.type
|
172
|
+
when :text then :text_area
|
173
|
+
when :datetime then :datetime_select
|
174
|
+
when :date then :date_select
|
175
|
+
when :time then :time_select
|
176
|
+
when :boolean then :check_box
|
177
|
+
else :text_field
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def detect_label(collection)
|
183
|
+
@collection_label_methods.each do |label_name|
|
184
|
+
return label_name if [collection].flatten.first.respond_to?(label_name)
|
185
|
+
end
|
186
|
+
'to_s'
|
187
|
+
end
|
188
|
+
|
189
|
+
def find_association_class(column)
|
190
|
+
if @object.reflections[column.name.to_s.gsub(/_id$/,'').to_sym]
|
191
|
+
if @object.reflections[column.name.to_s.gsub(/_id$/,'').to_sym].options && @object.reflections[column.name.to_s.gsub(/_id$/,'').to_sym].options[:class_name]
|
192
|
+
@object.reflections[column.name.to_s.gsub(/_id$/,'').to_sym].options[:class_name].constantize
|
193
|
+
else
|
194
|
+
return column.name.to_s.gsub(/_id$/,'').classify.constantize
|
195
|
+
end
|
196
|
+
else
|
197
|
+
# foreign key
|
198
|
+
@object.reflections.each do |key, reflection|
|
199
|
+
if reflection.options && reflection.options[:foreign_key] && reflection.options[:foreign_key] == column.name.to_s
|
200
|
+
if reflection.options && reflection.options[:class_name]
|
201
|
+
reflection.options[:class_name].constantize
|
202
|
+
else
|
203
|
+
return key.to_s.classify.constantize
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def display_for(record, method, *args, &block)
|
211
|
+
if method.to_s =~ /._id$/
|
212
|
+
associated_record = record.send(method.to_s.gsub(/_id$/, '').to_sym, *args, &block)
|
213
|
+
label_method = detect_label(associated_record)
|
214
|
+
associated_record.send(label_method.to_sym)
|
215
|
+
else
|
216
|
+
record.send(method.to_sym, *args, &block)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def form_options_for(record)
|
221
|
+
options = {:method => method_for_record(record)}
|
222
|
+
if kitsune_admin[:multipart]
|
223
|
+
options.merge!({:html => {:multipart => true}})
|
224
|
+
end
|
225
|
+
options
|
226
|
+
end
|
227
|
+
|
228
|
+
def method_for_record(record)
|
229
|
+
record.new_record? ? :post : :put
|
230
|
+
end
|
231
|
+
|
232
|
+
def options_for(column)
|
233
|
+
|
234
|
+
field = column.name
|
235
|
+
|
236
|
+
if field_type(field) == :select or field_type(field) == :collection_select
|
237
|
+
field_options(field)
|
238
|
+
elsif column.name =~ /._id$/
|
239
|
+
id = :id
|
240
|
+
collection = find_association_class(column).all
|
241
|
+
name = detect_label(collection)
|
242
|
+
[collection.map { |element| [ element.send(name), element.send(id) ] }, {:include_blank => true}]
|
243
|
+
elsif field_type(field) == :sti && (options = field_options(field)) && options[:classes]
|
244
|
+
[options[:classes].map {|element| [element.to_s, element.to_s]}, {:include_blank => true}]
|
245
|
+
else
|
246
|
+
options = field_options(field) || {}
|
247
|
+
options[:size] = '80x10' if [:text_area, :wysiwyg].include?(form_type(column))
|
248
|
+
[options]
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
def field_type(field)
|
253
|
+
return kitsune_admin[:fields][field.to_sym][:type] if field_defined(field)
|
254
|
+
return nil
|
255
|
+
end
|
256
|
+
|
257
|
+
private
|
258
|
+
def field_defined(field)
|
259
|
+
!!kitsune_admin[:fields][field.to_sym]
|
260
|
+
end
|
261
|
+
|
262
|
+
def field_options(field)
|
263
|
+
options = kitsune_admin[:fields][field.to_sym][:options] if field_defined(field)
|
264
|
+
return (options.is_a?(Proc) ? options.call : options) if options
|
265
|
+
return nil
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Kitsune
|
2
|
+
class Layout
|
3
|
+
def initialize(layout_file)
|
4
|
+
data = File.read(layout_file)
|
5
|
+
@content_areas = data.scan(/yield\s+:(\w+)\s+/i).flatten.uniq
|
6
|
+
end
|
7
|
+
|
8
|
+
def content_areas
|
9
|
+
@content_areas
|
10
|
+
end
|
11
|
+
|
12
|
+
def method_missing(method, *arg, &block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'kitsune/builder'
|
2
|
+
|
3
|
+
module Kitsune
|
4
|
+
module MongoMapper
|
5
|
+
def setup_admin
|
6
|
+
self.class_eval do
|
7
|
+
class_inheritable_hash :kitsune_admin
|
8
|
+
self.kitsune_admin = {
|
9
|
+
:no_admin => false,
|
10
|
+
:multipart => false,
|
11
|
+
:display => {},
|
12
|
+
:edit => {},
|
13
|
+
:reflections => {},
|
14
|
+
:fields => {},
|
15
|
+
:tabs => {},
|
16
|
+
:is_sti => false,
|
17
|
+
:disabled => [],
|
18
|
+
:versioned => false,
|
19
|
+
:order_by => nil,
|
20
|
+
:media => nil # class to store images into
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def admin &block
|
26
|
+
setup_admin unless self.respond_to?(:kitsune_admin)
|
27
|
+
Kitsune::Builder.generate(self, &block) unless self.kitsune_admin[:no_admin]
|
28
|
+
end
|
29
|
+
|
30
|
+
def no_admin
|
31
|
+
setup_admin
|
32
|
+
self.kitsune_admin[:no_admin] = true
|
33
|
+
end
|
34
|
+
TRANSPOSE = {String => :string}
|
35
|
+
def columns
|
36
|
+
self.keys.map do |key, value|
|
37
|
+
FauxColumn.new(key, TRANSPOSE[value.type], key == '_id')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def reflections
|
42
|
+
{}
|
43
|
+
end
|
44
|
+
|
45
|
+
def class_name
|
46
|
+
self.to_s
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/kitsune/page.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
module Kitsune
|
2
|
+
module Page
|
3
|
+
def self.included(model)
|
4
|
+
model.class_eval do
|
5
|
+
admin do
|
6
|
+
display :title, :layout, :parent_id, :url
|
7
|
+
edit :title, :url, :body, :layout, :parent_id
|
8
|
+
wysiwyg :body
|
9
|
+
select :layout, [Dir.glob(File.join(RAILS_ROOT, 'app', 'views', 'layouts', '*.html.*')).map{|f| File.basename(f).split('.').first}]
|
10
|
+
|
11
|
+
on_new do |page|
|
12
|
+
remove_faux_methods
|
13
|
+
end
|
14
|
+
|
15
|
+
on_edit do |page|
|
16
|
+
Kitsune::Layout.new(Dir.glob(File.join(RAILS_ROOT, 'app', 'views', 'layouts', "#{page.layout}.html.*")).first).content_areas.each do |area|
|
17
|
+
page.class.send(:define_method, area, Proc.new{ self.data ||= {}; self.data[:content_for] ||= {}; self.data[:content_for][area.to_sym]})
|
18
|
+
edit area.to_sym => :text
|
19
|
+
add_faux_method area
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
before_save do |page|
|
24
|
+
Kitsune::Layout.new(Dir.glob(File.join(RAILS_ROOT, 'app', 'views', 'layouts', "#{page.layout}.html.*")).first).content_areas.each do |area|
|
25
|
+
page.class.send(:define_method, "#{area}=", Proc.new{|value| self.data ||= {}; self.data[:content_for] ||= {}; self.data[:content_for][area.to_sym] = value})
|
26
|
+
add_faux_method "#{area}="
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
before_save :update_url
|
33
|
+
belongs_to :page, :foreign_key => "parent_id"
|
34
|
+
belongs_to :parent, :class_name => 'Page'
|
35
|
+
validate :must_be_kitsune_route
|
36
|
+
validates_uniqueness_of :url
|
37
|
+
serialize :data
|
38
|
+
|
39
|
+
|
40
|
+
def after_save
|
41
|
+
ActionController::Routing::Routes.reload!
|
42
|
+
end
|
43
|
+
|
44
|
+
def after_destroy
|
45
|
+
ActionController::Routing::Routes.reload!
|
46
|
+
end
|
47
|
+
|
48
|
+
def title_for_url
|
49
|
+
CGI.escape(title.downcase.gsub(/\s+/, '-')).squeeze('-')
|
50
|
+
end
|
51
|
+
|
52
|
+
def url_for_page
|
53
|
+
parent ? parent.url_for_page + '/' + title_for_url : '/' + title_for_url
|
54
|
+
end
|
55
|
+
|
56
|
+
def update_url
|
57
|
+
write_attribute :url, (url.present? ? url : url_for_page)
|
58
|
+
end
|
59
|
+
|
60
|
+
def must_be_kitsune_route
|
61
|
+
unless ActionController::Routing::Routes.recognize_path(url.present? ? url : url_for_page, :method => :get)[:controller] == 'kitsune'
|
62
|
+
errors.add_to_base("URL is already being used")
|
63
|
+
end
|
64
|
+
rescue
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|