mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-02 04:00:36 +00:00
Add ability to hide completed dailies.
While I was at it, I also did a bit of refactoring in general around the hiding of completed todos/dailies.
This commit is contained in:
parent
2a8128872d
commit
c4a2e720fd
4 changed files with 35 additions and 11 deletions
|
|
@ -185,4 +185,24 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
|||
$.getScript('//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
|
||||
(window.adsbygoogle = window.adsbygoogle || []).push({});
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------
|
||||
Hiding Tasks
|
||||
------------------------
|
||||
*/
|
||||
|
||||
$scope.shouldShow = function(task, list, prefs){
|
||||
if (task.type == 'habit' || task.type == 'reward')
|
||||
return true;
|
||||
var shouldDo = task.type == 'daily' ? habitrpgShared.shouldDo(new Date, task.repeat, prefs) : true;
|
||||
switch (list.view) {
|
||||
case "remaining":
|
||||
return !task.completed && shouldDo;
|
||||
case "complete":
|
||||
return task.completed || !shouldDo;
|
||||
case "all":
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
|
|
|||
|
|
@ -69,11 +69,13 @@ habitrpg
|
|||
}, {
|
||||
header: window.env.t('dailies'),
|
||||
type: 'daily',
|
||||
placeHolder: window.env.t('newDaily')
|
||||
placeHolder: window.env.t('newDaily'),
|
||||
view: "remaining"
|
||||
}, {
|
||||
header: window.env.t('todos'),
|
||||
type: 'todo',
|
||||
placeHolder: window.env.t('newTodo')
|
||||
placeHolder: window.env.t('newTodo'),
|
||||
view: "remaining"
|
||||
}, {
|
||||
header: window.env.t('rewards'),
|
||||
type: 'reward',
|
||||
|
|
@ -159,4 +161,4 @@ habitrpg
|
|||
" <div class=\"popover-content\" ng-bind-html=\"unsafeContent\" style=\"word-wrap: break-word\"> </div>\n" +
|
||||
" </div>\n" +
|
||||
"</div>\n");
|
||||
}]);
|
||||
}]);
|
||||
|
|
|
|||
|
|
@ -101,15 +101,17 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
// Habit3
|
||||
ins.adsbygoogle(ng-init='initAds()', style='display: inline-block; width: 234px; height: 60px;', data-ad-client='ca-pub-3242350243827794', data-ad-slot='9529624576')
|
||||
|
||||
// Todo Tabs
|
||||
div(bo-if='main && list.type=="todo"', bo-class='{"tabbable tabs-below": list.type=="todo"}')
|
||||
div(ng-show='list.showCompleted')
|
||||
// Todo/Daily Tabs
|
||||
div(bo-if='main && (list.type=="daily" || list.type=="todo")', class='tabbable tabs-below')
|
||||
div(ng-show='(list.view == "complete" || list.view == "all") && list.type == todo')
|
||||
.alert
|
||||
=env.t('lotOfToDos')
|
||||
button.task-action-btn.tile.spacious.bright(ng-click='user.ops.clearCompleted({})',popover=env.t('deleteToDosExplanation'),popover-trigger='mouseenter')=env.t('clearCompleted')
|
||||
// remaining/completed tabs
|
||||
ul.nav.nav-tabs
|
||||
li(ng-class='{active: !list.showCompleted}')
|
||||
a(ng-click='list.showCompleted = false')=env.t('remaining')
|
||||
li(ng-class='{active: list.showCompleted}')
|
||||
a(ng-click='list.showCompleted= true')=env.t('complete')
|
||||
li(ng-class='{active: list.view == "remaining"}')
|
||||
a(ng-click='list.view = "remaining"')=env.t('remaining')
|
||||
li(ng-class='{active: list.view == "complete"}')
|
||||
a(ng-click='list.view = "complete"')=env.t('complete')
|
||||
li(ng-class='{active: list.view == "all"}')
|
||||
a(ng-click='list.view = "all"')=env.t('all')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
li(bindonce='list', bo-id='"task-"+task.id', ng-repeat='task in obj[list.type+"s"]', class='task {{Shared.taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main)}}', ng-click='spell && castEnd(task, "task", $event)', ng-class='{"cast-target":spell}', popover-trigger='mouseenter', data-popover-html="{{task.notes | markdown}}", data-popover-placement="top")
|
||||
li(bindonce='list', bo-id='"task-"+task.id', ng-repeat='task in obj[list.type+"s"]', class='task {{Shared.taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main)}}', ng-click='spell && castEnd(task, "task", $event)', ng-class='{"cast-target":spell}', popover-trigger='mouseenter', data-popover-html="{{task.notes | markdown}}", data-popover-placement="top", ng-show='shouldShow(task, list, user.preferences)')
|
||||
// right-hand side control buttons
|
||||
.task-meta-controls
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue