mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-04 01:29:21 +00:00
challenges: list taken dynamically from scope so we can push/unshift to various task lists depending on location of add-task form. be careful with this commit, not the {{}} instead of {} - seems to be required otherwise things get weird
This commit is contained in:
parent
0a37637daf
commit
d28edaf30d
2 changed files with 10 additions and 5 deletions
|
|
@ -25,7 +25,7 @@ module.exports.app = (appExports, model) ->
|
|||
newTask = _.defaults {repeat:{su:true,m:true,t:true,w:true,th:true,f:true,s:true}, completed: false }, newTask
|
||||
when 'todo'
|
||||
newTask = _.defaults {completed: false }, newTask
|
||||
model.unshift "_#{type}List", newTask
|
||||
e.at().unshift newTask # e.at() in this case is the list, which was scoped here using {#with @list}...{/}
|
||||
newModel.set ''
|
||||
|
||||
appExports.del = (e, el) ->
|
||||
|
|
|
|||
|
|
@ -135,10 +135,15 @@
|
|||
{{#if equal(@type,'todo')}}<div id="todos-chart" class="hidden"></div>{{/}}
|
||||
|
||||
{{#if @editable}}
|
||||
<form class="addtask-form form-inline new-task-form {#if and(_showCompleted,equal(@type,'todo'))}hidden{/}" id="new-{{@type}}" data-task-type="{{@type}}" x-bind="submit:addTask">
|
||||
<span class="addtask-field"><input value="{@inputValue}" type="text" placeholder="{{@placeHolder}}"/></span>
|
||||
<input class="addtask-btn" type="submit" value="+">
|
||||
</form>
|
||||
|
||||
<!-- need {#with} so we can reference model.at() in the submit handler -->
|
||||
<!-- NOTE: static binding {{}} seems to be required, otherwise things get weird - e.at() is _habitList first time, _habitList.0 second time, etc -->
|
||||
{{#with @list}}
|
||||
<form class="addtask-form form-inline new-task-form {#if and(_showCompleted,equal(@type,'todo'))}hidden{/}" data-task-type="{{@type}}" x-bind="submit:addTask">
|
||||
<span class="addtask-field"><input value="{@inputValue}" type="text" placeholder="{{@placeHolder}}"/></span>
|
||||
<input class="addtask-btn" type="submit" value="+">
|
||||
</form>
|
||||
{{/}}
|
||||
<hr>
|
||||
{{/}}
|
||||
<ul class="{{@type}}s {#unless @list}hidden{/}">
|
||||
|
|
|
|||
Loading…
Reference in a new issue