Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix jQuery .on mimic syntax (must use .live instead of .bind)

  • Loading branch information...
commit cd6bd16ae9ec8510bac3a771074079075c634d88 1 parent f8cb0db
@frodenas frodenas authored
View
56 app/assets/javascripts/apps.js.erb
@@ -33,8 +33,8 @@ $(function() {
appsTable = $('#apps-table').dataTable(appsTable_Settings);
var ultabs = $('ul.tabs');
ultabs.tabs('div.panels > div.panel', {effect: 'slide', tabs: 'li'});
- ultabs
- .on('onClick', function(event, tabIndex) {
+ $(document)
+ .on('onClick', ultabs, function(event, tabIndex) {
var tab = $(this).find('li.current > a').attr('href');
if (tab == '#apps') {
$('.invoke-modalBox').html('<button class="createApplication" rel="#create_application_modalBox">' + I18n.t('apps.js.add_app') + '</button>').toggle();
@@ -60,109 +60,109 @@ $(function() {
});
$('#new-app-form .help').tooltip({'effect': 'fade', 'tipClass': 'help-tip'});
$('#new-app-form').validator({'effect': 'below_field_error', 'inputEvent': 'blur', 'lang': validatorTools_lang});
- $('#new-app-form')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#new-app-form', function(evt, xhr, settings) {
var validator = $('#new-app-form').data('validator');
if (!validator.checkValidity()) return false;
request_processed = false;
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('assets.js.ajax_processing')});
})
- .on('ajax:success', function(evt, data, status, xhr) {
+ .on('ajax:success', '#new-app-form', function(evt, data, status, xhr) {
if (request_processed == true) {
$(this).find('input[type="text"],input[type="number"],input[type="url"]').val('');
}
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#new-app-form', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#new-app-form', function(evt, xhr, status) {
if (request_processed == true) {
createApplication_trigger.eq(0).overlay().close();
}
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('apps.js.add_app')});
});
- $('#start-app-link')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#start-app-link', function(evt, xhr, settings) {
request_processed = false;
$(this).find('img').attr({ src : '<%= asset_path('wait.gif') %>'}).removeClass('start');
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#start-app-link', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#start-app-link', function(evt, xhr, status) {
if (request_processed == false) {
$(this).find('img').attr({ src : '<%= asset_path('s.gif') %>'}).addClass('start');
}
});
- $('#stop-app-link')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#stop-app-link', function(evt, xhr, settings) {
request_processed = false;
$(this).find('img').attr({ src : '<%= asset_path('wait.gif') %>'}).removeClass('stop');
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#stop-app-link', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#stop-app-link', function(evt, xhr, status) {
if (request_processed == false) {
$(this).find('img').attr({ src : '<%= asset_path('s.gif') %>'}).addClass('stop');
}
});
- $('#restart-app-link')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#restart-app-link', function(evt, xhr, settings) {
request_processed = false;
$(this).find('img').attr({ src : '<%= asset_path('wait.gif') %>'}).removeClass('restart');
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#restart-app-link', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#restart-app-link', function(evt, xhr, status) {
if (request_processed == false) {
$(this).find('img').attr({ src : '<%= asset_path('s.gif') %>'}).addClass('restart');
}
});
$('#upload-app-bits-form .help').tooltip({'effect': 'fade', 'tipClass': 'help-tip'});
$('#upload-app-bits-form').validator({'effect': 'below_field_error', 'inputEvent': 'blur', 'lang': validatorTools_lang});
- $('#upload-app-bits-form')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#upload-app-bits-form', function(evt, xhr, settings) {
var validator = $('#upload-app-bits-form').data('validator');
if (!validator.checkValidity()) return false;
request_processed = false;
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('assets.js.ajax_processing')});
})
- .on('ajax:success', function(evt, data, status, xhr) {
+ .on('ajax:success', '#upload-app-bits-form', function(evt, data, status, xhr) {
if (request_processed == true) {
$(this).find('input[type="url"],input[type="text"]').val('');
}
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#upload-app-bits-form', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#upload-app-bits-form', function(evt, xhr, status) {
if (request_processed == true) {
uploadAppBits_trigger.each(function() { $(this).overlay().close(); });
}
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('apps.js.upload_bits')});
});
- $('#delete-app-link')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#delete-app-link', function(evt, xhr, settings) {
$(this).find('img').attr({ src : '<%= asset_path('wait.gif') %>'}).removeClass('delete');
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#delete-app-link', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#delete-app-link', function(evt, xhr, status) {
$(this).find('img').attr({ src : '<%= asset_path('s.gif') %>'}).addClass('delete');
});
}
View
58 app/assets/javascripts/appsshow.js.erb
@@ -46,8 +46,8 @@ $(function() {
appUrlsTable = $('#app-urls-table').dataTable(appUrlsTable_Settings);
var ultabs = $('ul.tabs');
ultabs.tabs('div.panels > div.panel', {effect: 'slide', tabs: 'li'});
- ultabs
- .on('onClick', function(event, tabIndex) {
+ $(document)
+ .on('onClick', ultabs, function(event, tabIndex) {
var tab = $(this).find('li.current > a').attr('href');
if (tab == '#resources') {
$('.invoke-modalBox').empty().hide();
@@ -232,116 +232,116 @@ $(function() {
});
$('#set-var-form .help').tooltip({'effect': 'fade', 'tipClass': 'help-tip'});
$('#set-var-form').validator({'effect': 'below_field_error', 'inputEvent': 'blur', 'lang': validatorTools_lang});
- $('#set-var-form')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#set-var-form', function(evt, xhr, settings) {
var validator = $('#set-var-form').data('validator');
if (!validator.checkValidity()) return false;
request_processed = false;
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('assets.js.ajax_processing')});
})
- .on('ajax:success', function(evt, data, status, xhr) {
+ .on('ajax:success', '#set-var-form', function(evt, data, status, xhr) {
if (request_processed == true) {
$(this).find('input[type="text"]').val('');
}
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#set-var-form', function(evt, xhr, status, error) {
request_processed = true;
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {;
+ .on('ajax:complete', '#set-var-form', function(evt, xhr, status) {;
if (request_processed == true) {
addEnvvar_trigger.eq(0).overlay().close();
}
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('apps.js.add_envvar')});
});
- $('#unset-var-link')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#unset-var-link', function(evt, xhr, settings) {
$(this).find('img').attr({ src : '<%= asset_path('wait.gif') %>'}).removeClass('delete');
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#unset-var-link', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#unset-var-link', function(evt, xhr, status) {
$(this).find('img').attr({ src : '<%= asset_path('s.gif') %>'}).addClass('delete');
});
$('#bind-service-form .help').tooltip({'effect': 'fade', 'tipClass': 'help-tip'});
$('#bind-service-form').validator({'effect': 'below_field_error', 'inputEvent': 'blur', 'lang': validatorTools_lang});
- $('#bind-service-form')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#bind-service-form', function(evt, xhr, settings) {
var validator = $('#bind-service-form').data('validator');
if (!validator.checkValidity()) return false;
request_processed = false;
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('assets.js.ajax_processing')});
})
- .on('ajax:success', function(evt, data, status, xhr) {
+ .on('ajax:success', '#bind-service-form', function(evt, data, status, xhr) {
if (request_processed == true) {
$(this).find('select').val('');
}
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#bind-service-form', function(evt, xhr, status, error) {
request_processed = true;
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#bind-service-form', function(evt, xhr, status) {
if (request_processed == true) {
bindService_trigger.eq(0).overlay().close();
}
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('apps.js.add_service')});
});
- $("#unbind-service-link")
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#unbind-service-link', function(evt, xhr, settings) {
$(this).find('img').attr({ src : '<%= asset_path('wait.gif') %>'}).removeClass('delete');
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#unbind-service-link', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#unbind-service-link', function(evt, xhr, status) {
$(this).find('img').attr({ src : '<%= asset_path('s.gif') %>'}).addClass('delete');
});
$('#map-url-form .help').tooltip({'effect': 'fade', 'tipClass': 'help-tip'});
$('#map-url-form').validator({'effect': 'below_field_error', 'inputEvent': 'blur', 'lang': validatorTools_lang});
- $('#map-url-form')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#map-url-form', function(evt, xhr, settings) {
var validator = $('#map-url-form').data('validator');
if (!validator.checkValidity()) return false;
request_processed = false;
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('assets.js.ajax_processing')});
})
- .on('ajax:success', function(evt, data, status, xhr) {
+ .on('ajax:success', '#map-url-form', function(evt, data, status, xhr) {
if (request_processed == true) {
$(this).find('input[type="url"]').val('');
}
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#map-url-form', function(evt, xhr, status, error) {
request_processed = true;
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#map-url-form', function(evt, xhr, status) {
if (request_processed == true) {
addURL_trigger.eq(0).overlay().close();
}
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('apps.js.add_url')});
});
- $('#unmap-url-link')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#unmap-url-link', function(evt, xhr, settings) {
$(this).find('img').attr({ src : '<%= asset_path('wait.gif') %>'}).removeClass('delete');
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#unmap-url-link', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#unmap-url-link', function(evt, xhr, status) {
$(this).find('img').attr({ src : '<%= asset_path('s.gif') %>'}).addClass('delete');
});
}
View
4 app/assets/javascripts/dashboard.js.erb
@@ -4,8 +4,8 @@ $(function() {
$('#dashboard-menu-link').addClass('menu-current');
var ultabs = $('ul.tabs');
ultabs.tabs('div.panels > div.panel', {effect: 'slide', tabs: 'li'});
- ultabs
- .on('onClick', function(event, tabIndex) {
+ $(document)
+ .on('onClick', ultabs, function(event, tabIndex) {
var tab = $(this).find('li.current > a').attr('href');
if (tab == '#account') {
$('.help').tooltip({'effect': 'fade', 'tipClass': 'help-tip'});
View
26 app/assets/javascripts/services.js.erb
@@ -16,8 +16,8 @@ $(function() {
servicesTable = $('#services-table').dataTable(servicesTable_Settings);
var ultabs = $('ul.tabs');
ultabs.tabs('div.panels > div.panel', {effect: 'slide', tabs: 'li'});
- ultabs
- .on('onClick', function(event, tabIndex) {
+ $(document)
+ .on('onClick', ultabs, function(event, tabIndex) {
var tab = $(this).find('li.current > a').attr('href');
if (tab == '#services') {
$('.invoke-modalBox').html('<button class="addService" rel="#add_service_modalBox">' + I18n.t('services.js.add_service') + '</button>').toggle();
@@ -37,48 +37,48 @@ $(function() {
});
$('#new-service-form .help').tooltip({'effect': 'fade', 'tipClass': 'help-tip'});
$('#new-service-form').validator({'effect': 'below_field_error', 'inputEvent': 'blur', 'lang': validatorTools_lang});
- $('#new-service-form select#ss')
- .on('change', function() {
+ $(document)
+ .on('change', '#new-service-form select#ss', function() {
var app_name = $('#new-service-form input#name');
var ss_name = $(this).val()
if (ss_name != '') {
app_name.val($(this).val() + '-' + Math.round(Math.random() * 0x0100000 ).toString(16));
}
});
- $('#new-service-form')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#new-service-form', function(evt, xhr, settings) {
var validator = $('#new-service-form').data('validator');
if (!validator.checkValidity()) return false;
request_processed = false;
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('assets.js.ajax_processing')});
})
- .on('ajax:success', function(evt, data, status, xhr) {
+ .on('ajax:success', '#new-service-form', function(evt, data, status, xhr) {
if (request_processed == true) {
$(this).find('input[type="text"]').val('');
}
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#new-service-form', function(evt, xhr, status, error) {
request_processed = true;
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#new-service-form', function(evt, xhr, status) {
if (request_processed == true) {
addService_trigger.eq(0).overlay().close();
}
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('services.js.add_service')});
});
- $('#delete-service-link')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#delete-service-link', function(evt, xhr, settings) {
$(this).find('img').attr({ src : '<%= asset_path('wait.gif') %>'}).removeClass('delete');
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#delete-service-link', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#delete-service-link', function(evt, xhr, status) {
$(this).find('img').attr({ src : '<%= asset_path('s.gif') %>'}).addClass('delete');
});
}
View
22 app/assets/javascripts/users.js.erb
@@ -16,8 +16,8 @@ $(function() {
usersTable = $('#users-table').dataTable(usersTable_Settings);
var ultabs = $('ul.tabs');
ultabs.tabs('div.panels > div.panel', {effect: 'slide', tabs: 'li'});
- ultabs
- .on('onClick', function(event, tabIndex) {
+ $(document)
+ .on('onClick', ultabs, function(event, tabIndex) {
var tab = $(this).find('li.current > a').attr('href');
if (tab == '#users') {
$('.invoke-modalBox').html('<button class="addUser" rel="#add_user_modalBox">' + I18n.t('users.js.add_user') + '</button>').toggle();
@@ -34,40 +34,40 @@ $(function() {
});
$('#new-user-form .help').tooltip({'effect': 'fade', 'tipClass': 'help-tip'});
$('#new-user-form').validator({'effect': 'below_field_error', 'inputEvent': 'blur', 'lang': validatorTools_lang});
- $('#new-user-form')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#new-user-form', function(evt, xhr, settings) {
var validator = $('#new-user-form').data('validator');
if (!validator.checkValidity()) return false;
request_processed = false;
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('assets.js.ajax_processing')});
})
- .on('ajax:success', function(evt, data, status, xhr) {
+ .on('ajax:success', '#new-user-form', function(evt, data, status, xhr) {
if (request_processed == true) {
$(this).find('input[type="email"],input[type="password"]').val('');
}
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#new-user-form', function(evt, xhr, status, error) {
request_processed = true;
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#new-user-form', function(evt, xhr, status) {
if (request_processed == true) {
addUser_trigger.eq(0).overlay().close();
}
$(this).find('.modalBox-submit input[type="submit"]').attr({value: I18n.t('users.js.add_user')});
});
- $('#delete-user-link')
- .on('ajax:beforeSend', function(evt, xhr, settings) {
+ $(document)
+ .on('ajax:beforeSend', '#delete-user-link', function(evt, xhr, settings) {
$(this).find('img').attr({ src : '<%= asset_path('wait.gif') %>'}).removeClass('delete');
})
- .on('ajax:error', function(evt, xhr, status, error) {
+ .on('ajax:error', '#delete-user-link', function(evt, xhr, status, error) {
$('#flash-content').empty();
$('#flash-content').append('<div class="alert">' + I18n.t('assets.js.ajax_error') + '</div>');
$('#flash').fadeIn('slow');
})
- .on('ajax:complete', function(evt, xhr, status) {
+ .on('ajax:complete', '#delete-user-link', function(evt, xhr, status) {
$(this).find('img').attr({ src : '<%= asset_path('s.gif') %>'}).addClass('delete');
});
}
View
4 app/views/apps/_app_new.html.haml
@@ -84,8 +84,8 @@
- content_for :javascripts do
:javascript
$(function() {
- $('#new-app-form input#url')
- .on('focus', function() {
+ $(document)
+ .on('focus', '#new-app-form input#url', function() {
if ($(this).val() == "") {
var app_name = $('#new-app-form input#name');
$(this).val('http://' + app_name.val() + '.#{@newapp_default_urldomain}');
Please sign in to comment.
Something went wrong with that request. Please try again.