1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Bumped minimum ESLint version to 4.18.2.

This commit is contained in:
Markus Holtermann 2019-06-21 17:57:36 +02:00 committed by Mariusz Felisiak
parent 87b1ad6e73
commit ad7b438002
10 changed files with 107 additions and 107 deletions

View File

@ -19,7 +19,7 @@
var box = document.getElementById(id); var box = document.getElementById(id);
var node; var node;
$(box).empty(); // clear all options $(box).empty(); // clear all options
var new_options = box.outerHTML.slice(0, -9); // grab just the opening tag var new_options = box.outerHTML.slice(0, -9); // grab just the opening tag
var cache = SelectBox.cache[id]; var cache = SelectBox.cache[id];
for (var i = 0, j = cache.length; i < j; i++) { for (var i = 0, j = cache.length; i < j; i++) {
node = cache[i]; node = cache[i];
@ -48,7 +48,7 @@
token = tokens[k]; token = tokens[k];
if (node_text.indexOf(token) === -1) { if (node_text.indexOf(token) === -1) {
node.displayed = 0; node.displayed = 0;
break; // Once the first token isn't found we're done break; // Once the first token isn't found we're done
} }
} }
} }

View File

@ -8,59 +8,59 @@
var actionCheckboxes = $(this); var actionCheckboxes = $(this);
var list_editable_changed = false; var list_editable_changed = false;
var showQuestion = function() { var showQuestion = function() {
$(options.acrossClears).hide(); $(options.acrossClears).hide();
$(options.acrossQuestions).show(); $(options.acrossQuestions).show();
$(options.allContainer).hide(); $(options.allContainer).hide();
}, },
showClear = function() { showClear = function() {
$(options.acrossClears).show(); $(options.acrossClears).show();
$(options.acrossQuestions).hide(); $(options.acrossQuestions).hide();
$(options.actionContainer).toggleClass(options.selectedClass); $(options.actionContainer).toggleClass(options.selectedClass);
$(options.allContainer).show(); $(options.allContainer).show();
$(options.counterContainer).hide(); $(options.counterContainer).hide();
}, },
reset = function() { reset = function() {
$(options.acrossClears).hide(); $(options.acrossClears).hide();
$(options.acrossQuestions).hide(); $(options.acrossQuestions).hide();
$(options.allContainer).hide(); $(options.allContainer).hide();
$(options.counterContainer).show(); $(options.counterContainer).show();
}, },
clearAcross = function() { clearAcross = function() {
reset();
$(options.acrossInput).val(0);
$(options.actionContainer).removeClass(options.selectedClass);
},
checker = function(checked) {
if (checked) {
showQuestion();
} else {
reset(); reset();
} $(options.acrossInput).val(0);
$(actionCheckboxes).prop("checked", checked) $(options.actionContainer).removeClass(options.selectedClass);
.parent().parent().toggleClass(options.selectedClass, checked); },
}, checker = function(checked) {
updateCounter = function() { if (checked) {
var sel = $(actionCheckboxes).filter(":checked").length;
// data-actions-icnt is defined in the generated HTML
// and contains the total amount of objects in the queryset
var actions_icnt = $('.action-counter').data('actionsIcnt');
$(options.counterContainer).html(interpolate(
ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
sel: sel,
cnt: actions_icnt
}, true));
$(options.allToggle).prop("checked", function() {
var value;
if (sel === actionCheckboxes.length) {
value = true;
showQuestion(); showQuestion();
} else { } else {
value = false; reset();
clearAcross();
} }
return value; $(actionCheckboxes).prop("checked", checked)
}); .parent().parent().toggleClass(options.selectedClass, checked);
}; },
updateCounter = function() {
var sel = $(actionCheckboxes).filter(":checked").length;
// data-actions-icnt is defined in the generated HTML
// and contains the total amount of objects in the queryset
var actions_icnt = $('.action-counter').data('actionsIcnt');
$(options.counterContainer).html(interpolate(
ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
sel: sel,
cnt: actions_icnt
}, true));
$(options.allToggle).prop("checked", function() {
var value;
if (sel === actionCheckboxes.length) {
value = true;
showQuestion();
} else {
value = false;
clearAcross();
}
return value;
});
};
// Show counter by default // Show counter by default
$(options.counterContainer).show(); $(options.counterContainer).show();
// Check state of checkboxes and reinit state if needed // Check state of checkboxes and reinit state if needed

View File

@ -20,10 +20,10 @@
dismissClockFunc: [], dismissClockFunc: [],
dismissCalendarFunc: [], dismissCalendarFunc: [],
calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled
calendarDivName2: 'calendarin', // name of <div> that contains calendar calendarDivName2: 'calendarin', // name of <div> that contains calendar
calendarLinkName: 'calendarlink',// name of the link that is used to toggle calendarLinkName: 'calendarlink', // name of the link that is used to toggle
clockDivName: 'clockbox', // name of clock <div> that gets toggled clockDivName: 'clockbox', // name of clock <div> that gets toggled
clockLinkName: 'clocklink', // name of the link that is used to toggle clockLinkName: 'clocklink', // name of the link that is used to toggle
shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts
timezoneWarningClass: 'timezonewarning', // class of the warning for timezone mismatch timezoneWarningClass: 'timezonewarning', // class of the warning for timezone mismatch
timezoneOffset: 0, timezoneOffset: 0,
@ -399,10 +399,10 @@
var format = get_format('DATE_INPUT_FORMATS')[0]; var format = get_format('DATE_INPUT_FORMATS')[0];
// the format needs to be escaped a little // the format needs to be escaped a little
format = format.replace('\\', '\\\\') format = format.replace('\\', '\\\\')
.replace('\r', '\\r') .replace('\r', '\\r')
.replace('\n', '\\n') .replace('\n', '\\n')
.replace('\t', '\\t') .replace('\t', '\\t')
.replace("'", "\\'"); .replace("'", "\\'");
return function(y, m, d) { return function(y, m, d) {
DateTimeShortcuts.calendarInputs[num].value = new Date(y, m - 1, d).strftime(format); DateTimeShortcuts.calendarInputs[num].value = new Date(y, m - 1, d).strftime(format);
DateTimeShortcuts.calendarInputs[num].focus(); DateTimeShortcuts.calendarInputs[num].focus();

View File

@ -4,7 +4,7 @@
$('.cancel-link').on('click', function(e) { $('.cancel-link').on('click', function(e) {
e.preventDefault(); e.preventDefault();
if (window.location.search.indexOf('&_popup=1') === -1) { if (window.location.search.indexOf('&_popup=1') === -1) {
window.history.back(); // Go back if not a popup. window.history.back(); // Go back if not a popup.
} else { } else {
window.close(); // Otherwise, close the popup. window.close(); // Otherwise, close the popup.
} }

View File

@ -139,9 +139,9 @@ function findPosY(obj) {
return result; return result;
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// String object extensions // String object extensions
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
String.prototype.strptime = function(format) { String.prototype.strptime = function(format) {
var split_format = format.split(/[.\-/]/); var split_format = format.split(/[.\-/]/);
var date = this.split(/[.\-/]/); var date = this.split(/[.\-/]/);
@ -149,18 +149,18 @@ function findPosY(obj) {
var day, month, year; var day, month, year;
while (i < split_format.length) { while (i < split_format.length) {
switch (split_format[i]) { switch (split_format[i]) {
case "%d": case "%d":
day = date[i]; day = date[i];
break; break;
case "%m": case "%m":
month = date[i] - 1; month = date[i] - 1;
break; break;
case "%Y": case "%Y":
year = date[i]; year = date[i];
break; break;
case "%y": case "%y":
year = date[i]; year = date[i];
break; break;
} }
++i; ++i;
} }

View File

@ -63,8 +63,8 @@
var template = $("#" + options.prefix + "-empty"); var template = $("#" + options.prefix + "-empty");
var row = template.clone(true); var row = template.clone(true);
row.removeClass(options.emptyCssClass) row.removeClass(options.emptyCssClass)
.addClass(options.formCssClass) .addClass(options.formCssClass)
.attr("id", options.prefix + "-" + nextIndex); .attr("id", options.prefix + "-" + nextIndex);
if (row.is("tr")) { if (row.is("tr")) {
// If the forms are laid out in table rows, insert // If the forms are laid out in table rows, insert
// the remove button into the last table cell: // the remove button into the last table cell:
@ -131,16 +131,16 @@
/* Setup plugin defaults */ /* Setup plugin defaults */
$.fn.formset.defaults = { $.fn.formset.defaults = {
prefix: "form", // The form prefix for your django formset prefix: "form", // The form prefix for your django formset
addText: "add another", // Text for the add link addText: "add another", // Text for the add link
deleteText: "remove", // Text for the delete link deleteText: "remove", // Text for the delete link
addCssClass: "add-row", // CSS class applied to the add link addCssClass: "add-row", // CSS class applied to the add link
deleteCssClass: "delete-row", // CSS class applied to the delete link deleteCssClass: "delete-row", // CSS class applied to the delete link
emptyCssClass: "empty-row", // CSS class applied to the empty row emptyCssClass: "empty-row", // CSS class applied to the empty row
formCssClass: "dynamic-form", // CSS class applied to each form in a formset formCssClass: "dynamic-form", // CSS class applied to each form in a formset
added: null, // Function called each time a new form is added added: null, // Function called each time a new form is added
removed: null, // Function called each time a form is deleted removed: null, // Function called each time a form is deleted
addButton: null // Existing add button to use addButton: null // Existing add button to use
}; };
@ -149,8 +149,8 @@
var $rows = $(this); var $rows = $(this);
var alternatingRows = function(row) { var alternatingRows = function(row) {
$(selector).not(".add-row").removeClass("row1 row2") $(selector).not(".add-row").removeClass("row1 row2")
.filter(":even").addClass("row1").end() .filter(":even").addClass("row1").end()
.filter(":odd").addClass("row2"); .filter(":odd").addClass("row2");
}; };
var reinitDateTimeShortCuts = function() { var reinitDateTimeShortCuts = function() {

View File

@ -128,7 +128,7 @@
var Downcoder = { var Downcoder = {
'Initialize': function() { 'Initialize': function() {
if (Downcoder.map) { // already made if (Downcoder.map) { // already made
return; return;
} }
Downcoder.map = {}; Downcoder.map = {};
@ -183,13 +183,13 @@
// characters, whitespace, and dash; remove other characters. // characters, whitespace, and dash; remove other characters.
s = XRegExp.replace(s, XRegExp('[^-_\\p{L}\\p{N}\\s]', 'g'), ''); s = XRegExp.replace(s, XRegExp('[^-_\\p{L}\\p{N}\\s]', 'g'), '');
} else { } else {
s = s.replace(/[^-\w\s]/g, ''); // remove unneeded chars s = s.replace(/[^-\w\s]/g, ''); // remove unneeded chars
} }
s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens
s = s.substring(0, num_chars); // trim to first num_chars chars s = s.substring(0, num_chars); // trim to first num_chars chars
s = s.replace(/-+$/g, ''); // trim any trailing hyphens s = s.replace(/-+$/g, ''); // trim any trailing hyphens
return s.toLowerCase(); // convert to lowercase return s.toLowerCase(); // convert to lowercase
} }
window.URLify = URLify; window.URLify = URLify;
})(); })();

View File

@ -207,15 +207,15 @@ ol.inherits(GeometryTypeControl, ol.control.Control);
} else { } else {
geometry = features[0].getGeometry().clone(); geometry = features[0].getGeometry().clone();
for (var j = 1; j < features.length; j++) { for (var j = 1; j < features.length; j++) {
switch(geometry.getType()) { switch (geometry.getType()) {
case "MultiPoint": case "MultiPoint":
geometry.appendPoint(features[j].getGeometry().getPoint(0)); geometry.appendPoint(features[j].getGeometry().getPoint(0));
break; break;
case "MultiLineString": case "MultiLineString":
geometry.appendLineString(features[j].getGeometry().getLineString(0)); geometry.appendLineString(features[j].getGeometry().getLineString(0));
break; break;
case "MultiPolygon": case "MultiPolygon":
geometry.appendPolygon(features[j].getGeometry().getPolygon(0)); geometry.appendPolygon(features[j].getGeometry().getPolygon(0));
} }
} }
} }

View File

@ -54,7 +54,7 @@ QUnit.test('add/remove form events', function(assert) {
QUnit.test('existing add button', function(assert) { QUnit.test('existing add button', function(assert) {
var $ = django.jQuery; var $ = django.jQuery;
$('#qunit-fixture').empty(); // Clear the table added in beforeEach $('#qunit-fixture').empty(); // Clear the table added in beforeEach
$('#qunit-fixture').append($('#tabular-formset').text()); $('#qunit-fixture').append($('#tabular-formset').text());
this.table = $('table.inline'); this.table = $('table.inline');
this.inlineRow = this.table.find('tr'); this.inlineRow = this.table.find('tr');

View File

@ -9,7 +9,7 @@
"npm": ">=1.3.0 <3.0.0" "npm": ">=1.3.0 <3.0.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^0.22.1", "eslint": "^4.18.2",
"grunt": "^1.0.1", "grunt": "^1.0.1",
"grunt-cli": "^1.2.0", "grunt-cli": "^1.2.0",
"grunt-contrib-qunit": "^1.2.0" "grunt-contrib-qunit": "^1.2.0"