Skip to content

Commit

Permalink
Refact: callback to arrow function
Browse files Browse the repository at this point in the history
  • Loading branch information
sfermigier committed Feb 9, 2021
1 parent 2676ea8 commit d31310c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion abilian/sbe/static/js/document_viewer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("SBEDocumentViewerSetup", ["Abilian", "jquery"], function (Abilian, $) {
define("SBEDocumentViewerSetup", ["Abilian", "jquery"], (Abilian, $) => {
"use strict";
function setupDocumentViewer() {
const container = $(".preview-container");
Expand Down
16 changes: 6 additions & 10 deletions abilian/sbe/static/js/folder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ define("SBEFolderListingSetup", [
"jquery",
"jquery.dataTables",
"bootbox",
], function (Abilian, $, jqDT, bootbox) {
], (Abilian, $, jqDT, bootbox) => {
"use strict";
function setupFolderListing() {
$.fn.dataTableExt.afnFiltering.push(function (
oSettings,
aData,
iDataIndex
) {
$.fn.dataTableExt.afnFiltering.push((oSettings, aData, iDataIndex) => {
const filter_value = $("#filter").val();
const row_text = aData[2].trim();
return row_text.match(new RegExp(filter_value, "i"));
Expand Down Expand Up @@ -77,12 +73,12 @@ define("SBEFolderListingSetup", [
$("input[name='object-selected']").prop("checked", checked);
}

$("a[href='#select-all']").click(function (e) {
$("a[href='#select-all']").click(e => {
setSelected(true);
e.preventDefault();
});

$("a[href='#unselect-all']").click(function (e) {
$("a[href='#unselect-all']").click(e => {
setSelected(false);
e.preventDefault();
});
Expand Down Expand Up @@ -122,7 +118,7 @@ define("SBEFolderListingSetup", [
});
msg += $("<div />").append(elList).html();

bootbox.confirm(msg, function (confirm) {
bootbox.confirm(msg, confirm => {
if (confirm) {
const actionVal = $("<input />", {
type: "hidden",
Expand All @@ -138,7 +134,7 @@ define("SBEFolderListingSetup", [
$('button.btn-danger[value="delete"]').click(onClickDelete);

/* Move file functions */
const moveFileFillListing = function (modal, folder_url) {
const moveFileFillListing = (modal, folder_url) => {
const tbody = modal.find("tbody");
const breadcrumbs = modal.find("ul.breadcrumb");

Expand Down
4 changes: 2 additions & 2 deletions abilian/sbe/static/js/folder_edit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define("SBEFolderEditSetup", ["Abilian", "jquery"], function (Abilian, $) {
define("SBEFolderEditSetup", ["Abilian", "jquery"], (Abilian, $) => {
"use strict";
function setupModalFolderInputnameCheck(modal, object_id, action) {
const $submit = modal.find("button.btn-primary");
Expand All @@ -7,7 +7,7 @@ define("SBEFolderEditSetup", ["Abilian", "jquery"], function (Abilian, $) {
const $help_span = $input.next("span.help-block");
const $control_group = $input.closest("div.form-group");

$submit.on("click", function (e) {
$submit.on("click", e => {
const title = $input.val();
$.ajax(checkUrl, {
async: false,
Expand Down
16 changes: 6 additions & 10 deletions abilian/sbe/static/js/folder_gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ define("SBEFolderGalleryListingSetup", [
"jquery",
"jquery.dataTables",
"bootbox",
], function (Abilian, $, jqDT, bootbox) {
], (Abilian, $, jqDT, bootbox) => {
"use strict";
function setupFolderListing() {
$.fn.dataTableExt.afnFiltering.push(function (
oSettings,
aData,
iDataIndex
) {
$.fn.dataTableExt.afnFiltering.push((oSettings, aData, iDataIndex) => {
const filter_value = $("#filter").val();
const row_text = aData[2].trim();
return row_text.match(new RegExp(filter_value, "i"));
Expand All @@ -21,12 +17,12 @@ define("SBEFolderGalleryListingSetup", [
$("input[name='object-selected']").prop("checked", checked);
}

$("a[href='#select-all']").click(function (e) {
$("a[href='#select-all']").click(e => {
setSelected(true);
e.preventDefault();
});

$("a[href='#unselect-all']").click(function (e) {
$("a[href='#unselect-all']").click(e => {
setSelected(false);
e.preventDefault();
});
Expand All @@ -50,7 +46,7 @@ define("SBEFolderGalleryListingSetup", [
});
msg += $("<div />").append(elList).html();

bootbox.confirm(msg, function (confirm) {
bootbox.confirm(msg, confirm => {
if (confirm) {
const actionVal = $("<input />", {
type: "hidden",
Expand All @@ -66,7 +62,7 @@ define("SBEFolderGalleryListingSetup", [
$('button.btn-danger[value="delete"]').click(onClickDelete);

/* Move file functions */
const moveFileFillListing = function (modal, folder_url) {
const moveFileFillListing = (modal, folder_url) => {
const tbody = modal.find("tbody");
const breadcrumbs = modal.find("ul.breadcrumb");

Expand Down
2 changes: 1 addition & 1 deletion abilian/sbe/static/js/folder_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ define("SBEFolderUploadSetup", [
"jquery",
"FileAPI",
"jquery.fileapi",
], function (Abilian, $, FileAPI) {
], (Abilian, $, FileAPI) => {
"use strict";
function setupModalFolderUpload(modalId, url, messages) {
let hasErrors = false;
Expand Down
2 changes: 1 addition & 1 deletion abilian/sbe/static/js/sbe-datatable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* datatable: sort types and filters */
require(["jquery", "jquery.dataTables"], function ($) {
require(["jquery", "jquery.dataTables"], $ => {
"use strict";
const FOLDER_TYPE = "abilian.sbe.apps.documents.models.folder";

Expand Down

0 comments on commit d31310c

Please sign in to comment.