mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
More work
This commit is contained in:
parent
a1b7239b7e
commit
cb403a5b29
@ -8,6 +8,13 @@ extends:
|
|||||||
parserOptions:
|
parserOptions:
|
||||||
ecmaVersion: 12
|
ecmaVersion: 12
|
||||||
rules:
|
rules:
|
||||||
|
no-var: off
|
||||||
|
guard-for-in: off
|
||||||
|
no-trailing-spaces: off
|
||||||
|
camelcase: off
|
||||||
|
padded-blocks: off
|
||||||
|
prefer-const: off
|
||||||
|
max-len: off
|
||||||
indent:
|
indent:
|
||||||
- error
|
- error
|
||||||
- 4
|
- 4
|
||||||
|
@ -12,10 +12,22 @@
|
|||||||
reloadTableFilters,
|
reloadTableFilters,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload a named table
|
||||||
|
* @param table
|
||||||
|
*/
|
||||||
function reloadtable(table) {
|
function reloadtable(table) {
|
||||||
$(table).bootstrapTable('refresh');
|
$(table).bootstrapTable('refresh');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a URL for display
|
||||||
|
* @param {String} text
|
||||||
|
* @param {String} url
|
||||||
|
* @param {object} options
|
||||||
|
* @returns link text
|
||||||
|
*/
|
||||||
function renderLink(text, url, options={}) {
|
function renderLink(text, url, options={}) {
|
||||||
if (url === null || url === undefined || url === '') {
|
if (url === null || url === undefined || url === '') {
|
||||||
return text;
|
return text;
|
||||||
@ -63,6 +75,11 @@ function linkButtonsToSelection(table, buttons) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the input looks like a valid number
|
||||||
|
* @param {String} n
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
function isNumeric(n) {
|
function isNumeric(n) {
|
||||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||||
}
|
}
|
||||||
@ -134,7 +151,6 @@ function convertQueryParameters(params, filters) {
|
|||||||
var ordering = params['sort'] || null;
|
var ordering = params['sort'] || null;
|
||||||
|
|
||||||
if (ordering) {
|
if (ordering) {
|
||||||
|
|
||||||
if (order == 'desc') {
|
if (order == 'desc') {
|
||||||
ordering = `-${ordering}`;
|
ordering = `-${ordering}`;
|
||||||
}
|
}
|
||||||
@ -332,42 +348,42 @@ function customGroupSorter(sortName, sortOrder, sortData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Expose default bootstrap table string literals to translation layer
|
// Expose default bootstrap table string literals to translation layer
|
||||||
(function ($) {
|
(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$.fn.bootstrapTable.locales['en-US-custom'] = {
|
$.fn.bootstrapTable.locales['en-US-custom'] = {
|
||||||
formatLoadingMessage: function () {
|
formatLoadingMessage: function() {
|
||||||
return '{% trans "Loading data" %}';
|
return '{% trans "Loading data" %}';
|
||||||
},
|
},
|
||||||
formatRecordsPerPage: function (pageNumber) {
|
formatRecordsPerPage: function(pageNumber) {
|
||||||
return `${pageNumber} {% trans "rows per page" %}`;
|
return `${pageNumber} {% trans "rows per page" %}`;
|
||||||
},
|
},
|
||||||
formatShowingRows: function (pageFrom, pageTo, totalRows) {
|
formatShowingRows: function(pageFrom, pageTo, totalRows) {
|
||||||
return `{% trans "Showing" %} ${pageFrom} {% trans "to" %} ${pageTo} {% trans "of" %} ${totalRows} {% trans "rows" %}`;
|
return `{% trans "Showing" %} ${pageFrom} {% trans "to" %} ${pageTo} {% trans "of" %} ${totalRows} {% trans "rows" %}`;
|
||||||
},
|
},
|
||||||
formatSearch: function () {
|
formatSearch: function() {
|
||||||
return '{% trans "Search" %}';
|
return '{% trans "Search" %}';
|
||||||
},
|
},
|
||||||
formatNoMatches: function () {
|
formatNoMatches: function() {
|
||||||
return '{% trans "No matching results" %}';
|
return '{% trans "No matching results" %}';
|
||||||
},
|
},
|
||||||
formatPaginationSwitch: function () {
|
formatPaginationSwitch: function() {
|
||||||
return '{% trans "Hide/Show pagination" %}';
|
return '{% trans "Hide/Show pagination" %}';
|
||||||
},
|
},
|
||||||
formatRefresh: function () {
|
formatRefresh: function() {
|
||||||
return '{% trans "Refresh" %}';
|
return '{% trans "Refresh" %}';
|
||||||
},
|
},
|
||||||
formatToggle: function () {
|
formatToggle: function() {
|
||||||
return '{% trans "Toggle" %}';
|
return '{% trans "Toggle" %}';
|
||||||
},
|
},
|
||||||
formatColumns: function () {
|
formatColumns: function() {
|
||||||
return '{% trans "Columns" %}';
|
return '{% trans "Columns" %}';
|
||||||
},
|
},
|
||||||
formatAllRows: function () {
|
formatAllRows: function() {
|
||||||
return '{% trans "All" %}';
|
return '{% trans "All" %}';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US-custom']);
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US-custom']);
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
Loading…
Reference in New Issue
Block a user