Skip to content

Commit

Permalink
#19 don't select more than 5 indicators by default
Browse files Browse the repository at this point in the history
  • Loading branch information
p-a-s-c-a-l committed Jan 27, 2020
1 parent 8ea0109 commit 24697e0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ angular.module(
try {

/*
*
* accept two differnt kind of files.
* 1. A plain icc data object.
* In that case we apply a standard name to this object
Expand All @@ -228,7 +227,7 @@ angular.module(
origLoadedIndicators = indicatorObject.iccdata;
worldstateDummy.iccdata = {
// this is a total mess: serialise the deserialized icc data again
// so that it can be deserilaized by icmm helper library
// so that it can be deserialized by icmm helper library
actualaccessinfo: JSON.stringify(worldstateDummy.iccdata)
};
} else {
Expand Down Expand Up @@ -308,8 +307,8 @@ angular.module(
}

// an excellent example on technical debt and accidental complexity:
// instead of adressing the root cause of the problem, we
// introduce additional inadequateness and ambiguity
// instead of adressing the root cause of the problem, sb
// introduced additional inadequateness and ambiguity
Icmm.convertToCorrectIccDataFormat(worldstateDummy);

if ($scope.worldstates) {
Expand All @@ -324,7 +323,10 @@ angular.module(
// when indicator objects are added we want them to be selected by default
$scope.selectedWorldstates.splice(0, $scope.selectedWorldstates.length);
$scope.worldstates.forEach(function (object, index) {
$scope.toggleSelection(index);
// but not more than 5 indicators!
if(index < 5) {
$scope.toggleSelection(index);
}
});

//$scope.$apply();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ angular.module(
// when indicator objects are added we want them to be selected by default
$scope.selectedWorldstates.splice(0, $scope.selectedWorldstates.length);
$scope.worldstates.forEach(function (object, index) {
$scope.toggleSelection(index);
// but not more than 5 indicators!
if(index < 5) {
$scope.toggleSelection(index);
}
});

$scope.$apply();
Expand Down
2 changes: 1 addition & 1 deletion app/templates/drupalContextProviderTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h4 class="panel-title">
ng-click="indicatorFileCollapsed = !indicatorFileCollapsed">
<i ng-if="!indicatorFileCollapsed" class="glyphicon glyphicon-chevron-up"></i>
<i ng-if="indicatorFileCollapsed" class="glyphicon glyphicon-chevron-down"></i>
Indicator files
Indicators
</a>
<span style="font-size: 14px"
class="pull-right glyphicon glyphicon-plus-sign btn-file ">
Expand Down

0 comments on commit 24697e0

Please sign in to comment.