soapbox 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +33 -0
- data/Gemfile.lock +142 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +75 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/app/controllers/admin/admin_controller.rb +111 -0
- data/app/controllers/admin/analytics_controller.rb +53 -0
- data/app/controllers/admin/attachments_controller.rb +28 -0
- data/app/controllers/admin/categories_controller.rb +2 -0
- data/app/controllers/admin/comments_controller.rb +2 -0
- data/app/controllers/admin/contents_controller.rb +2 -0
- data/app/controllers/admin/galleries_controller.rb +2 -0
- data/app/controllers/admin/gallery_images_controller.rb +29 -0
- data/app/controllers/admin/groups_controller.rb +10 -0
- data/app/controllers/admin/images_controller.rb +3 -0
- data/app/controllers/admin/menu_items_controller.rb +6 -0
- data/app/controllers/admin/menus_controller.rb +2 -0
- data/app/controllers/admin/pages_controller.rb +13 -0
- data/app/controllers/admin/plugins_controller.rb +2 -0
- data/app/controllers/admin/redirects_controller.rb +2 -0
- data/app/controllers/admin/settings_controller.rb +2 -0
- data/app/controllers/admin/users_controller.rb +2 -0
- data/app/controllers/admin/versions_controller.rb +6 -0
- data/app/controllers/application_controller.rb +38 -0
- data/app/controllers/attachments_controller.rb +2 -0
- data/app/controllers/categories_controller.rb +2 -0
- data/app/controllers/comments_controller.rb +2 -0
- data/app/controllers/groups_controller.rb +2 -0
- data/app/controllers/pages_controller.rb +18 -0
- data/app/controllers/plugins_controller.rb +2 -0
- data/app/controllers/redirects_controller.rb +5 -0
- data/app/controllers/settings_controller.rb +2 -0
- data/app/controllers/sitemap_controller.rb +7 -0
- data/app/helpers/content_helper.rb +17 -0
- data/app/helpers/layout_helper.rb +35 -0
- data/app/helpers/menu_helper.rb +26 -0
- data/app/helpers/page_helper.rb +21 -0
- data/app/helpers/plugin_helper.rb +21 -0
- data/app/helpers/soapbox_helper.rb +118 -0
- data/app/mailers/soapbox_mailer.rb +10 -0
- data/app/models/attachment.rb +16 -0
- data/app/models/content.rb +26 -0
- data/app/models/gallery.rb +9 -0
- data/app/models/gallery_image.rb +7 -0
- data/app/models/group.rb +27 -0
- data/app/models/member.rb +14 -0
- data/app/models/membership.rb +6 -0
- data/app/models/menu.rb +4 -0
- data/app/models/menu_item.rb +17 -0
- data/app/models/page.rb +41 -0
- data/app/models/permission.rb +12 -0
- data/app/models/plugin.rb +8 -0
- data/app/models/redirect.rb +3 -0
- data/app/models/setting.rb +16 -0
- data/app/models/user.rb +30 -0
- data/app/views/admin/analytics/index.html.erb +198 -0
- data/app/views/admin/attachments/_image.html.erb +15 -0
- data/app/views/admin/attachments/form.html.erb +26 -0
- data/app/views/admin/attachments/index.html.erb +16 -0
- data/app/views/admin/categories/form.html.erb +27 -0
- data/app/views/admin/categories/index.html.erb +1 -0
- data/app/views/admin/comments/form.html.erb +34 -0
- data/app/views/admin/comments/index.html.erb +1 -0
- data/app/views/admin/galleries/_image.html.erb +8 -0
- data/app/views/admin/galleries/_manager.html.erb +57 -0
- data/app/views/admin/galleries/form.html.erb +18 -0
- data/app/views/admin/galleries/index.html.erb +1 -0
- data/app/views/admin/groups/form.html.erb +81 -0
- data/app/views/admin/groups/index.html.erb +1 -0
- data/app/views/admin/menu_items/form.html.erb +28 -0
- data/app/views/admin/menus/_item.html.erb +5 -0
- data/app/views/admin/menus/form.html.erb +25 -0
- data/app/views/admin/menus/index.html.erb +82 -0
- data/app/views/admin/pages/form.html.erb +68 -0
- data/app/views/admin/pages/index.html.erb +1 -0
- data/app/views/admin/pages/link_list.html.erb +9 -0
- data/app/views/admin/plugins/form.html.erb +30 -0
- data/app/views/admin/plugins/index.html.erb +2 -0
- data/app/views/admin/redirects/form.html.erb +26 -0
- data/app/views/admin/redirects/index.html.erb +1 -0
- data/app/views/admin/settings/form.html.erb +27 -0
- data/app/views/admin/settings/index.html.erb +1 -0
- data/app/views/admin/shared/_form_buttons.html.erb +4 -0
- data/app/views/admin/shared/_form_errors.html.erb +10 -0
- data/app/views/admin/shared/_list.html.erb +68 -0
- data/app/views/admin/shared/_list_footer.html.erb +8 -0
- data/app/views/admin/shared/_list_toolbar.html.erb +22 -0
- data/app/views/admin/shared/_tag_manager.html.erb +20 -0
- data/app/views/admin/shared/order.html.erb +33 -0
- data/app/views/admin/shared/tree.html.erb +49 -0
- data/app/views/admin/shared/wysiwyg.html.erb +17 -0
- data/app/views/admin/users/form.html.erb +28 -0
- data/app/views/admin/users/index.html.erb +1 -0
- data/app/views/admin/versions/index.html.erb +38 -0
- data/app/views/devise/confirmations/new.html.erb +11 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +15 -0
- data/app/views/devise/passwords/new.html.erb +11 -0
- data/app/views/devise/registrations/edit.html.erb +25 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +17 -0
- data/app/views/devise/shared/_links.erb +23 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/galleries/_nivo_slider.html.erb +22 -0
- data/app/views/galleries/_pretty_photo.html.erb +19 -0
- data/app/views/groups/index.html.erb +7 -0
- data/app/views/groups/show.html.erb +16 -0
- data/app/views/layouts/_admin_toolbar.html.erb +29 -0
- data/app/views/layouts/_admin_top_nav.html.erb +19 -0
- data/app/views/layouts/_head.html.erb +31 -0
- data/app/views/layouts/admin.html.erb +11 -0
- data/app/views/layouts/admin_blank.html.erb +9 -0
- data/app/views/layouts/login.html.erb +22 -0
- data/app/views/pages/error_404.html.erb +2 -0
- data/app/views/pages/index.html.erb +7 -0
- data/app/views/pages/templates/default.html.erb +3 -0
- data/app/views/sitemap/sitemap.rxml +9 -0
- data/app/views/soapbox_mailer/email_form.html.erb +13 -0
- data/app/views/soapbox_mailer/email_form.text.erb +8 -0
- data/config/permissions.yml.template +35 -0
- data/config/routes.rb +62 -0
- data/install.rb +8 -0
- data/lib/generators/soapbox_migration/soapbox_migration_generator.rb +22 -0
- data/lib/generators/soapbox_migration/templates/migration.rb +259 -0
- data/lib/generators/soapbox_scaffold/soapbox_scaffold_generator.rb +69 -0
- data/lib/generators/soapbox_scaffold/templates/admin_controller.rb +2 -0
- data/lib/generators/soapbox_scaffold/templates/controller.rb +2 -0
- data/lib/generators/soapbox_scaffold/templates/migration.rb +20 -0
- data/lib/generators/soapbox_scaffold/templates/model.rb +3 -0
- data/lib/generators/soapbox_scaffold/templates/views/admin/form.html.erb +25 -0
- data/lib/generators/soapbox_scaffold/templates/views/admin/index.html.erb +1 -0
- data/lib/generators/soapbox_scaffold/templates/views/index.html.erb +7 -0
- data/lib/generators/soapbox_scaffold/templates/views/show.html.erb +17 -0
- data/lib/soapbox.rb +48 -0
- data/lib/soapbox/engine.rb +17 -0
- data/lib/soapbox/paperclip.rb +31 -0
- data/lib/soapbox/version.rb +4 -0
- data/lib/states.rb +52 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/robots.txt +5 -0
- data/public/soapbox/images/alert-overlay.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/contentPattern.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/dark_rounded/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/contentPattern.png +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/dark_square/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/default_thumb.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite_next.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite_prev.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite_x.png +0 -0
- data/public/soapbox/images/prettyPhoto/default/sprite_y.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/contentPatternBottom.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/contentPatternLeft.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/contentPatternRight.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/contentPatternTop.png +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/facebook/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/light_rounded/sprite.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/btnNext.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/btnPrevious.png +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/default_thumbnail.gif +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/loader.gif +0 -0
- data/public/soapbox/images/prettyPhoto/light_square/sprite.png +0 -0
- data/public/soapbox/javascripts/admin.js +119 -0
- data/public/soapbox/javascripts/blogger.js +52 -0
- data/public/soapbox/javascripts/jquery-1.4.2.min.js +154 -0
- data/public/soapbox/javascripts/jquery-1.6.2.min.js +18 -0
- data/public/soapbox/javascripts/jquery-ui-1.8rc3.custom.min.js +374 -0
- data/public/soapbox/javascripts/jquery.fileupload-ui.js +533 -0
- data/public/soapbox/javascripts/jquery.fileupload.js +975 -0
- data/public/soapbox/javascripts/jquery.flot.js +2599 -0
- data/public/soapbox/javascripts/jquery.formtastic.js +45 -0
- data/public/soapbox/javascripts/jquery.nivo.slider.pack.js +67 -0
- data/public/soapbox/javascripts/jquery.prettyPhoto.js +27 -0
- data/public/soapbox/javascripts/jquery.timepicker.js +304 -0
- data/public/soapbox/javascripts/jquery.tools.min.js +116 -0
- data/public/soapbox/javascripts/jquery.ui.nestedSortable.js +356 -0
- data/public/soapbox/javascripts/rails-1.6.js +331 -0
- data/public/soapbox/javascripts/rails.js +143 -0
- data/public/soapbox/javascripts/soapbox.js +27 -0
- data/public/soapbox/javascripts/tiny_mce/init.js +54 -0
- data/public/soapbox/javascripts/tiny_mce/jquery.tinymce.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/langs/en.js +169 -0
- data/public/soapbox/javascripts/tiny_mce/license.txt +504 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/css/advhr.css +5 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js +57 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/js/rule.js +43 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +5 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advhr/rule.htm +57 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/css/advimage.css +13 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +50 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/image.htm +232 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/img/sample.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/js/image.js +443 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +43 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/css/advlink.css +8 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js +61 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/js/advlink.js +528 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +52 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlink/link.htm +333 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js +154 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +117 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js +422 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/autosave/langs/en.js +4 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +120 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +127 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js +82 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js +43 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/emotions.htm +40 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/js/emotions.js +22 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/dialog.htm +22 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +84 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/js/dialog.js +19 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/langs/en.js +3 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css +182 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +149 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/fullpage.htm +571 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +471 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +148 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +109 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/iespell/editor_plugin_src.js +54 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +635 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +83 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/layer/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/layer/editor_plugin_src.js +212 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +136 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/css/content.css +6 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/css/media.css +16 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +414 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/flash.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/realmedia.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/trans.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/img/windowsmedia.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/js/embed.js +73 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/js/media.js +630 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/langs/en_dlg.js +103 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/media/media.htm +817 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +53 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +90 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/css/content.css +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +77 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/editor_plugin_src.js +929 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/pastetext.htm +27 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js +53 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/example.html +28 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/preview/preview.html +17 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/print/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/print/editor_plugin_src.js +34 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/save/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/save/editor_plugin_src.js +101 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +57 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +130 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/searchreplace/searchreplace.htm +99 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/spellchecker/css/content.css +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +341 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/css/props.css +13 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/editor_plugin_src.js +55 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/js/props.js +641 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +63 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/style/props.htm +726 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +112 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/cell.htm +178 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/css/cell.css +17 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/css/row.css +25 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/css/table.css +13 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/editor_plugin_src.js +1118 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/js/cell.js +286 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/js/row.js +237 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/js/table.js +449 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +74 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/row.htm +155 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/table/table.htm +187 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/blank.htm +12 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/css/template.css +23 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/editor_plugin_src.js +159 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/js/template.js +106 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/template/template.htm +32 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +76 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +98 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +141 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +141 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +148 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/cite.htm +141 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/del.htm +161 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +144 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/ins.htm +161 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +28 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +28 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +126 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +28 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/del.js +63 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +231 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +62 -0
- data/public/soapbox/javascripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/about.htm +54 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/charmap.htm +53 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/color_picker.htm +73 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/editor_template_src.js +1167 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/image.htm +80 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/about.js +72 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/anchor.js +37 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/charmap.js +335 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/color_picker.js +253 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/image.js +245 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/link.js +156 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/js/source_editor.js +62 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/langs/en.js +62 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +51 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/link.htm +58 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/content.css +35 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +213 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +35 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +116 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +215 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
- data/public/soapbox/javascripts/tiny_mce/themes/advanced/source_editor.htm +26 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/editor_template.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/editor_template_src.js +85 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/img/icons.gif +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/langs/en.js +11 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/default/content.css +25 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/default/ui.css +32 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
- data/public/soapbox/javascripts/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
- data/public/soapbox/javascripts/tiny_mce/tiny_mce.js +1 -0
- data/public/soapbox/javascripts/tiny_mce/tiny_mce_popup.js +5 -0
- data/public/soapbox/javascripts/tiny_mce/tiny_mce_src.js +13134 -0
- data/public/soapbox/javascripts/tiny_mce/utils/editable_selects.js +70 -0
- data/public/soapbox/javascripts/tiny_mce/utils/form_utils.js +200 -0
- data/public/soapbox/javascripts/tiny_mce/utils/mctabs.js +77 -0
- data/public/soapbox/javascripts/tiny_mce/utils/validate.js +220 -0
- data/public/soapbox/stylesheets/admin.css +599 -0
- data/public/soapbox/stylesheets/admin_toolbar.css +24 -0
- data/public/soapbox/stylesheets/awesome_buttons.css +48 -0
- data/public/soapbox/stylesheets/base/images/ui-anim_basic_16x16.gif +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_222222_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_454545_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_888888_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/soapbox/stylesheets/base/jquery.ui.accordion.css +10 -0
- data/public/soapbox/stylesheets/base/jquery.ui.all.css +2 -0
- data/public/soapbox/stylesheets/base/jquery.ui.autocomplete.css +35 -0
- data/public/soapbox/stylesheets/base/jquery.ui.base.css +10 -0
- data/public/soapbox/stylesheets/base/jquery.ui.button.css +35 -0
- data/public/soapbox/stylesheets/base/jquery.ui.core.css +37 -0
- data/public/soapbox/stylesheets/base/jquery.ui.datepicker.css +61 -0
- data/public/soapbox/stylesheets/base/jquery.ui.dialog.css +13 -0
- data/public/soapbox/stylesheets/base/jquery.ui.progressbar.css +4 -0
- data/public/soapbox/stylesheets/base/jquery.ui.resizable.css +13 -0
- data/public/soapbox/stylesheets/base/jquery.ui.slider.css +17 -0
- data/public/soapbox/stylesheets/base/jquery.ui.tabs.css +11 -0
- data/public/soapbox/stylesheets/base/jquery.ui.theme.css +247 -0
- data/public/soapbox/stylesheets/devise.css +0 -0
- data/public/soapbox/stylesheets/formtastic.css +131 -0
- data/public/soapbox/stylesheets/formtastic_changes.css +27 -0
- data/public/soapbox/stylesheets/jquery.fileupload-ui.css +151 -0
- data/public/soapbox/stylesheets/jquery.timepicker.css +104 -0
- data/public/soapbox/stylesheets/nivo-slider.css +89 -0
- data/public/soapbox/stylesheets/nivo-themes/default/arrows.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/default/bullets.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/default/default.css +74 -0
- data/public/soapbox/stylesheets/nivo-themes/default/loading.gif +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/arrows.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/bullets.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/loading.gif +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/orman.css +98 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/readme.txt +1 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/ribbon.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/orman/slider.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/bullets.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/controlnav.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/featured.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/loading.gif +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/pascal.css +102 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/readme.txt +1 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/ribbon.png +0 -0
- data/public/soapbox/stylesheets/nivo-themes/pascal/slider.png +0 -0
- data/public/soapbox/stylesheets/pbar-ani.gif +0 -0
- data/public/soapbox/stylesheets/prettyPhoto.css +1 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/soapbox/stylesheets/smoothness/jquery-ui-1.8.4.custom.css +572 -0
- data/public/soapbox/stylesheets/standardize.css +127 -0
- data/soapbox.gemspec +617 -0
- data/test/helper.rb +18 -0
- data/test/test_soapbox.rb +7 -0
- metadata +872 -0
@@ -0,0 +1,356 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery UI Nested Sortable
|
3
|
+
* v 1.3.4 / 28 apr 2011
|
4
|
+
* http://mjsarfatti.com/sandbox/nestedSortable
|
5
|
+
*
|
6
|
+
* Depends:
|
7
|
+
* jquery.ui.sortable.js 1.8+
|
8
|
+
*
|
9
|
+
* License CC BY-SA 3.0
|
10
|
+
* Copyright 2010-2011, Manuele J Sarfatti
|
11
|
+
*/
|
12
|
+
|
13
|
+
(function($) {
|
14
|
+
|
15
|
+
$.widget("ui.nestedSortable", $.extend({}, $.ui.sortable.prototype, {
|
16
|
+
|
17
|
+
options: {
|
18
|
+
tabSize: 20,
|
19
|
+
disableNesting: 'ui-nestedSortable-no-nesting',
|
20
|
+
errorClass: 'ui-nestedSortable-error',
|
21
|
+
listType: 'ol',
|
22
|
+
maxLevels: 0,
|
23
|
+
noJumpFix: 0
|
24
|
+
},
|
25
|
+
|
26
|
+
_create: function(){
|
27
|
+
if (this.noJumpFix == false)
|
28
|
+
this.element.height(this.element.height());
|
29
|
+
this.element.data('sortable', this.element.data('nestedSortable'));
|
30
|
+
return $.ui.sortable.prototype._create.apply(this, arguments);
|
31
|
+
},
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
_mouseDrag: function(event) {
|
36
|
+
|
37
|
+
//Compute the helpers position
|
38
|
+
this.position = this._generatePosition(event);
|
39
|
+
this.positionAbs = this._convertPositionTo("absolute");
|
40
|
+
|
41
|
+
if (!this.lastPositionAbs) {
|
42
|
+
this.lastPositionAbs = this.positionAbs;
|
43
|
+
}
|
44
|
+
|
45
|
+
//Do scrolling
|
46
|
+
if(this.options.scroll) {
|
47
|
+
var o = this.options, scrolled = false;
|
48
|
+
if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
|
49
|
+
|
50
|
+
if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
|
51
|
+
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
|
52
|
+
else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
|
53
|
+
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
|
54
|
+
|
55
|
+
if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
|
56
|
+
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
|
57
|
+
else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
|
58
|
+
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
|
59
|
+
|
60
|
+
} else {
|
61
|
+
|
62
|
+
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
|
63
|
+
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
64
|
+
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
|
65
|
+
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
66
|
+
|
67
|
+
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
|
68
|
+
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
69
|
+
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
|
70
|
+
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
71
|
+
|
72
|
+
}
|
73
|
+
|
74
|
+
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
|
75
|
+
$.ui.ddmanager.prepareOffsets(this, event);
|
76
|
+
}
|
77
|
+
|
78
|
+
//Regenerate the absolute position used for position checks
|
79
|
+
this.positionAbs = this._convertPositionTo("absolute");
|
80
|
+
|
81
|
+
//Set the helper position
|
82
|
+
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
|
83
|
+
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
|
84
|
+
|
85
|
+
//Rearrange
|
86
|
+
for (var i = this.items.length - 1; i >= 0; i--) {
|
87
|
+
|
88
|
+
//Cache variables and intersection, continue if no intersection
|
89
|
+
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
|
90
|
+
if (!intersection) continue;
|
91
|
+
|
92
|
+
if(itemElement != this.currentItem[0] //cannot intersect with itself
|
93
|
+
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
|
94
|
+
&& !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
|
95
|
+
&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
|
96
|
+
//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
|
97
|
+
) {
|
98
|
+
|
99
|
+
this.direction = intersection == 1 ? "down" : "up";
|
100
|
+
|
101
|
+
if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
|
102
|
+
this._rearrange(event, item);
|
103
|
+
} else {
|
104
|
+
break;
|
105
|
+
}
|
106
|
+
|
107
|
+
// Clear emtpy ul's/ol's
|
108
|
+
this._clearEmpty(itemElement);
|
109
|
+
|
110
|
+
this._trigger("change", event, this._uiHash());
|
111
|
+
break;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
var parentItem = (this.placeholder[0].parentNode.parentNode && $(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length) ? $(this.placeholder[0].parentNode.parentNode) : null;
|
116
|
+
var level = this._getLevel(this.placeholder);
|
117
|
+
var childLevels = this._getChildLevels(this.helper);
|
118
|
+
var previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null;
|
119
|
+
if (previousItem != null) {
|
120
|
+
while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0]) {
|
121
|
+
if (previousItem[0].previousSibling) {
|
122
|
+
previousItem = $(previousItem[0].previousSibling);
|
123
|
+
} else {
|
124
|
+
previousItem = null;
|
125
|
+
break;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
newList = document.createElement(o.listType);
|
131
|
+
|
132
|
+
this.beyondMaxLevels = 0;
|
133
|
+
|
134
|
+
// If the item is moved to the left, send it to its parent level
|
135
|
+
if (parentItem != null && this.positionAbs.left < parentItem.offset().left) {
|
136
|
+
parentItem.after(this.placeholder[0]);
|
137
|
+
this._clearEmpty(parentItem[0]);
|
138
|
+
this._trigger("change", event, this._uiHash());
|
139
|
+
}
|
140
|
+
// If the item is below another one and is moved to the right, make it a children of it
|
141
|
+
else if (previousItem != null && this.positionAbs.left > previousItem.offset().left + o.tabSize) {
|
142
|
+
this._isAllowed(previousItem, level+childLevels+1);
|
143
|
+
if (!previousItem.children(o.listType).length) {
|
144
|
+
previousItem[0].appendChild(newList);
|
145
|
+
}
|
146
|
+
previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
|
147
|
+
this._trigger("change", event, this._uiHash());
|
148
|
+
}
|
149
|
+
else {
|
150
|
+
this._isAllowed(parentItem, level+childLevels);
|
151
|
+
}
|
152
|
+
|
153
|
+
//Post events to containers
|
154
|
+
this._contactContainers(event);
|
155
|
+
|
156
|
+
//Interconnect with droppables
|
157
|
+
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
|
158
|
+
|
159
|
+
//Call callbacks
|
160
|
+
this._trigger('sort', event, this._uiHash());
|
161
|
+
|
162
|
+
this.lastPositionAbs = this.positionAbs;
|
163
|
+
return false;
|
164
|
+
|
165
|
+
},
|
166
|
+
|
167
|
+
_mouseStop: function(event, noPropagation) {
|
168
|
+
|
169
|
+
// If the item is in a position not allowed, send it back
|
170
|
+
if (this.beyondMaxLevels) {
|
171
|
+
var parent = this.placeholder.parent().closest(this.options.items);
|
172
|
+
|
173
|
+
for (var i = this.beyondMaxLevels - 1; i > 0; i--) {
|
174
|
+
parent = parent.parent().closest(this.options.items);
|
175
|
+
}
|
176
|
+
|
177
|
+
this.placeholder.removeClass(this.options.errorClass);
|
178
|
+
parent.after(this.placeholder);
|
179
|
+
this._trigger("change", event, this._uiHash());
|
180
|
+
}
|
181
|
+
|
182
|
+
$.ui.sortable.prototype._mouseStop.apply(this, arguments);
|
183
|
+
|
184
|
+
},
|
185
|
+
|
186
|
+
serialize: function(o) {
|
187
|
+
|
188
|
+
var items = this._getItemsAsjQuery(o && o.connected);
|
189
|
+
var str = []; o = o || {};
|
190
|
+
|
191
|
+
$(items).each(function() {
|
192
|
+
var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
|
193
|
+
var pid = ($(o.item || this).parent(o.listType).parent('li').attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
|
194
|
+
if(res) str.push((o.key || res[1]+'['+(o.key && o.expression ? res[1] : res[2])+']')+'='+(pid ? (o.key && o.expression ? pid[1] : pid[2]) : 'root'));
|
195
|
+
});
|
196
|
+
|
197
|
+
if(!str.length && o.key) {
|
198
|
+
str.push(o.key + '=');
|
199
|
+
}
|
200
|
+
|
201
|
+
return str.join('&');
|
202
|
+
|
203
|
+
},
|
204
|
+
|
205
|
+
toHierarchy: function(o) {
|
206
|
+
|
207
|
+
o = o || {};
|
208
|
+
var sDepth = o.startDepthCount || 0;
|
209
|
+
var ret = [];
|
210
|
+
|
211
|
+
$(this.element).children('li').each(function() {
|
212
|
+
var level = _recursiveItems($(this));
|
213
|
+
ret.push(level);
|
214
|
+
});
|
215
|
+
|
216
|
+
return ret;
|
217
|
+
|
218
|
+
function _recursiveItems(li) {
|
219
|
+
var id = ($(li).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
|
220
|
+
if (id != null) {
|
221
|
+
var item = {"id" : id[2]};
|
222
|
+
if ($(li).children(o.listType).children('li').length > 0) {
|
223
|
+
item.children = [];
|
224
|
+
$(li).children(o.listType).children('li').each(function () {
|
225
|
+
var level = _recursiveItems($(this));
|
226
|
+
item.children.push(level);
|
227
|
+
});
|
228
|
+
}
|
229
|
+
return item;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
},
|
233
|
+
|
234
|
+
toArray: function(o) {
|
235
|
+
|
236
|
+
o = o || {};
|
237
|
+
var sDepth = o.startDepthCount || 0;
|
238
|
+
var ret = [];
|
239
|
+
var left = 2;
|
240
|
+
|
241
|
+
ret.push({"item_id": 'root', "parent_id": 'none', "depth": sDepth, "left": '1', "right": ($('li', this.element).length + 1) * 2});
|
242
|
+
|
243
|
+
$(this.element).children('li').each(function () {
|
244
|
+
left = _recursiveArray(this, sDepth + 1, left);
|
245
|
+
});
|
246
|
+
|
247
|
+
function _sortByLeft(a,b) {
|
248
|
+
return a['left'] - b['left'];
|
249
|
+
}
|
250
|
+
ret = ret.sort(_sortByLeft);
|
251
|
+
|
252
|
+
return ret;
|
253
|
+
|
254
|
+
function _recursiveArray(item, depth, left) {
|
255
|
+
|
256
|
+
right = left + 1;
|
257
|
+
|
258
|
+
if ($(item).children(o.listType).children('li').length > 0) {
|
259
|
+
depth ++;
|
260
|
+
$(item).children(o.listType).children('li').each(function () {
|
261
|
+
right = _recursiveArray($(this), depth, right);
|
262
|
+
});
|
263
|
+
depth --;
|
264
|
+
}
|
265
|
+
|
266
|
+
id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/));
|
267
|
+
|
268
|
+
if (depth === sDepth + 1) pid = 'root';
|
269
|
+
else {
|
270
|
+
parentItem = ($(item).parent(o.listType).parent('li').attr('id')).match(o.expression || (/(.+)[-=_](.+)/));
|
271
|
+
pid = parentItem[2];
|
272
|
+
}
|
273
|
+
|
274
|
+
if (id != null) {
|
275
|
+
ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right});
|
276
|
+
}
|
277
|
+
|
278
|
+
return left = right + 1;
|
279
|
+
}
|
280
|
+
|
281
|
+
},
|
282
|
+
|
283
|
+
_clear: function(event, noPropagation) {
|
284
|
+
|
285
|
+
$.ui.sortable.prototype._clear.apply(this, arguments);
|
286
|
+
|
287
|
+
// Clean last empty ul/ol
|
288
|
+
for (var i = this.items.length - 1; i >= 0; i--) {
|
289
|
+
var item = this.items[i].item[0];
|
290
|
+
this._clearEmpty(item);
|
291
|
+
}
|
292
|
+
return true;
|
293
|
+
|
294
|
+
},
|
295
|
+
|
296
|
+
_clearEmpty: function(item) {
|
297
|
+
|
298
|
+
if (item.children[1] && item.children[1].children.length == 0) {
|
299
|
+
item.removeChild(item.children[1]);
|
300
|
+
}
|
301
|
+
|
302
|
+
},
|
303
|
+
|
304
|
+
_getLevel: function(item) {
|
305
|
+
|
306
|
+
var level = 1;
|
307
|
+
|
308
|
+
if (this.options.listType) {
|
309
|
+
var list = item.closest(this.options.listType);
|
310
|
+
while (!list.is('.ui-sortable')/* && level < this.options.maxLevels*/) {
|
311
|
+
level++;
|
312
|
+
list = list.parent().closest(this.options.listType);
|
313
|
+
}
|
314
|
+
}
|
315
|
+
|
316
|
+
return level;
|
317
|
+
},
|
318
|
+
|
319
|
+
_getChildLevels: function(parent, depth) {
|
320
|
+
var self = this,
|
321
|
+
o = this.options,
|
322
|
+
result = 0;
|
323
|
+
depth = depth || 0;
|
324
|
+
|
325
|
+
$(parent).children(o.listType).children(o.items).each(function (index, child) {
|
326
|
+
result = Math.max(self._getChildLevels(child, depth + 1), result);
|
327
|
+
});
|
328
|
+
|
329
|
+
return depth ? result + 1 : result;
|
330
|
+
},
|
331
|
+
|
332
|
+
_isAllowed: function(parentItem, levels) {
|
333
|
+
var o = this.options
|
334
|
+
// Are we trying to nest under a no-nest or are we nesting too deep?
|
335
|
+
if (parentItem == null || !(parentItem.hasClass(o.disableNesting))) {
|
336
|
+
if (o.maxLevels < levels && o.maxLevels != 0) {
|
337
|
+
this.placeholder.addClass(o.errorClass);
|
338
|
+
this.beyondMaxLevels = levels - o.maxLevels;
|
339
|
+
} else {
|
340
|
+
this.placeholder.removeClass(o.errorClass);
|
341
|
+
this.beyondMaxLevels = 0;
|
342
|
+
}
|
343
|
+
} else {
|
344
|
+
this.placeholder.addClass(o.errorClass);
|
345
|
+
if (o.maxLevels < levels && o.maxLevels != 0) {
|
346
|
+
this.beyondMaxLevels = levels - o.maxLevels;
|
347
|
+
} else {
|
348
|
+
this.beyondMaxLevels = 1;
|
349
|
+
}
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
}));
|
354
|
+
|
355
|
+
$.ui.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.ui.nestedSortable.prototype.options);
|
356
|
+
})(jQuery);
|
@@ -0,0 +1,331 @@
|
|
1
|
+
/**
|
2
|
+
* Unobtrusive scripting adapter for jQuery
|
3
|
+
*
|
4
|
+
* Requires jQuery 1.6.0 or later.
|
5
|
+
* https://github.com/rails/jquery-ujs
|
6
|
+
|
7
|
+
* Uploading file using rails.js
|
8
|
+
* =============================
|
9
|
+
*
|
10
|
+
* By default, browsers do not allow files to be uploaded via AJAX. As a result, if there are any non-blank file fields
|
11
|
+
* in the remote form, this adapter aborts the AJAX submission and allows the form to submit through standard means.
|
12
|
+
*
|
13
|
+
* The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish.
|
14
|
+
*
|
15
|
+
* Ex:
|
16
|
+
* $('form').live('ajax:aborted:file', function(event, elements){
|
17
|
+
* // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`.
|
18
|
+
* // Returning false in this handler tells rails.js to disallow standard form submission
|
19
|
+
* return false;
|
20
|
+
* });
|
21
|
+
*
|
22
|
+
* The `ajax:aborted:file` event is fired when a file-type input is detected with a non-blank value.
|
23
|
+
*
|
24
|
+
* Third-party tools can use this hook to detect when an AJAX file upload is attempted, and then use
|
25
|
+
* techniques like the iframe method to upload the file instead.
|
26
|
+
*
|
27
|
+
* Required fields in rails.js
|
28
|
+
* ===========================
|
29
|
+
*
|
30
|
+
* If any blank required inputs (required="required") are detected in the remote form, the whole form submission
|
31
|
+
* is canceled. Note that this is unlike file inputs, which still allow standard (non-AJAX) form submission.
|
32
|
+
*
|
33
|
+
* The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs.
|
34
|
+
*
|
35
|
+
* !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never
|
36
|
+
* get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior.
|
37
|
+
*
|
38
|
+
* Ex:
|
39
|
+
* $('form').live('ajax:aborted:required', function(event, elements){
|
40
|
+
* // Returning false in this handler tells rails.js to submit the form anyway.
|
41
|
+
* // The blank required inputs are passed to this function in `elements`.
|
42
|
+
* return ! confirm("Would you like to submit the form with missing info?");
|
43
|
+
* });
|
44
|
+
*/
|
45
|
+
|
46
|
+
(function($, undefined) {
|
47
|
+
// Shorthand to make it a little easier to call public rails functions from within rails.js
|
48
|
+
var rails;
|
49
|
+
|
50
|
+
$.rails = rails = {
|
51
|
+
// Link elements bound by jquery-ujs
|
52
|
+
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]',
|
53
|
+
|
54
|
+
// Select elements bound by jquery-ujs
|
55
|
+
selectChangeSelector: 'select[data-remote]',
|
56
|
+
|
57
|
+
// Form elements bound by jquery-ujs
|
58
|
+
formSubmitSelector: 'form',
|
59
|
+
|
60
|
+
// Form input elements bound by jquery-ujs
|
61
|
+
formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])',
|
62
|
+
|
63
|
+
// Form input elements disabled during form submission
|
64
|
+
disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]',
|
65
|
+
|
66
|
+
// Form input elements re-enabled after form submission
|
67
|
+
enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled',
|
68
|
+
|
69
|
+
// Form required input elements
|
70
|
+
requiredInputSelector: 'input[name][required]:not([disabled]),textarea[name][required]:not([disabled])',
|
71
|
+
|
72
|
+
// Form file input elements
|
73
|
+
fileInputSelector: 'input:file',
|
74
|
+
|
75
|
+
// Make sure that every Ajax request sends the CSRF token
|
76
|
+
CSRFProtection: function(xhr) {
|
77
|
+
var token = $('meta[name="csrf-token"]').attr('content');
|
78
|
+
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
79
|
+
},
|
80
|
+
|
81
|
+
// Triggers an event on an element and returns false if the event result is false
|
82
|
+
fire: function(obj, name, data) {
|
83
|
+
var event = $.Event(name);
|
84
|
+
obj.trigger(event, data);
|
85
|
+
return event.result !== false;
|
86
|
+
},
|
87
|
+
|
88
|
+
// Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
|
89
|
+
confirm: function(message) {
|
90
|
+
return confirm(message);
|
91
|
+
},
|
92
|
+
|
93
|
+
// Default ajax function, may be overridden with custom function in $.rails.ajax
|
94
|
+
ajax: function(options) {
|
95
|
+
return $.ajax(options);
|
96
|
+
},
|
97
|
+
|
98
|
+
// Submits "remote" forms and links with ajax
|
99
|
+
handleRemote: function(element) {
|
100
|
+
var method, url, data,
|
101
|
+
crossDomain = element.data('cross-domain') || null,
|
102
|
+
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
103
|
+
|
104
|
+
if (rails.fire(element, 'ajax:before')) {
|
105
|
+
|
106
|
+
if (element.is('form')) {
|
107
|
+
method = element.attr('method');
|
108
|
+
url = element.attr('action');
|
109
|
+
data = element.serializeArray();
|
110
|
+
// memoized value from clicked submit button
|
111
|
+
var button = element.data('ujs:submit-button');
|
112
|
+
if (button) {
|
113
|
+
data.push(button);
|
114
|
+
element.data('ujs:submit-button', null);
|
115
|
+
}
|
116
|
+
} else if (element.is('select')) {
|
117
|
+
method = element.data('method');
|
118
|
+
url = element.data('url');
|
119
|
+
data = element.serialize();
|
120
|
+
if (element.data('params')) data = data + "&" + element.data('params');
|
121
|
+
} else {
|
122
|
+
method = element.data('method');
|
123
|
+
url = element.attr('href');
|
124
|
+
data = element.data('params') || null;
|
125
|
+
}
|
126
|
+
|
127
|
+
options = {
|
128
|
+
type: method || 'GET', data: data, dataType: dataType, crossDomain: crossDomain,
|
129
|
+
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
130
|
+
beforeSend: function(xhr, settings) {
|
131
|
+
if (settings.dataType === undefined) {
|
132
|
+
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
133
|
+
}
|
134
|
+
return rails.fire(element, 'ajax:beforeSend', [xhr, settings]);
|
135
|
+
},
|
136
|
+
success: function(data, status, xhr) {
|
137
|
+
element.trigger('ajax:success', [data, status, xhr]);
|
138
|
+
},
|
139
|
+
complete: function(xhr, status) {
|
140
|
+
element.trigger('ajax:complete', [xhr, status]);
|
141
|
+
},
|
142
|
+
error: function(xhr, status, error) {
|
143
|
+
element.trigger('ajax:error', [xhr, status, error]);
|
144
|
+
}
|
145
|
+
};
|
146
|
+
// Do not pass url to `ajax` options if blank
|
147
|
+
if (url) { $.extend(options, { url: url }); }
|
148
|
+
|
149
|
+
rails.ajax(options);
|
150
|
+
}
|
151
|
+
},
|
152
|
+
|
153
|
+
// Handles "data-method" on links such as:
|
154
|
+
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
155
|
+
handleMethod: function(link) {
|
156
|
+
var href = link.attr('href'),
|
157
|
+
method = link.data('method'),
|
158
|
+
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
159
|
+
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
160
|
+
form = $('<form method="post" action="' + href + '"></form>'),
|
161
|
+
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
162
|
+
|
163
|
+
if (csrf_param !== undefined && csrf_token !== undefined) {
|
164
|
+
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
165
|
+
}
|
166
|
+
|
167
|
+
form.hide().append(metadata_input).appendTo('body');
|
168
|
+
form.submit();
|
169
|
+
},
|
170
|
+
|
171
|
+
/* Disables form elements:
|
172
|
+
- Caches element value in 'ujs:enable-with' data store
|
173
|
+
- Replaces element text with value of 'data-disable-with' attribute
|
174
|
+
- Adds disabled=disabled attribute
|
175
|
+
*/
|
176
|
+
disableFormElements: function(form) {
|
177
|
+
form.find(rails.disableSelector).each(function() {
|
178
|
+
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
179
|
+
element.data('ujs:enable-with', element[method]());
|
180
|
+
element[method](element.data('disable-with'));
|
181
|
+
element.attr('disabled', 'disabled');
|
182
|
+
});
|
183
|
+
},
|
184
|
+
|
185
|
+
/* Re-enables disabled form elements:
|
186
|
+
- Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
|
187
|
+
- Removes disabled attribute
|
188
|
+
*/
|
189
|
+
enableFormElements: function(form) {
|
190
|
+
form.find(rails.enableSelector).each(function() {
|
191
|
+
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
192
|
+
if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with'));
|
193
|
+
element.removeAttr('disabled');
|
194
|
+
});
|
195
|
+
},
|
196
|
+
|
197
|
+
/* For 'data-confirm' attribute:
|
198
|
+
- Fires `confirm` event
|
199
|
+
- Shows the confirmation dialog
|
200
|
+
- Fires the `confirm:complete` event
|
201
|
+
|
202
|
+
Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
|
203
|
+
Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
|
204
|
+
Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
|
205
|
+
return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
|
206
|
+
*/
|
207
|
+
allowAction: function(element) {
|
208
|
+
var message = element.data('confirm'),
|
209
|
+
answer = false, callback;
|
210
|
+
if (!message) { return true; }
|
211
|
+
|
212
|
+
if (rails.fire(element, 'confirm')) {
|
213
|
+
answer = rails.confirm(message);
|
214
|
+
callback = rails.fire(element, 'confirm:complete', [answer]);
|
215
|
+
}
|
216
|
+
return answer && callback;
|
217
|
+
},
|
218
|
+
|
219
|
+
// Helper function which checks for blank inputs in a form that match the specified CSS selector
|
220
|
+
blankInputs: function(form, specifiedSelector, nonBlank) {
|
221
|
+
var inputs = $(), input,
|
222
|
+
selector = specifiedSelector || 'input,textarea';
|
223
|
+
form.find(selector).each(function() {
|
224
|
+
input = $(this);
|
225
|
+
// Collect non-blank inputs if nonBlank option is true, otherwise, collect blank inputs
|
226
|
+
if (nonBlank ? input.val() : !input.val()) {
|
227
|
+
inputs = inputs.add(input);
|
228
|
+
}
|
229
|
+
});
|
230
|
+
return inputs.length ? inputs : false;
|
231
|
+
},
|
232
|
+
|
233
|
+
// Helper function which checks for non-blank inputs in a form that match the specified CSS selector
|
234
|
+
nonBlankInputs: function(form, specifiedSelector) {
|
235
|
+
return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
|
236
|
+
},
|
237
|
+
|
238
|
+
// Helper function, needed to provide consistent behavior in IE
|
239
|
+
stopEverything: function(e) {
|
240
|
+
$(e.target).trigger('ujs:everythingStopped');
|
241
|
+
e.stopImmediatePropagation();
|
242
|
+
return false;
|
243
|
+
},
|
244
|
+
|
245
|
+
// find all the submit events directly bound to the form and
|
246
|
+
// manually invoke them. If anyone returns false then stop the loop
|
247
|
+
callFormSubmitBindings: function(form) {
|
248
|
+
var events = form.data('events'), continuePropagation = true;
|
249
|
+
if (events !== undefined && events['submit'] !== undefined) {
|
250
|
+
$.each(events['submit'], function(i, obj){
|
251
|
+
if (typeof obj.handler === 'function') return continuePropagation = obj.handler(obj.data);
|
252
|
+
});
|
253
|
+
}
|
254
|
+
return continuePropagation;
|
255
|
+
}
|
256
|
+
};
|
257
|
+
|
258
|
+
$.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
|
259
|
+
|
260
|
+
$(rails.linkClickSelector).live('click.rails', function(e) {
|
261
|
+
var link = $(this);
|
262
|
+
if (!rails.allowAction(link)) return rails.stopEverything(e);
|
263
|
+
|
264
|
+
if (link.data('remote') !== undefined) {
|
265
|
+
rails.handleRemote(link);
|
266
|
+
return false;
|
267
|
+
} else if (link.data('method')) {
|
268
|
+
rails.handleMethod(link);
|
269
|
+
return false;
|
270
|
+
}
|
271
|
+
});
|
272
|
+
|
273
|
+
$(rails.selectChangeSelector).live('change.rails', function(e) {
|
274
|
+
var link = $(this);
|
275
|
+
if (!rails.allowAction(link)) return rails.stopEverything(e);
|
276
|
+
|
277
|
+
rails.handleRemote(link);
|
278
|
+
return false;
|
279
|
+
});
|
280
|
+
|
281
|
+
$(rails.formSubmitSelector).live('submit.rails', function(e) {
|
282
|
+
var form = $(this),
|
283
|
+
remote = form.data('remote') !== undefined,
|
284
|
+
blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector),
|
285
|
+
nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
|
286
|
+
|
287
|
+
if (!rails.allowAction(form)) return rails.stopEverything(e);
|
288
|
+
|
289
|
+
// skip other logic when required values are missing or file upload is present
|
290
|
+
if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
|
291
|
+
return rails.stopEverything(e);
|
292
|
+
}
|
293
|
+
|
294
|
+
if (remote) {
|
295
|
+
if (nonBlankFileInputs) {
|
296
|
+
return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
|
297
|
+
}
|
298
|
+
|
299
|
+
// If browser does not support submit bubbling, then this live-binding will be called before direct
|
300
|
+
// bindings. Therefore, we should directly call any direct bindings before remotely submitting form.
|
301
|
+
if (!$.support.submitBubbles && rails.callFormSubmitBindings(form) === false) return rails.stopEverything(e);
|
302
|
+
|
303
|
+
rails.handleRemote(form);
|
304
|
+
return false;
|
305
|
+
} else {
|
306
|
+
// slight timeout so that the submit button gets properly serialized
|
307
|
+
setTimeout(function(){ rails.disableFormElements(form); }, 13);
|
308
|
+
}
|
309
|
+
});
|
310
|
+
|
311
|
+
$(rails.formInputClickSelector).live('click.rails', function(event) {
|
312
|
+
var button = $(this);
|
313
|
+
|
314
|
+
if (!rails.allowAction(button)) return rails.stopEverything(event);
|
315
|
+
|
316
|
+
// register the pressed submit button
|
317
|
+
var name = button.attr('name'),
|
318
|
+
data = name ? {name:name, value:button.val()} : null;
|
319
|
+
|
320
|
+
button.closest('form').data('ujs:submit-button', data);
|
321
|
+
});
|
322
|
+
|
323
|
+
$(rails.formSubmitSelector).live('ajax:beforeSend.rails', function(event) {
|
324
|
+
if (this == event.target) rails.disableFormElements($(this));
|
325
|
+
});
|
326
|
+
|
327
|
+
$(rails.formSubmitSelector).live('ajax:complete.rails', function(event) {
|
328
|
+
if (this == event.target) rails.enableFormElements($(this));
|
329
|
+
});
|
330
|
+
|
331
|
+
})( jQuery );
|