decaffeinate: fix + remove suggestions

This commit is contained in:
Euan Kemp 2020-09-18 20:08:08 -07:00
parent d1301b74e2
commit 673a5d2e44
7 changed files with 13 additions and 52 deletions

View File

@ -1,8 +1,3 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
//# This file is prepended with an underscore to ensure it comes alphabetically-first
//# when application.js includes all JS files in the directory with require_tree.
//# Here be dragons.
@ -26,9 +21,9 @@ Notebook.init = function() {
$('.dropdown-trigger').dropdown({ coverTrigger: false });
$('.tooltipped').tooltip({ enterDelay: 50 });
$('.with-character-counter').characterCounter();
return $('.materialboxed').materialbox();
$('.materialboxed').materialbox();
};
// We're using $ -> here for document readiness, but if we ever use Turbolinks we'd want:
// $(document).on "turbolinks:load", ->
$(() => Notebook.init());
$(() => Notebook.init());

View File

@ -1,12 +1,5 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
$(() => // When a user clicks to remove a collaborator, we should remove them from the list of collaborators after the remote request finishes
// When a user clicks to remove a collaborator, we should remove them from the list of collaborators after the remote request finishes
$('a.js-remove-contributor[data-remote]').on('ajax:success', function(e, data, status, xhr) {
// Remove the image from the UI
$(this).closest('.collection-item').fadeOut().remove(); // todo use animate.css for something more fun
}));
});

View File

@ -1,8 +1,3 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
Notebook.DocumentEditor = class DocumentEditor {
constructor(el) {
this.el = el;
@ -113,7 +108,6 @@ Notebook.DocumentEditor = class DocumentEditor {
} else {
console.log('Waiting for existing autosave');
}
};
editor.subscribe('editableInput', autosave);
@ -127,9 +121,8 @@ Notebook.DocumentEditor = class DocumentEditor {
if (keyCode === 9) {
e.preventDefault();
}
});
}
};
$(() => new Notebook.DocumentEditor($("body.documents.edit")));
$(() => new Notebook.DocumentEditor($("body.documents.edit")));

View File

@ -1,8 +1,3 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
$(document).ready(function() {
// Character name generator
@ -12,7 +7,7 @@ $(document).ready(function() {
dataType: 'text',
url: '/generate/character/name',
success(data) {
return target.val(data);
target.val(data);
}
});
return 0;
@ -25,20 +20,20 @@ $(document).ready(function() {
dataType: 'text',
url: '/generate/character/age',
success(data) {
return target.val(data);
target.val(data);
}
});
return 0;
});
// Location name generator
return $('.location_name_generator').click(function() {
$('.location_name_generator').click(function() {
const target = $(this).closest('.row').find('input[type=text]');
$.ajax({
dataType: 'text',
url: '/generate/location/name',
success(data) {
return target.val(data);
target.val(data);
}
});
return 0;

View File

@ -1,10 +1,5 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
$(() => // When a user clicks to delete an image, we should remove it from the list of images after the remote request finishes
// When a user clicks to delete an image, we should remove it from the list of images after the remote request finishes
$('a.js-remove-image[data-remote]').on('ajax:success', function(e, data, status, xhr) {
// Remove the image from the UI
$(this).closest('.row').fadeOut().remove(); // todo use animate.css for something more fun
}));
});

View File

@ -1,9 +1,4 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
$(document).ready(() => $('.dropdown-picker li a').click(function() {
const val = $(this).text();
return $(this).closest('.row').find('input[type=text]').val(val);
$(this).closest('.row').find('input[type=text]').val(val);
}));

View File

@ -1,8 +1,3 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
Notebook.StripeHandler = class StripeHandler {
constructor(el) {
this.el = el;
@ -41,4 +36,4 @@ Notebook.StripeHandler = class StripeHandler {
}
};
$(() => new Notebook.StripeHandler($("body.subscriptions.information")));
$(() => new Notebook.StripeHandler($("body.subscriptions.information")));