Skip to content

Commit

Permalink
Use .on
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrooksuk committed Jul 25, 2017
1 parent 128187f commit 2b22caf
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions resources/assets/js/cachet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(function() {
$(function () {
// Ajax Setup
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
var token;
Expand Down Expand Up @@ -28,7 +28,7 @@ $(function() {
});

// Prevent double form submission
$('form').submit(function() {
$('form').submit(function () {
var $form = $(this);
$form.find(':submit').prop('disabled', true);
});
Expand All @@ -37,7 +37,7 @@ $(function() {
// autosize($('textarea.autosize'));

// Mock the DELETE form requests.
$('[data-method]').not(".disabled").append(function() {
$('[data-method]').not(".disabled").append(function () {
var methodForm = "\n";
methodForm += "<form action='" + $(this).attr('href') + "' method='POST' style='display:none'>\n";
methodForm += "<input type='hidden' name='_method' value='" + $(this).attr('data-method') + "'>\n";
Expand All @@ -46,11 +46,11 @@ $(function() {
return methodForm;
})
.removeAttr('href')
.on('click', function() {
.on('click', function () {
var button = $(this);

if (button.hasClass('confirm-action')) {
askConfirmation(function() {
askConfirmation(function () {
button.find("form").submit();
});
} else {
Expand Down Expand Up @@ -95,12 +95,12 @@ $(function() {
};
};

$(".sidebar-toggler").click(function(e) {
$(".sidebar-toggler").on('click', function (e) {
e.preventDefault();
$(".wrapper").toggleClass("toggled");
});

$('.color-code').each(function() {
$('.color-code').each(function () {
var $this = $(this);

$this.minicolors({
Expand All @@ -116,11 +116,11 @@ $(function() {

$('[data-toggle="tooltip"]').tooltip();

$('button.close').on('click', function() {
$('button.close').on('click', function () {
$(this).parents('div.alert').addClass('hide');
});

$('form[name=IncidentForm] select[name=component_id]').on('change', function() {
$('form[name=IncidentForm] select[name=component_id]').on('change', function () {
var $option = $(this).find('option:selected');
var $componentStatus = $('#component-status');

Expand Down Expand Up @@ -189,7 +189,7 @@ $(function() {
new Sortable(list, {
group: 'omega',
handle: '.drag-handle',
onUpdate: function() {
onUpdate: function () {
var orderedIds = $.map(list.querySelectorAll('[data-orderable-id]'), function(elem) {
return $(elem).data('orderable-id');
});
Expand All @@ -201,10 +201,10 @@ $(function() {
data: {
ids: orderedIds
},
success: function() {
success: function () {
notifier.notify('Ordering updated.', 'success');
},
error: function() {
error: function () {
notifier.notify('Ordering not updated.', 'error');
}
});
Expand All @@ -213,7 +213,7 @@ $(function() {
});

// Toggle inline component statuses.
$('form.component-inline').on('click', 'input[type=radio]', function() {
$('form.component-inline').on('click', 'input[type=radio]', function () {
var $form = $(this).parents('form');
var formData = $form.serializeObject();

Expand All @@ -232,7 +232,7 @@ $(function() {
});

// Incident management
$('select[name=template]').on('change', function() {
$('select[name=template]').on('change', function () {
var $this = $(this).find('option:selected'),
slug = $this.val();

Expand All @@ -249,15 +249,15 @@ $(function() {
$form.find('input[name=name]').val(tpl.name);
$form.find('textarea[name=message]').val(tpl.template);
},
error: function() {
error: function () {
(new Cachet.Notifier()).notify('There was an error finding that template.');
}
});
}
});

// Banner removal JS
$('#remove-banner').click(function(){
$('#remove-banner').on('click', function (){
$('#banner-view').remove();
$('input[name=remove_banner]').val('1');
});
Expand Down Expand Up @@ -310,7 +310,7 @@ $(function() {
(new Cachet.Notifier()).notify(error);
});
})
.always(function() {
.always(function () {
$btn.button('reset');
});

Expand Down

0 comments on commit 2b22caf

Please sign in to comment.