mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 19:50:37 +00:00
add tabs to Habits (All, Yellow-Red, Green-Blue) and to rewards (All, Equipment & Skills)
This commit is contained in:
parent
3dc6d6385c
commit
5e89d07e07
3 changed files with 33 additions and 9 deletions
|
|
@ -200,16 +200,22 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
|||
$scope.shouldShow = function(task, list, prefs){
|
||||
if (task._editing) // never hide a task while being edited
|
||||
return true;
|
||||
if (task.type == 'habit' || task.type == 'todo' || task.type == 'reward')
|
||||
if (task.type == 'todo') // TODO: convert To-Dos to use this new system and probably add a "Dated" column (i.e., "Incomplete" (includes dated), "Dated" (has due date and is not complete), "Complete")
|
||||
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;
|
||||
case "yellowred": // Habits
|
||||
return task.value < 1;
|
||||
case "greenblue": // Habits
|
||||
return task.value >= 1;
|
||||
case "remaining": // Dailies and To-Dos
|
||||
return !task.completed && shouldDo;
|
||||
case "complete": // Dailies and To-Dos
|
||||
return task.completed || !shouldDo;
|
||||
case "ingamerewards": // All skills/rewards except the user's own
|
||||
return false; // Because "rewards" list includes only the user's own
|
||||
case "all":
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ habitrpg
|
|||
{
|
||||
header: window.env.t('habits'),
|
||||
type: 'habit',
|
||||
placeHolder: window.env.t('newHabit')
|
||||
placeHolder: window.env.t('newHabit'),
|
||||
view: "all"
|
||||
}, {
|
||||
header: window.env.t('dailies'),
|
||||
type: 'daily',
|
||||
|
|
@ -85,7 +86,8 @@ habitrpg
|
|||
}, {
|
||||
header: window.env.t('rewards'),
|
||||
type: 'reward',
|
||||
placeHolder: window.env.t('newReward')
|
||||
placeHolder: window.env.t('newReward'),
|
||||
view: "all"
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,15 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
hr
|
||||
|
||||
mixin taskColumnTabs(position)
|
||||
// Habits Tabs
|
||||
div(bo-if='main && list.type=="habit"', class='tabbable tabs-below')
|
||||
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 == "yellowred"}')
|
||||
a(ng-click='list.view = "yellowred"')=env.t('yellowred')
|
||||
li(ng-class='{active: list.view == "greenblue"}')
|
||||
a(ng-click='list.view = "greenblue"')=env.t('greenblue')
|
||||
// Daily Tabs
|
||||
div(bo-if='main && list.type=="daily"', class='tabbable tabs-below')
|
||||
// remaining/completed tabs
|
||||
|
|
@ -55,6 +64,13 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
a(ng-click='list.showCompleted = false')=env.t('remaining')
|
||||
li(ng-class='{active: list.showCompleted}')
|
||||
a(ng-click='list.showCompleted= true')=env.t('complete')
|
||||
// Rewards Tabs
|
||||
div(bo-if='main && list.type=="reward"', class='tabbable tabs-below')
|
||||
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 == "ingamerewards"}')
|
||||
a(ng-click='list.view = "ingamerewards"')=env.t('ingamerewards')
|
||||
|
||||
+taskColumnTabs('top')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue