mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
Merge pull request #4129 from Alys/Gaelan-hide_completed_dailies
Add ability to hide completed dailies (Gaelan's changes with fixes for merge conflicts etc)
This commit is contained in:
commit
d7c8d48078
4 changed files with 38 additions and 4 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 == 'todo' || 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: "all"
|
||||
}, {
|
||||
header: window.env.t('todos'),
|
||||
type: 'todo',
|
||||
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,8 +101,20 @@ 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')
|
||||
|
||||
// Daily Tabs
|
||||
div(bo-if='main && list.type=="daily"', class='tabbable tabs-below')
|
||||
// remaining/completed tabs
|
||||
ul.nav.nav-tabs
|
||||
li(ng-class='{active: list.view == "all"}')
|
||||
a(ng-click='list.view = "all"')=env.t('all')
|
||||
li(ng-class='{active: list.view == "remaining"}')
|
||||
a(ng-click='list.view = "remaining"')=env.t('due')
|
||||
li(ng-class='{active: list.view == "complete"}')
|
||||
a(ng-click='list.view = "complete"')=env.t('grey')
|
||||
|
||||
// Todo Tabs
|
||||
div(bo-if='main && list.type=="todo"', bo-class='{"tabbable tabs-below": list.type=="todo"}')
|
||||
// div(ng-show='list.view == "complete" || list.view == "all"')
|
||||
div(ng-show='list.showCompleted')
|
||||
.alert
|
||||
=env.t('lotOfToDos')
|
||||
|
|
@ -112,4 +124,4 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
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')
|
||||
a(ng-click='list.showCompleted= true')=env.t('complete')
|
||||
|
|
|
|||
|
|
@ -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