Working with updated _edit model

This commit is contained in:
Husman
2016-06-21 20:39:26 -07:00
parent cfacf039df
commit 1a6f08545b
14 changed files with 170 additions and 137 deletions

View File

@@ -30,11 +30,89 @@ describe('Tasks Controller', function() {
}); });
describe('editTask', function() { describe('editTask', function() {
it('is Tasks.editTask', function() {
inject(function(Tasks) { var task;
expect(scope.editTask).to.eql(Tasks.editTask);
}); beforeEach(function(){
task = specHelper.newTask();
}); });
it('toggles the _editing property', function() {
scope.editTask(task, user);
expect(task._editing).to.eql(true);
});
it('sets _tags to true by default', function() {
scope.editTask(task, user);
expect(task._tags).to.eql(true);
});
it('sets _tags to false if preference for collapsed tags is turned on', function() {
user.preferences.tagsCollapsed = true;
scope.editTask(task, user);
expect(task._tags).to.eql(false);
});
it('sets _advanced to true by default', function(){
user.preferences.advancedCollapsed = true;
scope.editTask(task, user);
expect(task._advanced).to.eql(false);
});
it('sets _advanced to false if preference for collapsed advance menu is turned on', function() {
user.preferences.advancedCollapsed = false;
scope.editTask(task, user);
expect(task._advanced).to.eql(true);
});
});
describe('cancelEdit', function() {
var task;
beforeEach(function(){
task = specHelper.newTask();
});
it('resets the task text', function() {
let originalText = task.text;
scope.editTask(task, user);
task.text = 'test';
scope.cancelTaskEdit(task)
expect(task.text).to.be.eql(originalText);
});
it('resets the task notes', function() {
let originalNotes = task.notes;
scope.editTask(task, user);
task.notes = 'test';
scope.cancelTaskEdit(task)
expect(task.notes).to.be.eql(originalNotes);
});
it('resets the task alias', function() {
task.alias = 'alias';
let originalAlias = task.alias;
scope.editTask(task, user);
task.alias = 'test';
scope.cancelTaskEdit(task)
expect(task.alias).to.be.eql(originalAlias);
});
it('resets the task priority', function() {
let originalPriority = task.priority;
scope.editTask(task, user);
task.priority = 'test';
scope.cancelTaskEdit(task)
expect(task.priority).to.be.eql(originalPriority);
});
}); });
describe('removeTask', function() { describe('removeTask', function() {

View File

@@ -150,56 +150,6 @@ describe('Tasks Service', function() {
$httpBackend.flush(); $httpBackend.flush();
}); });
describe('editTask', function() {
var task;
beforeEach(function(){
task = specHelper.newTask();
});
it('toggles the _editing property', function() {
tasks.editTask(task, user);
expect(task._editing).to.eql(true);
tasks.editTask(task, user);
expect(task._editing).to.eql(false);
});
it('sets _tags to true by default', function() {
tasks.editTask(task, user);
expect(task._tags).to.eql(true);
});
it('sets _tags to false if preference for collapsed tags is turned on', function() {
user.preferences.tagsCollapsed = true;
tasks.editTask(task, user);
expect(task._tags).to.eql(false);
});
it('sets _advanced to true by default', function(){
user.preferences.advancedCollapsed = true;
tasks.editTask(task, user);
expect(task._advanced).to.eql(false);
});
it('sets _advanced to false if preference for collapsed advance menu is turned on', function() {
user.preferences.advancedCollapsed = false;
tasks.editTask(task, user);
expect(task._advanced).to.eql(true);
});
it('closes task chart if it exists', function() {
rootScope.charts[task.id] = true;
tasks.editTask(task, user);
expect(rootScope.charts[task.id]).to.eql(false);
});
});
describe('cloneTask', function() { describe('cloneTask', function() {
context('generic tasks', function() { context('generic tasks', function() {

View File

@@ -35,6 +35,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
} }
$scope.editTask = Tasks.editTask; $scope.editTask = Tasks.editTask;
$scope.cancelTaskEdit = Tasks.cancelTaskEdit;
/** /**
* Create * Create
@@ -274,6 +275,8 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
}; };
$scope.saveTask = function(task){ $scope.saveTask = function(task){
angular.copy(task._edit, task);
task._edit = undefined;
task._editing = false; task._editing = false;
// TODO persist // TODO persist
} }

View File

@@ -68,8 +68,6 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
list.focus = true; list.focus = true;
}; };
$scope.editTask = Tasks.editTask;
/** /**
* Add the new task to the actions log * Add the new task to the actions log
*/ */
@@ -100,18 +98,18 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
} }
}; };
$scope.removeTask = function(task) { $scope.editTask = Tasks.editTask;
if (!confirm(window.env.t('sureDelete', {taskType: window.env.t(task.type), taskText: task.text}))) return;
User.deleteTask({params:{id: task._id, taskType: task.type}})
};
$scope.saveTask = function(task, stayOpen, isSaveAndClose) { $scope.saveTask = function saveTask(task, stayOpen, isSaveAndClose) {
if (task.checklist) { if (task.checklist) {
task.checklist = _.filter(task.checklist, function (i) { task.checklist = _.filter(task.checklist, function (i) {
return !!i.text return !!i.text
}); });
} }
User.updateTask(task, {body: task});
angular.copy(task._edit, task);
var output = User.updateTask(task, {body: task});
console.log( output );
if (!stayOpen) task._editing = false; if (!stayOpen) task._editing = false;
if (isSaveAndClose) { if (isSaveAndClose) {
@@ -124,14 +122,12 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
/** /**
* Reset $scope.task to $scope.originalTask * Reset $scope.task to $scope.originalTask
*/ */
$scope.cancel = function() { $scope.cancelTaskEdit = Tasks.cancelTaskEdit;
var key;
for (key in $scope.task) { $scope.removeTask = function(task) {
$scope.task[key] = $scope.originalTask[key]; if (!confirm(window.env.t('sureDelete', {taskType: window.env.t(task.type), taskText: task.text}))) return;
} task._edit = undefined;
$scope.originalTask = null; User.deleteTask({params:{id: task._id, taskType: task.type}})
$scope.editedTask = null;
$scope.editing = false;
}; };
$scope.unlink = function(task, keep) { $scope.unlink = function(task, keep) {
@@ -190,16 +186,15 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
} }
$scope.addChecklist = function(task) { $scope.addChecklist = function(task) {
task.checklist = [{completed:false, text:""}]; task._edit.checklist = [{completed:false, text:""}];
focusChecklist(task,0); focusChecklist(task._edit,0);
} }
$scope.addChecklistItem = function(task, $event, $index) { $scope.addChecklistItem = function(task, $event, $index) {
if (task.checklist[$index].text) { if (task._edit.checklist[$index].text) {
$scope.saveTask(task, true); if ($index === task._edit.checklist.length - 1)
if ($index === task.checklist.length - 1) task._edit.checklist.push({ completed: false, text: '' });
task.checklist.push({ completed: false, text: '' }); focusChecklist(task._edit, $index + 1);
focusChecklist(task, $index + 1);
} else { } else {
// TODO Provide UI feedback that this item is still blank // TODO Provide UI feedback that this item is still blank
} }
@@ -208,24 +203,24 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
$scope.removeChecklistItem = function(task, $event, $index, force) { $scope.removeChecklistItem = function(task, $event, $index, force) {
// Remove item if clicked on trash icon // Remove item if clicked on trash icon
if (force) { if (force) {
if (task.checklist[$index].id) Tasks.removeChecklistItem(task._id, task.checklist[$index].id); // if (task._edit.checklist[$index].id) Tasks.removeChecklistItem(task._id, task.checklist[$index].id);
task.checklist.splice($index, 1); task._edit.checklist.splice($index, 1);
} else if (!task.checklist[$index].text) { } else if (!task._edit.checklist[$index].text) {
// User deleted all the text and is now wishing to delete the item // User deleted all the text and is now wishing to delete the item
// saveTask will prune the empty item // saveTask will prune the empty item
if (task.checklist[$index].id) Tasks.removeChecklistItem(task._id, task.checklist[$index].id); // if (task._edit.checklist[$index].id) Tasks.removeChecklistItem(task._id, task.checklist[$index].id);
// Move focus if the list is still non-empty // Move focus if the list is still non-empty
if ($index > 0) if ($index > 0)
focusChecklist(task, $index-1); focusChecklist(task._edit, $index-1);
// Don't allow the backspace key to navigate back now that the field is gone // Don't allow the backspace key to navigate back now that the field is gone
$event.preventDefault(); $event.preventDefault();
} }
} }
$scope.swapChecklistItems = function(task, oldIndex, newIndex) { $scope.swapChecklistItems = function(task, oldIndex, newIndex) {
var toSwap = task.checklist.splice(oldIndex, 1)[0]; var toSwap = task._edit.checklist.splice(oldIndex, 1)[0];
task.checklist.splice(newIndex, 0, toSwap); task._edit.checklist.splice(newIndex, 0, toSwap);
$scope.saveTask(task, true); // $scope.saveTask(task, true);
} }
$scope.navigateChecklist = function(task,$index,$event){ $scope.navigateChecklist = function(task,$index,$event){

View File

@@ -151,12 +151,18 @@ angular.module('habitrpg')
}; };
function editTask(task, user) { function editTask(task, user) {
task._editing = !task._editing; task._editing = true;
task._tags = !user.preferences.tagsCollapsed; task._tags = !user.preferences.tagsCollapsed;
task._advanced = !user.preferences.advancedCollapsed; task._advanced = !user.preferences.advancedCollapsed;
task._edit = angular.copy(task);
if($rootScope.charts[task._id]) $rootScope.charts[task.id] = false; if($rootScope.charts[task._id]) $rootScope.charts[task.id] = false;
} }
function cancelTaskEdit(task) {
task._edit = undefined;
task._editing = false;
};
function cloneTask(task) { function cloneTask(task) {
var clonedTask = _.cloneDeep(task); var clonedTask = _.cloneDeep(task);
clonedTask = _cleanUpTask(clonedTask); clonedTask = _cleanUpTask(clonedTask);
@@ -201,6 +207,7 @@ angular.module('habitrpg')
unlinkAllTasks: unlinkAllTasks, unlinkAllTasks: unlinkAllTasks,
clearCompletedTodos: clearCompletedTodos, clearCompletedTodos: clearCompletedTodos,
editTask: editTask, editTask: editTask,
cancelTaskEdit: cancelTaskEdit,
cloneTask: cloneTask cloneTask: cloneTask
}; };
}]); }]);

View File

@@ -1,30 +1,30 @@
div(ng-if='::task.type!="reward"') div(ng-if='::task._edit.type!="reward"')
button.advanced-options-toggle.option-title.mega(type='button', button.advanced-options-toggle.option-title.mega(type='button',
ng-class='{active: task._advanced}', ng-class='{active: task._edit._advanced}',
ng-click='task._advanced = !task._advanced', tooltip=env.t('expandCollapse')) ng-click='task._edit._advanced = !task._edit._advanced', tooltip=env.t('expandCollapse'))
=env.t('advancedOptions') =env.t('advancedOptions')
fieldset.option-group.advanced-option(ng-if="task.userId" ng-show="task._advanced") fieldset.option-group.advanced-option(ng-if="task._edit.userId" ng-show="task._edit._advanced")
legend.option-title legend.option-title
a.hint(href='http://habitica.wikia.com/wiki/Task_Alias', target='_blank', popover-trigger='mouseenter', popover="{{::env.t('taskAliasPopover')}} {{::task.alias ? '\n\n\' + env.t('taskAliasPopoverWarning') : ''}}")=env.t('taskAlias') a.hint(href='http://habitica.wikia.com/wiki/Task_Alias', target='_blank', popover-trigger='mouseenter', popover="{{::env.t('taskAliasPopover')}} {{::task._edit.alias ? '\n\n\' + env.t('taskAliasPopoverWarning') : ''}}")=env.t('taskAlias')
input.form-control(ng-model='task.alias' type='text' placeholder=env.t('taskAliasPlaceholder')) input.form-control(ng-model='task._edit.alias' type='text' placeholder=env.t('taskAliasPlaceholder'))
div(ng-show='task._advanced') div(ng-show='task._edit._advanced')
div(ng-if='::task.type == "daily"') div(ng-if='::task._edit.type == "daily"')
.form-group .form-group
legend.option-title legend.option-title
span.hint(popover-title=env.t('startDateHelpTitle'), popover=env.t("startDateHelp"), popover-trigger='mouseenter') span.hint(popover-title=env.t('startDateHelpTitle'), popover=env.t("startDateHelp"), popover-trigger='mouseenter')
=env.t('startDate') =env.t('startDate')
input.form-control(type='text', ng-model='task.startDate', input.form-control(type='text', ng-model='task._edit.startDate',
datepicker-popup='{{::user.preferences.dateFormat}}', is-open='datepickerOpened', datepicker-popup='{{::user.preferences.dateFormat}}', is-open='datepickerOpened',
ng-click='datepickerOpened = true', ng-disabled='task.challenge.id') ng-click='datepickerOpened = true', ng-disabled='task._edit.challenge.id')
hr hr
.form-group .form-group
legend.option-title=env.t('repeat') legend.option-title=env.t('repeat')
select.form-control(ng-model='task.frequency', ng-disabled='task.challenge.id') select.form-control(ng-model='task._edit.frequency', ng-disabled='task._edit.challenge.id')
option(value='weekly')=env.t('repeatWeek') option(value='weekly')=env.t('repeatWeek')
option(value='daily')=env.t('repeatDays') option(value='daily')=env.t('repeatDays')
@@ -32,38 +32,38 @@ div(ng-if='::task.type!="reward"')
hr hr
fieldset.option-group.advanced-option(ng-show="task._advanced") fieldset.option-group.advanced-option(ng-show="task._edit._advanced")
legend.option-title legend.option-title
a.hint.priority-multiplier-help(href='http://habitica.wikia.com/wiki/Difficulty', target='_blank', popover-title=env.t('difficultyHelpTitle'), popover-trigger='mouseenter', popover=env.t('difficultyHelpContent'))=env.t('difficulty') a.hint.priority-multiplier-help(href='http://habitica.wikia.com/wiki/Difficulty', target='_blank', popover-title=env.t('difficultyHelpTitle'), popover-trigger='mouseenter', popover=env.t('difficultyHelpContent'))=env.t('difficulty')
ul.priority-multiplier ul.priority-multiplier
li li
button(type='button', ng-class='{active: task.priority==0.1}', button(type='button', ng-class='{active: task._edit.priority==0.1}',
ng-click='task.challenge.id || (task.priority=0.1)') ng-click='task._edit.challenge.id || (task._edit.priority=0.1)')
=env.t('trivial') =env.t('trivial')
li li
button(type='button', ng-class='{active: task.priority==1 || !task.priority}', button(type='button', ng-class='{active: task._edit.priority==1 || !task._edit.priority}',
ng-click='task.challenge.id || (task.priority=1)') ng-click='task._edit.challenge.id || (task._edit.priority=1)')
=env.t('easy') =env.t('easy')
li li
button(type='button', ng-class='{active: task.priority==1.5}', button(type='button', ng-class='{active: task._edit.priority==1.5}',
ng-click='task.challenge.id || (task.priority=1.5)') ng-click='task._edit.challenge.id || (task._edit.priority=1.5)')
=env.t('medium') =env.t('medium')
li li
button(type='button', ng-class='{active: task.priority==2}', button(type='button', ng-class='{active: task._edit.priority==2}',
ng-click='task.challenge.id || (task.priority=2)') ng-click='task._edit.challenge.id || (task._edit.priority=2)')
=env.t('hard') =env.t('hard')
span(ng-if='task.type=="daily"') span(ng-if='task._edit.type=="daily"')
legend.option-title.pull-left=env.t('restoreStreak') legend.option-title.pull-left=env.t('restoreStreak')
input.option-content(type='number', ng-model='task.streak') input.option-content(type='number', ng-model='task._edit.streak')
div(ng-if='::(user.preferences.allocationMode == "taskbased" && user.preferences.automaticAllocation) || $state.is("options.social.challenges")') div(ng-if='::(user.preferences.allocationMode == "taskbased" && user.preferences.automaticAllocation) || $state.is("options.social.challenges")')
legend.option-title.pull-left=env.t('attributes') legend.option-title.pull-left=env.t('attributes')
ul.task-attributes ul.task-attributes
each attribute, short in {str: 'strength', int: 'intelligence', con: 'constitution', per: 'perception'} each attribute, short in {str: 'strength', int: 'intelligence', con: 'constitution', per: 'perception'}
li li
button(type='button', ng-class='{active: task.attribute=="#{short}"}', button(type='button', ng-class='{active: task._edit.attribute=="#{short}"}',
ng-click='task.attribute="#{short}"', ng-click='task._edit.attribute="#{short}"',
popover=env.t('#{attribute}Example'), popover-trigger='mouseenter', popover-placement='top') popover=env.t('#{attribute}Example'), popover-trigger='mouseenter', popover-placement='top')
=env.t(attribute) =env.t(attribute)

View File

@@ -1,19 +1,19 @@
.task-checklist-edit(ng-if='::!$state.includes("options.social.challenges") && (task.type=="daily" || task.type=="todo")') .task-checklist-edit(ng-if='::!$state.includes("options.social.challenges") && (task._edit.type=="daily" || task._edit.type=="todo")')
ul ul
li li
button(type='button', ng-if='!task.checklist[0]' button(type='button', ng-if='!task._edit.checklist[0]'
popover=env.t('checklistText'), popover-trigger='mouseenter', popover-placement='bottom', popover=env.t('checklistText'), popover-trigger='mouseenter', popover-placement='bottom',
ng-click='addChecklist(task)') ng-click='addChecklist(task)')
span.glyphicon.glyphicon-tasks span.glyphicon.glyphicon-tasks
span=env.t('addChecklist') span=env.t('addChecklist')
.checklist-form(ng-if='task.checklist') .checklist-form(ng-if='task._edit.checklist')
fieldset.option-group(ng-if='!$state.includes("options.social.challenges")') fieldset.option-group(ng-if='!$state.includes("options.social.challenges")')
legend.option-title(ng-if='task.checklist[0]') legend.option-title(ng-if='task._edit.checklist[0]')
span.hint(popover=env.t('checklistText'), popover-trigger='mouseenter', popover-placement='bottom') span.hint(popover=env.t('checklistText'), popover-trigger='mouseenter', popover-placement='bottom')
=env.t('checklist') =env.t('checklist')
ul(hrpg-sort-checklist) ul(hrpg-sort-checklist)
li(ng-repeat='item in task.checklist') li(ng-repeat='item in task._edit.checklist')
//input(type='checkbox',ng-model='item.completed',ng-change='saveTask(task,true)') //input(type='checkbox',ng-model='item.completed',ng-change='saveTask(task,true)')
//-,ng-blur='saveTask(task,true)') //-,ng-blur='saveTask(task,true)')
span.checklist-icon.glyphicon.glyphicon-resize-vertical span.checklist-icon.glyphicon.glyphicon-resize-vertical

View File

@@ -1,3 +1,3 @@
fieldset.option-group.calendar(ng-if='::task.type=="daily"', class="option-group") fieldset.option-group.calendar(ng-if='::task._edit.type=="daily"', class="option-group")
.dailies .dailies
include ./repeat_options include ./repeat_options

View File

@@ -1,22 +1,22 @@
legend.option-title legend.option-title
span.hint(popover-trigger='mouseenter', popover-title=env.t('repeatHelpTitle'), span.hint(popover-trigger='mouseenter', popover-title=env.t('repeatHelpTitle'),
popover='{{env.t(task.frequency + "RepeatHelpContent")}}')=env.t('repeatEvery') popover='{{env.t(task._edit.frequency + "RepeatHelpContent")}}')=env.t('repeatEvery')
// If frequency is daily // If frequency is daily
ng-form.form-group(name='everyX' ng-if='task.frequency=="daily"') ng-form.form-group(name='everyX' ng-if='task._edit.frequency=="daily"')
.input-group .input-group
input.form-control(type='number', ng-model='task.everyX', ng-disabled='task.challenge.id', min='0', required) input.form-control(type='number', ng-model='task._edit.everyX', ng-disabled='task._edit.challenge.id', min='0', required)
span.input-group-addon {{task.everyX == 1 ? env.t('day') : env.t('days')}} span.input-group-addon {{task._edit.everyX == 1 ? env.t('day') : env.t('days')}}
// If frequency is weekly // If frequency is weekly
.form-group(ng-if='task.frequency=="weekly"') .form-group(ng-if='task._edit.frequency=="weekly"')
ul.repeat-days ul.repeat-days
// note, does not use data-toggle="buttons-checkbox" - it would interfere with our own click binding // note, does not use data-toggle="buttons-checkbox" - it would interfere with our own click binding
mixin dayOfWeek(day, num) mixin dayOfWeek(day, num)
li li
button(type='button', ng-class='{active: task.repeat.#{day}}', button(type='button', ng-class='{active: task._edit.repeat.#{day}}',
ng-disabled='task.challenge.id', ng-click='task.repeat.#{day} = !task.repeat.#{day}', ng-disabled='task._edit.challenge.id', ng-click='task._edit.repeat.#{day} = !task._edit.repeat.#{day}',
tooltip='{{env.t((task.repeat.#{day}) ? "due" : "notDue")}}') tooltip='{{env.t((task._edit.repeat.#{day}) ? "due" : "notDue")}}')
| {{::moment.weekdaysMin(#{num})}} | {{::moment.weekdaysMin(#{num})}}
+dayOfWeek('su', 0) +dayOfWeek('su', 0)

View File

@@ -1,8 +1,8 @@
fieldset.option-group.plusminus(ng-if='task.type=="habit" && !task.challenge.id') fieldset.option-group.plusminus(ng-if='task._edit.type=="habit" && !task._edit.challenge.id')
legend.option-title=env.t('direction/Actions') legend.option-title=env.t('direction/Actions')
span.task-checker span.task-checker
input.visuallyhidden.focusable(id='{{obj._id}}_{{task._id}}-option-plus', type='checkbox', ng-model='task.up') input.visuallyhidden.focusable(id='{{obj._id}}_{{task._edit._id}}-option-plus', type='checkbox', ng-model='task._edit.up')
label(for='{{obj._id}}_{{task._id}}-option-plus') label(for='{{obj._id}}_{{task._edit._id}}-option-plus')
span.task-checker span.task-checker
input.visuallyhidden.focusable(id='{{obj._id}}_{{task._id}}-option-minus', type='checkbox', ng-model='task.down') input.visuallyhidden.focusable(id='{{obj._id}}_{{task._edit._id}}-option-minus', type='checkbox', ng-model='task._edit.down')
label(for='{{obj._id}}_{{task._id}}-option-minus') label(for='{{obj._id}}_{{task._edit._id}}-option-minus')

View File

@@ -1,5 +1,5 @@
fieldset.option-group.option-short(ng-if='task.type=="reward" && !task.challenge.id') fieldset.option-group.option-short(ng-if='task._edit.type=="reward" && !task._edit.challenge.id')
legend.option-title=env.t('price') legend.option-title=env.t('price')
input.option-content(type='number', size='16', min='0', step='any', ng-model='task.value', required) input.option-content(type='number', size='16', min='0', step='any', ng-model='task._edit.value', required)
.money.input-suffix .money.input-suffix
span.shop_gold span.shop_gold

View File

@@ -1,7 +1,7 @@
fieldset.option-group fieldset.option-group
label.option-title=env.t('text') label.option-title=env.t('text')
input.form-control(type='text', ng-model='task.text', required, ng-disabled='task.challenge.id') input.form-control(type='text', ng-model='task._edit.text', required, ng-disabled='task._edit.challenge.id')
fieldset.option-group fieldset.option-group
label.option-title=env.t('extraNotes') label.option-title=env.t('extraNotes')
textarea.form-control(rows='3', ng-model='task.notes', ng-model-options="{debounce: 1000}") textarea.form-control(rows='3', ng-model='task._edit.notes')

View File

@@ -27,11 +27,11 @@
|   |  
span.glyphicon.glyphicon-pencil(ng-hide='task._editing') span.glyphicon.glyphicon-pencil(ng-hide='task._editing')
|   |  
a(ng-hide='!task._editing', ng-click='editTask(task, user)', tooltip=env.t('cancel')) a(ng-hide='!task._editing', ng-click='cancelTaskEdit(task)', tooltip=env.t('cancel'))
span.glyphicon.glyphicon-remove(ng-hide='!task._editing') span.glyphicon.glyphicon-remove(ng-hide='!task._editing')
|   |  
// save // save
a(ng-hide='!task._editing', ng-click='editTask(task, user);saveTask(task)', tooltip=env.t('save')) a(ng-hide='!task._editing', ng-click='saveTask(task)', tooltip=env.t('save'))
span.glyphicon.glyphicon-ok(ng-hide='!task._editing') span.glyphicon.glyphicon-ok(ng-hide='!task._editing')
|   |  
//challenges //challenges

View File

@@ -37,7 +37,7 @@
label(for='box-{{::obj._id}}_{{::task._id}}') label(for='box-{{::obj._id}}_{{::task._id}}')
// main content // main content
.task-text(ng-dblclick='task._editing ? saveTask(task) : editTask(task)') .task-text(ng-dblclick='task._editing ? saveTask(task) : editTask(task, user)')
markdown(text='task.text',target='_blank') markdown(text='task.text',target='_blank')
div(ng-if='task.checklist && !$state.includes("options.social.challenges") && !task.collapseChecklist && !task._editing') div(ng-if='task.checklist && !$state.includes("options.social.challenges") && !task.collapseChecklist && !task._editing')