Skip to content

Commit

Permalink
Merge pull request #2301 from WikiWatershed/ki/adjust-compare-view-pa…
Browse files Browse the repository at this point in the history
…gination

Show compare pagination buttons only if > 5 scenarios

Connects #2242
  • Loading branch information
kellyi committed Oct 2, 2017
2 parents 95a06ea + 9572763 commit 08d314a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/mmw/js/src/compare/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var _ = require('lodash'),

var CHART = 'chart',
TABLE = 'table',
MIN_VISIBLE_SCENARIOS = 3,
MIN_VISIBLE_SCENARIOS = 5,
CHART_AXIS_WIDTH = 82,
COMPARE_COLUMN_WIDTH = 134;

Expand Down
21 changes: 13 additions & 8 deletions src/mmw/js/src/compare/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,21 @@ var CompareWindow2 = modalViews.ModalBaseView.extend({
prevButton = this.ui.prevButton,
nextButton = this.ui.nextButton;

if (i < 1) {
prevButton.removeClass('active');
if (total <= minScenarios) {
prevButton.hide();
nextButton.hide();
} else {
prevButton.addClass('active');
}
if (i < 1) {
prevButton.removeClass('active');
} else {
prevButton.addClass('active');
}

if (i + minScenarios >= total) {
nextButton.removeClass('active');
} else {
nextButton.addClass('active');
if (i + minScenarios >= total) {
nextButton.removeClass('active');
} else {
nextButton.addClass('active');
}
}
},

Expand Down

0 comments on commit 08d314a

Please sign in to comment.