Commit 14a932f1 authored by Filipa Lacerda's avatar Filipa Lacerda

Fix context for jquery event

Remove unused function
parent 6a8faac2
...@@ -34,12 +34,12 @@ export const isInIssuePage = () => { ...@@ -34,12 +34,12 @@ export const isInIssuePage = () => {
}; };
window.gl.utils.isInIssuePage = isInGroupsPage; window.gl.utils.isInIssuePage = isInGroupsPage;
window.gl.utils.ajaxGet = url => $.ajax({ export const ajaxGet = url => $.ajax({
type: 'GET', type: 'GET',
url, url,
dataType: 'script', dataType: 'script',
}); });
export const ajaxGet = window.gl.utils.ajaxGet; window.gl.utils.ajaxGet = ajaxGet;
export const ajaxPost = (url, data) => $.ajax({ export const ajaxPost = (url, data) => $.ajax({
type: 'POST', type: 'POST',
...@@ -48,10 +48,7 @@ export const ajaxPost = (url, data) => $.ajax({ ...@@ -48,10 +48,7 @@ export const ajaxPost = (url, data) => $.ajax({
}); });
window.gl.utils.ajaxPost = ajaxPost; window.gl.utils.ajaxPost = ajaxPost;
// TODO: This function seems not to be used anywhere export const rstrip = (val) => {
// window.gl.utils.extractLast = term => this.split(term).pop();
export const rstrip = function rstrip(val) {
if (val) { if (val) {
return val.replace(/\s+$/, ''); return val.replace(/\s+$/, '');
} }
...@@ -68,7 +65,8 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa ...@@ -68,7 +65,8 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa
if (rstrip(field.val()) === '') { if (rstrip(field.val()) === '') {
closestSubmit.disable(); closestSubmit.disable();
} }
return field.on(eventName, () => { // eslint-disable-next-line func-names
return field.on(eventName, function () {
if (rstrip($(this).val()) === '') { if (rstrip($(this).val()) === '') {
return closestSubmit.disable(); return closestSubmit.disable();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment