Moved show counters to directive (#8537)

* Moved show counters to directive

- hide counters on challenge page
- hide counters on group page

* Changed let to var
This commit is contained in:
Keith Holliday
2017-03-07 13:58:39 -07:00
committed by GitHub
parent 7f630f2b86
commit 28c93ea869
3 changed files with 16 additions and 4 deletions

View File

@@ -72,7 +72,19 @@
$scope.showChallengeList = function () {
return $state.includes("options.social.challenges");
};
$scope.showDoubleTaskCounter = function (task, obj) {
var objectIsGroup = obj.type && (obj.type === 'guild' || obj.type === 'party');
var objectIsChallenge = $state.includes("options.social.challenges");
return !objectIsGroup && !objectIsChallenge && task.up && task.down;
};
$scope.showSingleTaskCounter = function (task, obj) {
var objectIsGroup = obj.type && (obj.type === 'guild' || obj.type === 'party');
var objectIsChallenge = $state.includes("options.social.challenges");
return !objectIsGroup && !objectIsChallenge && task.type === "habit" && (!task.up || !task.down);
};
}
}
}
}());
}());

View File

@@ -1,11 +1,11 @@
.task-meta-controls
// Counter
span(ng-if='task.up && task.down')
span(ng-if='showDoubleTaskCounter(task, obj)')
span(tooltip=env.t('habitCounterUp')) +{{task.counterUp}}|
span(tooltip=env.t('habitCounterDown')) -{{task.counterDown}} 
span(ng-if='task.type=="habit" && (!task.up || !task.down)')
span(ng-if='showSingleTaskCounter(task, obj)')
span(tooltip=env.t('habitCounter')) {{task.up ? task.counterUp : task.counterDown}} 
// Due Date

View File

@@ -5,7 +5,7 @@ script(id='templates/task-list.html', type="text/ng-template")
ng-if='showNormalList()')
task
div(ng-init='setObj(obj); console.log(obj)')
div(ng-init='setObj(obj);')
div(
ng-repeat="(key, taskList) in groupedList[list.type]",
ng-if='user.preferences.tasks.groupByChallenge && !$state.includes("options.social.challenges")')