sunrise-widgets 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +34 -0
 - data/MIT-LICENSE +20 -0
 - data/README.rdoc +21 -0
 - data/Rakefile +27 -0
 - data/app/controllers/manage/widgets_controller.rb +33 -0
 - data/app/views/manage/widgets/_form.html.erb +21 -0
 - data/app/views/manage/widgets/_model_filter.html.erb +40 -0
 - data/app/views/manage/widgets/_widget.html.erb +41 -0
 - data/app/views/manage/widgets/edit.html.erb +6 -0
 - data/app/views/manage/widgets/index.html.erb +30 -0
 - data/app/views/manage/widgets/new.html.erb +6 -0
 - data/app/views/manage/widgets/show.html.erb +29 -0
 - data/config/locales/ru.yml +18 -0
 - data/config/locales/uk.yml +18 -0
 - data/config/routes.rb +5 -0
 - data/lib/generators/sunrise/widgets/USAGE +12 -0
 - data/lib/generators/sunrise/widgets/install_generator.rb +40 -0
 - data/lib/generators/sunrise/widgets/templates/create_widgets.rb +24 -0
 - data/lib/generators/sunrise/widgets/templates/widget.rb +6 -0
 - data/lib/generators/sunrise/widgets/templates/widget_position.rb +14 -0
 - data/lib/generators/sunrise/widgets/templates/widget_sweeper.rb +21 -0
 - data/lib/generators/sunrise/widgets/templates/widget_type.rb +15 -0
 - data/lib/sunrise/models/widget.rb +39 -0
 - data/lib/sunrise/widgets/engine.rb +18 -0
 - data/lib/sunrise/widgets/version.rb +5 -0
 - data/lib/sunrise/widgets.rb +12 -0
 - data/lib/sunrise-widgets.rb +1 -0
 - data/spec/controllers/manage/widgets_controller_spec.rb +95 -0
 - data/spec/dummy/Rakefile +7 -0
 - data/spec/dummy/app/controllers/application_controller.rb +3 -0
 - data/spec/dummy/app/helpers/application_helper.rb +2 -0
 - data/spec/dummy/app/helpers/manage/assets_helper.rb +2 -0
 - data/spec/dummy/app/helpers/manage/base_helper.rb +81 -0
 - data/spec/dummy/app/helpers/manage/pages_helper.rb +2 -0
 - data/spec/dummy/app/helpers/manage/settings_helper.rb +2 -0
 - data/spec/dummy/app/helpers/manage/structures_helper.rb +12 -0
 - data/spec/dummy/app/helpers/manage/users_helper.rb +6 -0
 - data/spec/dummy/app/models/defaults/ability.rb +39 -0
 - data/spec/dummy/app/models/defaults/asset.rb +7 -0
 - data/spec/dummy/app/models/defaults/attachment_file.rb +33 -0
 - data/spec/dummy/app/models/defaults/avatar.rb +37 -0
 - data/spec/dummy/app/models/defaults/header.rb +5 -0
 - data/spec/dummy/app/models/defaults/page.rb +5 -0
 - data/spec/dummy/app/models/defaults/picture.rb +35 -0
 - data/spec/dummy/app/models/defaults/position_type.rb +7 -0
 - data/spec/dummy/app/models/defaults/role.rb +20 -0
 - data/spec/dummy/app/models/defaults/role_type.rb +8 -0
 - data/spec/dummy/app/models/defaults/structure.rb +16 -0
 - data/spec/dummy/app/models/defaults/structure_type.rb +9 -0
 - data/spec/dummy/app/models/defaults/user.rb +47 -0
 - data/spec/dummy/app/views/layouts/application.html.erb +37 -0
 - data/spec/dummy/app/views/pages/show.html.erb +2 -0
 - data/spec/dummy/app/views/shared/_notice.html.erb +17 -0
 - data/spec/dummy/config/application.rb +47 -0
 - data/spec/dummy/config/application.yml.sample +4 -0
 - data/spec/dummy/config/boot.rb +10 -0
 - data/spec/dummy/config/database.yml +22 -0
 - data/spec/dummy/config/database.yml.sample +34 -0
 - data/spec/dummy/config/environment.rb +5 -0
 - data/spec/dummy/config/environments/development.rb +26 -0
 - data/spec/dummy/config/environments/production.rb +49 -0
 - data/spec/dummy/config/environments/test.rb +35 -0
 - data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
 - data/spec/dummy/config/initializers/devise.rb +204 -0
 - data/spec/dummy/config/initializers/inflections.rb +10 -0
 - data/spec/dummy/config/initializers/mime_types.rb +5 -0
 - data/spec/dummy/config/initializers/secret_token.rb +7 -0
 - data/spec/dummy/config/initializers/session_store.rb +8 -0
 - data/spec/dummy/config/initializers/simple_form.rb +93 -0
 - data/spec/dummy/config/initializers/sunrise.rb +7 -0
 - data/spec/dummy/config/locales/devise.en.yml +53 -0
 - data/spec/dummy/config/locales/en.yml +5 -0
 - data/spec/dummy/config/locales/simple_form.en.yml +24 -0
 - data/spec/dummy/config/logrotate-config.sample +9 -0
 - data/spec/dummy/config/nginx-config-passenger.sample +51 -0
 - data/spec/dummy/config/routes.rb +64 -0
 - data/spec/dummy/config.ru +4 -0
 - data/spec/dummy/db/migrate/20110801124809_sunrise_create_users.rb +29 -0
 - data/spec/dummy/db/migrate/20110801124909_sunrise_create_roles.rb +16 -0
 - data/spec/dummy/db/migrate/20110801125009_sunrise_create_structures.rb +27 -0
 - data/spec/dummy/db/migrate/20110801125109_sunrise_create_pages.rb +17 -0
 - data/spec/dummy/db/migrate/20110801125209_sunrise_create_assets.rb +28 -0
 - data/spec/dummy/db/migrate/20110801125309_sunrise_create_headers.rb +20 -0
 - data/spec/dummy/db/migrate/20110801161138_sunrise_create_widgets.rb +24 -0
 - data/spec/dummy/db/seeds.rb +25 -0
 - data/spec/dummy/db/test.sqlite3 +0 -0
 - data/spec/dummy/lib/templates/erb/scaffold/_form.html.erb +13 -0
 - data/spec/dummy/log/development.log +5 -0
 - data/spec/dummy/log/production.log +0 -0
 - data/spec/dummy/log/server.log +0 -0
 - data/spec/dummy/log/test.log +2324 -0
 - data/spec/dummy/public/404.html +26 -0
 - data/spec/dummy/public/422.html +26 -0
 - data/spec/dummy/public/500.html +26 -0
 - data/spec/dummy/public/favicon.ico +0 -0
 - data/spec/dummy/public/images/manage/add_post_bot.gif +0 -0
 - data/spec/dummy/public/images/manage/add_post_top.gif +0 -0
 - data/spec/dummy/public/images/manage/add_white_bot.gif +0 -0
 - data/spec/dummy/public/images/manage/add_white_top.gif +0 -0
 - data/spec/dummy/public/images/manage/arrow.png +0 -0
 - data/spec/dummy/public/images/manage/back_but_lc.gif +0 -0
 - data/spec/dummy/public/images/manage/back_but_rc.gif +0 -0
 - data/spec/dummy/public/images/manage/bot_corn.gif +0 -0
 - data/spec/dummy/public/images/manage/bot_duo_corn.gif +0 -0
 - data/spec/dummy/public/images/manage/but_bg.png +0 -0
 - data/spec/dummy/public/images/manage/but_block_lc.gif +0 -0
 - data/spec/dummy/public/images/manage/but_block_rc.gif +0 -0
 - data/spec/dummy/public/images/manage/but_freze_lc.gif +0 -0
 - data/spec/dummy/public/images/manage/but_freze_rc.gif +0 -0
 - data/spec/dummy/public/images/manage/but_gr.gif +0 -0
 - data/spec/dummy/public/images/manage/but_gr_l.gif +0 -0
 - data/spec/dummy/public/images/manage/but_gr_r.gif +0 -0
 - data/spec/dummy/public/images/manage/but_search.gif +0 -0
 - data/spec/dummy/public/images/manage/but_unfreze_lc.gif +0 -0
 - data/spec/dummy/public/images/manage/but_unfreze_rc.gif +0 -0
 - data/spec/dummy/public/images/manage/button_add_foto.gif +0 -0
 - data/spec/dummy/public/images/manage/button_add_foto_ru.gif +0 -0
 - data/spec/dummy/public/images/manage/button_add_foto_ua.gif +0 -0
 - data/spec/dummy/public/images/manage/button_add_foto_uk.gif +0 -0
 - data/spec/dummy/public/images/manage/cancelbutton.gif +0 -0
 - data/spec/dummy/public/images/manage/dark_arr.gif +0 -0
 - data/spec/dummy/public/images/manage/dark_arr_left.gif +0 -0
 - data/spec/dummy/public/images/manage/dark_cross_ico.gif +0 -0
 - data/spec/dummy/public/images/manage/dot.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_bg.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_bg_small.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_bg_small_blocked.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_bg_small_frozed.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_bg_small_notact.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_bot_small.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_bot_small_blocked.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_bot_small_frozed.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_bot_small_notact.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_top_small.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_top_small_blocked.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_top_small_frozed.gif +0 -0
 - data/spec/dummy/public/images/manage/duo_top_small_notact.gif +0 -0
 - data/spec/dummy/public/images/manage/edit_white_top.gif +0 -0
 - data/spec/dummy/public/images/manage/empty.gif +0 -0
 - data/spec/dummy/public/images/manage/filter_bot_bg.gif +0 -0
 - data/spec/dummy/public/images/manage/filter_top_bg.gif +0 -0
 - data/spec/dummy/public/images/manage/flag_en.gif +0 -0
 - data/spec/dummy/public/images/manage/flag_en_nonact.gif +0 -0
 - data/spec/dummy/public/images/manage/flag_ru.gif +0 -0
 - data/spec/dummy/public/images/manage/flag_ru_nonact.gif +0 -0
 - data/spec/dummy/public/images/manage/flag_ua.gif +0 -0
 - data/spec/dummy/public/images/manage/flag_ua_nonact.gif +0 -0
 - data/spec/dummy/public/images/manage/foto.jpg +0 -0
 - data/spec/dummy/public/images/manage/ico_add.gif +0 -0
 - data/spec/dummy/public/images/manage/ico_del.gif +0 -0
 - data/spec/dummy/public/images/manage/ico_down.gif +0 -0
 - data/spec/dummy/public/images/manage/ico_edit.gif +0 -0
 - data/spec/dummy/public/images/manage/ico_settings.gif +0 -0
 - data/spec/dummy/public/images/manage/ico_up.gif +0 -0
 - data/spec/dummy/public/images/manage/input_bg.gif +0 -0
 - data/spec/dummy/public/images/manage/l_but_corn.gif +0 -0
 - data/spec/dummy/public/images/manage/minimise_but.gif +0 -0
 - data/spec/dummy/public/images/manage/mp3.png +0 -0
 - data/spec/dummy/public/images/manage/page_arr_hover.png +0 -0
 - data/spec/dummy/public/images/manage/page_next_arr.gif +0 -0
 - data/spec/dummy/public/images/manage/page_num_hover.gif +0 -0
 - data/spec/dummy/public/images/manage/page_prev_arr.gif +0 -0
 - data/spec/dummy/public/images/manage/panel/l_but_corn.gif +0 -0
 - data/spec/dummy/public/images/manage/panel/maximise_but.gif +0 -0
 - data/spec/dummy/public/images/manage/panel/r_but_corn.gif +0 -0
 - data/spec/dummy/public/images/manage/panel/top_menu_arr.gif +0 -0
 - data/spec/dummy/public/images/manage/panel/user_pic.gif +0 -0
 - data/spec/dummy/public/images/manage/preloader.gif +0 -0
 - data/spec/dummy/public/images/manage/r_but_corn.gif +0 -0
 - data/spec/dummy/public/images/manage/select_bg.gif +0 -0
 - data/spec/dummy/public/images/manage/select_corn.gif +0 -0
 - data/spec/dummy/public/images/manage/struct_corn_lg.gif +0 -0
 - data/spec/dummy/public/images/manage/struct_corn_llg.gif +0 -0
 - data/spec/dummy/public/images/manage/struct_corn_lw.gif +0 -0
 - data/spec/dummy/public/images/manage/struct_corn_rg.gif +0 -0
 - data/spec/dummy/public/images/manage/struct_corn_rlg.gif +0 -0
 - data/spec/dummy/public/images/manage/struct_corn_rw.gif +0 -0
 - data/spec/dummy/public/images/manage/tab_gl.gif +0 -0
 - data/spec/dummy/public/images/manage/tab_gr.gif +0 -0
 - data/spec/dummy/public/images/manage/tab_wl.gif +0 -0
 - data/spec/dummy/public/images/manage/tab_wr.gif +0 -0
 - data/spec/dummy/public/images/manage/top_corn.gif +0 -0
 - data/spec/dummy/public/images/manage/top_duo_corn.gif +0 -0
 - data/spec/dummy/public/images/manage/top_menu_arr.gif +0 -0
 - data/spec/dummy/public/images/manage/transp_cross.png +0 -0
 - data/spec/dummy/public/images/manage/upload_progress.gif +0 -0
 - data/spec/dummy/public/images/manage/user_act_lc.gif +0 -0
 - data/spec/dummy/public/images/manage/user_act_rc.gif +0 -0
 - data/spec/dummy/public/images/manage/user_ico.gif +0 -0
 - data/spec/dummy/public/images/manage/user_pic.gif +0 -0
 - data/spec/dummy/public/images/manage/user_pic_small.gif +0 -0
 - data/spec/dummy/public/images/manage/user_pic_thumb.gif +0 -0
 - data/spec/dummy/public/javascripts/application.js +2 -0
 - data/spec/dummy/public/javascripts/controls.js +965 -0
 - data/spec/dummy/public/javascripts/datepicker/jquery-ui-i18n.js +1176 -0
 - data/spec/dummy/public/javascripts/datepicker/jquery.ui.datepicker-ru.js +37 -0
 - data/spec/dummy/public/javascripts/datepicker/jquery.ui.datepicker-uk.js +37 -0
 - data/spec/dummy/public/javascripts/dragdrop.js +974 -0
 - data/spec/dummy/public/javascripts/effects.js +1123 -0
 - data/spec/dummy/public/javascripts/fileupload/fileuploader-input.js +217 -0
 - data/spec/dummy/public/javascripts/fileupload/fileuploader.css +31 -0
 - data/spec/dummy/public/javascripts/fileupload/fileuploader.js +1288 -0
 - data/spec/dummy/public/javascripts/jquery-ui-timepicker-addon.js +911 -0
 - data/spec/dummy/public/javascripts/jquery.cookie.js +97 -0
 - data/spec/dummy/public/javascripts/jquery.fancybox-1.3.4.pack.js +46 -0
 - data/spec/dummy/public/javascripts/jquery.tmpl.min.js +10 -0
 - data/spec/dummy/public/javascripts/manage-fileuploader.js +182 -0
 - data/spec/dummy/public/javascripts/manage.js +294 -0
 - data/spec/dummy/public/javascripts/preloader.js +47 -0
 - data/spec/dummy/public/javascripts/prototype.js +6001 -0
 - data/spec/dummy/public/javascripts/rails.js +331 -0
 - data/spec/dummy/public/stylesheets/application.css +1 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/blank.gif +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_close.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_loading.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_nav_left.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_nav_right.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_shadow_e.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_shadow_n.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_shadow_ne.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_shadow_nw.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_shadow_s.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_shadow_se.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_shadow_sw.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_shadow_w.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_title_left.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_title_main.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_title_over.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancy_title_right.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancybox-x.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancybox-y.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/images/fancybox.png +0 -0
 - data/spec/dummy/public/stylesheets/fancybox/jquery.fancybox-1.3.4.css +359 -0
 - data/spec/dummy/public/stylesheets/manage/buttons.css +42 -0
 - data/spec/dummy/public/stylesheets/manage/ie.css +16 -0
 - data/spec/dummy/public/stylesheets/manage/main.css +1108 -0
 - data/spec/dummy/public/stylesheets/manage/panel.css +126 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-icons_222222_256x240.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-icons_454545_256x240.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-icons_888888_256x240.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
 - data/spec/dummy/public/stylesheets/smoothness/jquery-ui-1.8.13.custom.css +578 -0
 - data/spec/dummy/script/rails +6 -0
 - data/spec/factories/structure_factory.rb +22 -0
 - data/spec/factories/user_factory.rb +48 -0
 - data/spec/factories/widget_factory.rb +12 -0
 - data/spec/generators/install_generator_spec.rb +27 -0
 - data/spec/integration/navigation_spec.rb +9 -0
 - data/spec/models/widget_spec.rb +30 -0
 - data/spec/spec.opts +2 -0
 - data/spec/spec_helper.rb +57 -0
 - data/spec/sunrise_widgets_spec.rb +7 -0
 - data/spec/support/helpers/controller_macros.rb +40 -0
 - data/spec/tmp/app/models/widget.rb +6 -0
 - data/spec/tmp/app/models/widget_position.rb +14 -0
 - data/spec/tmp/app/models/widget_type.rb +15 -0
 - data/spec/tmp/app/sweepers/widget_sweeper.rb +21 -0
 - data/spec/tmp/db/migrate/20110818113026_sunrise_create_widgets.rb +24 -0
 - metadata +587 -0
 
| 
         @@ -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 );
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /* Aimbulance */
         
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     | 
| 
         Binary file 
     |