diff --git a/src/js/widgets/preferences/templates/application.html b/src/js/widgets/preferences/templates/application.html index 5c1e3a780..d50996a28 100644 --- a/src/js/widgets/preferences/templates/application.html +++ b/src/js/widgets/preferences/templates/application.html @@ -22,6 +22,7 @@

Specifies the number of authors to show under each result before the list is truncated. + Selecting "ALL" may result in slower load times for papers with many authors.
( default: {{numAuthorsDefault}})

diff --git a/src/js/widgets/preferences/views/application.js b/src/js/widgets/preferences/views/application.js index 478eccb82..ed8ff603f 100644 --- a/src/js/widgets/preferences/views/application.js +++ b/src/js/widgets/preferences/views/application.js @@ -6,7 +6,7 @@ define([ ], function (_, Marionette, ApplicationTemplate, config) { var DEFAULTS = { numAuthors: { - initialOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + initialOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'ALL'], initialValue: 4, }, externalLinks: { @@ -209,6 +209,10 @@ define([ _convertToNumber: function (val) { try { + var normalized = String(val).toUpperCase(); + if (normalized === 'ALL' || normalized === 'NONE') { + return normalized; + } return _.isNaN(Number(val)) ? val : Number(val); } catch (e) { return val; diff --git a/test/mocha/js/widgets/results_render_widget.spec.js b/test/mocha/js/widgets/results_render_widget.spec.js index 859424519..2bb75fe3d 100644 --- a/test/mocha/js/widgets/results_render_widget.spec.js +++ b/test/mocha/js/widgets/results_render_widget.spec.js @@ -158,6 +158,18 @@ define([ expect(result).to.include('[fields orcid_other=5]'); }); + it("Should NOT apply field limiters when minAuthorsPerResult is 'ALL'", function () { + const widget = _getWidget(); + // Simulate 'ALL' setting which gets converted to POSITIVE_INFINITY + widget.minAuthorsPerResult = Number.POSITIVE_INFINITY; + const result = widget.customizeQuery(new ApiQuery({q: "star"})).get('fl')[0].split(','); + // Verify no [fields xxx] limiters are present + const hasFieldLimiters = result.some(function(field) { + return field.indexOf('[fields ') === 0; + }); + expect(hasFieldLimiters).to.be.false; + }); + it.skip("should listen to INVITING_REQUEST event", function (done) { var stub = function (apiResponse) {