Skip to content

Commit

Permalink
Merge pull request #857 from aholachek/export-param
Browse files Browse the repository at this point in the history
adding export widget checks for parameters
  • Loading branch information
aholachek committed Mar 14, 2016
2 parents c52a62b + 565224b commit 9c30a69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/js/apps/discovery/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,7 @@ define([

// is a special case, it opens in a new tab
if (options.onlySelected && storage.hasSelectedPapers()) {

widget.renderWidgetForListOfBibcodes(storage.getSelectedPapers(), format);
widget.renderWidgetForListOfBibcodes(storage.getSelectedPapers(), { format : format });

}
//all records specifically requested
Expand Down
9 changes: 7 additions & 2 deletions src/js/widgets/export/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,15 @@ define([
},

/**
* Export data directly - use the supplied query (must be supplied)
* @param info (object with apiQuery, numFound, and format params)
* Export data directly - uses the widget's cached query
* @param info (object with numFound, and format params)
*/
renderWidgetForCurrentQuery : function(info) {

if (!_.isObject(info)) throw new Error('info must be an object!');
if (!info.format || !info.numFound) throw new Error('info must contain the keys "format" and "numFound" ');

this.model.reset();

//navigator hands off these values
Expand Down Expand Up @@ -247,6 +250,8 @@ define([
// @param {object} data
renderWidgetForListOfBibcodes : function(recs, data) {

if (!_.isObject(data)) throw new Error('data must be an object!');

this.model.reset();

if (!_.isArray(recs)) throw new Error('Identifiers must be an array');
Expand Down

0 comments on commit 9c30a69

Please sign in to comment.