mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-04 09:39:23 +00:00
challenges: fix to not apply user's active tags to new challenge
tasks, but also not apply filters except to main user's list
This commit is contained in:
parent
6507795d99
commit
9b41712ca6
3 changed files with 11 additions and 13 deletions
|
|
@ -138,17 +138,19 @@ viewHelpers = (view) ->
|
||||||
###
|
###
|
||||||
Tasks
|
Tasks
|
||||||
###
|
###
|
||||||
view.fn 'taskClasses', (task, filters, dayStart, lastCron, showCompleted=false) ->
|
view.fn 'taskClasses', (task, filters, dayStart, lastCron, showCompleted=false, main) ->
|
||||||
return unless task
|
return unless task
|
||||||
{type, completed, value, repeat} = task
|
{type, completed, value, repeat} = task
|
||||||
|
|
||||||
# completed / remaining toggle
|
# completed / remaining toggle
|
||||||
return 'hidden' if (type is 'todo') and (completed != showCompleted)
|
return 'hidden' if (type is 'todo') and (completed != showCompleted)
|
||||||
|
|
||||||
for filter, enabled of filters
|
# Filters
|
||||||
if enabled and not task.tags?[filter]
|
if main # only show when on your own list
|
||||||
# All the other classes don't matter
|
for filter, enabled of filters
|
||||||
return 'hidden'
|
if enabled and not task.tags?[filter]
|
||||||
|
# All the other classes don't matter
|
||||||
|
return 'hidden'
|
||||||
|
|
||||||
classes = type
|
classes = type
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,9 @@ module.exports.app = (appExports, model) ->
|
||||||
# Don't add a blank task; 20/02/13 Added a check for undefined value, more at issue #463 -lancemanfv
|
# Don't add a blank task; 20/02/13 Added a check for undefined value, more at issue #463 -lancemanfv
|
||||||
return if /^(\s)*$/.test(text) || text == undefined
|
return if /^(\s)*$/.test(text) || text == undefined
|
||||||
|
|
||||||
activeFilters = _.reduce user.get('filters'), ((memo,v,k) -> memo[k]=v if v;memo), {}
|
newTask = {id: model.id(), type: type, text: text, notes: '', value: 0, tags:{}}
|
||||||
newTask = {id: model.id(), type: type, text: text, notes: '', value: 0, tags: activeFilters}
|
|
||||||
|
|
||||||
isChallenge = e.at().path().indexOf('_challenge.new') != -1
|
isChallenge = e.at().path().indexOf('_challenge.new') != -1
|
||||||
if isChallenge
|
newTask.tags = if isChallenge then {} else _.reduce user.get('filters'), ((memo,v,k) -> memo[k]=v if v;memo), {}
|
||||||
activeFilters = {}
|
|
||||||
newTask.challenge = model.get '_challenge.new.id'
|
|
||||||
|
|
||||||
switch type
|
switch type
|
||||||
when 'habit'
|
when 'habit'
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@
|
||||||
<hr>
|
<hr>
|
||||||
{{/}}
|
{{/}}
|
||||||
<ul class="{{@type}}s {#unless @list}hidden{/}">
|
<ul class="{{@type}}s {#unless @list}hidden{/}">
|
||||||
{#each @list as :task}<app:tasks:task main="{@main}" />{/}
|
{#each @list as :task}<app:tasks:task main="{{@main}}" />{/}
|
||||||
</ul>
|
</ul>
|
||||||
{{@extra}}
|
{{@extra}}
|
||||||
<br/>
|
<br/>
|
||||||
|
|
@ -163,7 +163,7 @@
|
||||||
|
|
||||||
<!-- all the parts of a single task -->
|
<!-- all the parts of a single task -->
|
||||||
<task:>
|
<task:>
|
||||||
<li data-id={{:task.id}} class="task {taskClasses(:task, _user.filters, _user.preferences.dayStart, _user.lastCron, _showCompleted)}">
|
<li data-id={{:task.id}} class="task {taskClasses(:task, _user.filters, _user.preferences.dayStart, _user.lastCron, _showCompleted, @main)}">
|
||||||
|
|
||||||
<!-- right-hand side control buttons -->
|
<!-- right-hand side control buttons -->
|
||||||
<div class="task-meta-controls">
|
<div class="task-meta-controls">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue