diff --git a/Gemfile b/Gemfile index 7798ecf..dc8ce30 100644 --- a/Gemfile +++ b/Gemfile @@ -130,7 +130,9 @@ group :assets do gem 'execjs' gem 'therubyracer', :platform => :ruby # C Ruby (MRI) or Rubinius, but NOT Windows gem 'uglifier', '>= 1.0.3' - gem 'jquery-rails' + # We can't upgrade because not compatible to jquery >= 1.9. + # To do that, we need fix the rails.js + gem 'jquery-rails', '~> 2.1.4' gem 'pjax_rails' gem 'underscore-rails' gem 'turbo-sprockets-rails3' diff --git a/Gemfile.lock b/Gemfile.lock index 1a4eba8..690c402 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,7 +132,7 @@ GEM has_scope (0.5.1) hashie (1.2.0) highline (1.6.19) - hike (1.2.2) + hike (1.2.3) hipchat (0.9.0) httparty httparty @@ -152,7 +152,7 @@ GEM has_scope (~> 0.5.0) responders (~> 0.9) journey (1.0.4) - jquery-rails (3.0.0) + jquery-rails (2.1.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.0) @@ -191,7 +191,7 @@ GEM bundler (>= 1.0.0) rails (>= 3.0.0) railties (>= 3.0.0) - multi_json (1.7.4) + multi_json (1.7.6) multi_xml (0.5.3) multipart-post (1.2.0) net-scp (1.1.1) @@ -406,7 +406,7 @@ DEPENDENCIES htmlentities httparty inherited_resources - jquery-rails + jquery-rails (~> 2.1.4) kaminari (>= 0.14.1) launchy lighthouse-api diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index 8476ff3..d14dc03 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -1,5 +1,8 @@ +// We can't use jquery > 1.9 //= require jquery //= require underscore +// This rails.js version is not like the original. +// We can't upgrade to the official version //= require rails //= require form //= require jquery.pjax diff --git a/app/assets/javascripts/errbit.js b/app/assets/javascripts/errbit.js index b95dbb1..9ce20e7 100644 --- a/app/assets/javascripts/errbit.js +++ b/app/assets/javascripts/errbit.js @@ -14,21 +14,12 @@ $(function() { bindRequiredPasswordMarks(); - $('#watcher_name').live("click", function() { - $(this).closest('form').find('.show').removeClass('show'); - $('#app_watchers_attributes_0_user_id').addClass('show'); - }); - - $('#watcher_email').live("click", function() { - $(this).closest('form').find('.show').removeClass('show'); - $('#app_watchers_attributes_0_email').addClass('show'); - }); - - $('a.copy_config').live("click", function() { + // On page apps/:app_id/edit + $('a.copy_config').on("click", function() { $('select.choose_other_app').show().focus(); }); - $('select.choose_other_app').live("change", function() { + $('select.choose_other_app').on("change", function() { var loc = window.location; window.location.href = loc.protocol + "//" + loc.host + loc.pathname + "?copy_attributes_from=" + $(this).val(); @@ -82,7 +73,7 @@ $(function() { function toggleProblemsCheckboxes() { var checkboxToggler = $('#toggle_problems_checkboxes'); - checkboxToggler.live("click", function() { + checkboxToggler.on("click", function() { $('input[name^="problems"]').each(function() { this.checked = checkboxToggler.get(0).checked; }); @@ -125,7 +116,7 @@ $(function() { $('td.backtrace_separator').hide(); } // Show external backtrace lines when clicking separator - $('td.backtrace_separator span').live('click', show_external_backtrace); + $('td.backtrace_separator span').on('click', show_external_backtrace); // Hide external backtrace on page load hide_external_backtrace(); diff --git a/app/assets/javascripts/form.js b/app/assets/javascripts/form.js index e659166..09b7c42 100644 --- a/app/assets/javascripts/form.js +++ b/app/assets/javascripts/form.js @@ -19,7 +19,8 @@ $(function(){ }); function activateNestedForms() { - $('.nested-wrapper').each(function(){ + var wrapper = $('.nested-wrapper') + wrapper.each(function(){ var wrapper = $(this); makeNestedItemsDestroyable(wrapper); @@ -28,7 +29,7 @@ function activateNestedForms() { addLink.click(appendNestedItem); wrapper.append(addLink); }); - $('.nested a.remove-nested').live('click',removeNestedItem); + wrapper.on('click','.nested a.remove-nested', removeNestedItem); } function makeNestedItemsDestroyable(wrapper) { @@ -80,7 +81,7 @@ function activateTypeSelector(field_class, section_class) { $('div.'+field_class+' > div.'+section_class).not('.chosen').find('input') .attr('disabled','disabled').val(''); - $('div.'+field_class+' input[name*=type]').live('click', function(){ + $('div.'+field_class+' input[name*=type]').on('click', function(){ // Look for section in 'data-section', and fall back to 'value' var chosen = $(this).data("section") || $(this).val(); var wrapper = $(this).closest('.nested'); diff --git a/app/assets/javascripts/jquery.alerts.js b/app/assets/javascripts/jquery.alerts.js index bb3b3a1..ba018eb 100644 --- a/app/assets/javascripts/jquery.alerts.js +++ b/app/assets/javascripts/jquery.alerts.js @@ -12,7 +12,7 @@ // $.jAlert( message, [title, callback] ) // $.jConfirm( message, [title, callback] ) // $.jPrompt( message, [value, title, callback] ) -// +// // History: // // 1.00 - Released (29 December 2008) @@ -22,16 +22,16 @@ // 1.2 - global methods removed. // // License: -// +// // This plugin is dual-licensed under the GNU General Public License and the MIT License and -// is copyright 2008 A Beautiful Site, LLC. +// is copyright 2008 A Beautiful Site, LLC. // (function($) { - + $.alerts = { - + // These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time - + verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/ repositionOnResize: true, // re-centers the dialog on window resize @@ -46,37 +46,37 @@ confirm: 'Confirm', prompt: 'Prompt' }, - + // Public methods - + alert: function(message, title, callback) { if (! title) title = $.alerts.titles.alert; $.alerts._show(title, message, null, 'alert', function(result) { if (callback) callback(result); }); }, - + confirm: function(message, title, callback) { if (! title) title = $.alerts.titles.confirm; $.alerts._show(title, message, null, 'confirm', function(result) { if (callback) callback(result); }); }, - + prompt: function(message, value, title, callback) { if (! title) title = $.alerts.titles.prompt; $.alerts._show(title, message, value, 'prompt', function(result) { if(callback) callback(result); }); }, - + // Private methods - + _show: function(title, msg, value, type, callback) { - + $.alerts._hide(); $.alerts._overlay('show'); - + $("BODY").append( '' + ''); - + if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass); - + // IE6 Fix - var pos = ($.browser.msie && parseInt($.browser.version, 10) <= 6 ) ? 'absolute' : 'fixed'; - + // No more $.browser in Jquery > 1,9 and not support IE 6 + // var pos = ($.browser.msie && parseInt($.browser.version, 10) <= 6 ) ? 'absolute' : 'fixed'; + var pos = 'fixed'; + $("#popup_container").css({ position: pos, zIndex: 99999, padding: 0, margin: 0 }); - + $("#popup_title").text(title); $("#popup_content").addClass(type); $("#popup_message").text(msg); $("#popup_message").html( $("#popup_message").text().replace(/\n/g, '
') ); - + $("#popup_container").css({ minWidth: $("#popup_container").outerWidth(), maxWidth: $("#popup_container").outerWidth() }); - + $.alerts._reposition(); $.alerts._maintainPosition(true); - + switch( type ) { case 'alert': $("#popup_message").after(''); @@ -158,20 +160,20 @@ break; default: break; } - + // Make draggable if ($.alerts.draggable && $.fn.draggable) { $("#popup_container").draggable({ handle: $("#popup_title") }); $("#popup_title").css({ cursor: 'move' }); } }, - + _hide: function() { $("#popup_container").remove(); $.alerts._overlay('hide'); $.alerts._maintainPosition(false); }, - + _overlay: function(status) { switch( status ) { case 'show': @@ -194,23 +196,23 @@ default: break; } }, - + _reposition: function() { var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset; var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset; if( top < 0 ) top = 0; if( left < 0 ) left = 0; - + // IE6 fix - if( $.browser.msie && parseInt($.browser.version, 10) <= 6 ) top = top + $(window).scrollTop(); - + // if( $.browser.msie && parseInt($.browser.version, 10) <= 6 ) top = top + $(window).scrollTop(); + $("#popup_container").css({ top: top + 'px', left: left + 'px' }); $("#popup_overlay").height( $(document).height() ); }, - + _maintainPosition: function(status) { if( $.alerts.repositionOnResize ) { switch(status) { @@ -224,7 +226,7 @@ } } } - + }; - -})(jQuery); \ No newline at end of file + +})(jQuery); diff --git a/app/assets/javascripts/rails.js b/app/assets/javascripts/rails.js index c3550bb..e43d639 100644 --- a/app/assets/javascripts/rails.js +++ b/app/assets/javascripts/rails.js @@ -1,7 +1,7 @@ /** * Unobtrusive scripting adapter for jQuery * - * Requires jQuery 1.6.0 or later. + * Requires jQuery 1.6.0. Not compatible to jquery > 1.9 * https://github.com/rails/jquery-ujs * Uploading file using rails.js @@ -131,11 +131,11 @@ method = element.data('method'); url = element.data('url'); data = element.serialize(); - if (element.data('params')) data = data + "&" + element.data('params'); + if (element.data('params')) data = data + "&" + element.data('params'); } else { method = element.data('method'); url = element.attr('href'); - data = element.data('params') || null; + data = element.data('params') || null; } options = { -- libgit2 0.21.2