mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 03:30:25 +00:00
add trash icon, remove delete button (people aren't deleting the same
tasks, maybe this will help them). add a bunch of tooltips on the controls. prevent accidental deletes
This commit is contained in:
parent
2febd15ba4
commit
f68dcbf469
3 changed files with 41 additions and 24 deletions
|
|
@ -76,6 +76,7 @@ ready(function(model) {
|
|||
$('[rel=tooltip]').tooltip();
|
||||
$('[rel=popover]').popover();
|
||||
model.on('set', '*', function() {
|
||||
$('[rel=tooltip]').tooltip();
|
||||
return $('[rel=popover]').popover();
|
||||
});
|
||||
if (!(model.get('_mobileDevice') === true)) {
|
||||
|
|
@ -191,19 +192,27 @@ ready(function(model) {
|
|||
var history, result, task;
|
||||
task = model.at(e.target);
|
||||
history = task.get('history');
|
||||
if (history && history.length > 3 && task.get('value') < 0) {
|
||||
result = confirm("Are you sure? Deleting this task will hurt you (to prevent deleting, then re-creating red tasks).");
|
||||
if (result !== true) {
|
||||
return;
|
||||
if (history && history.length > 2) {
|
||||
if (task.get('value') < 0) {
|
||||
result = confirm("Are you sure? Deleting this task will hurt you (to prevent deleting, then re-creating red tasks).");
|
||||
if (result !== true) {
|
||||
return;
|
||||
} else {
|
||||
task.set('type', 'habit');
|
||||
scoring.score({
|
||||
user: model.at('_user'),
|
||||
task: task,
|
||||
direction: 'down'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
task.set('type', 'habit');
|
||||
scoring.score({
|
||||
user: model.at('_user'),
|
||||
task: task,
|
||||
direction: 'down'
|
||||
});
|
||||
result = confirm("Are you sure you want to delete this task?");
|
||||
if (result !== true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
$('[rel=tooltip]').tooltip('hide');
|
||||
model.del('_user.tasks.' + task.get('id'));
|
||||
return task.remove();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ ready (model) ->
|
|||
$('[rel=popover]').popover()
|
||||
# FIXME: this isn't very efficient, do model.on set for specific attrs for popover
|
||||
model.on 'set', '*', ->
|
||||
$('[rel=tooltip]').tooltip()
|
||||
$('[rel=popover]').popover()
|
||||
|
||||
unless (model.get('_mobileDevice') == true) #don't do sortable on mobile
|
||||
|
|
@ -157,18 +158,25 @@ ready (model) ->
|
|||
# Derby extends model.at to support creation from DOM nodes
|
||||
task = model.at(e.target)
|
||||
|
||||
# prevent long-standing red tasks from being deleted
|
||||
history = task.get('history')
|
||||
if history and history.length>3 and task.get('value')<0
|
||||
result = confirm("Are you sure? Deleting this task will hurt you (to prevent deleting, then re-creating red tasks).")
|
||||
if result != true
|
||||
return # Cancel. Don't delete, don't hurt user
|
||||
if history and history.length>2
|
||||
# prevent delete-and-recreate hack on red tasks
|
||||
if task.get('value') < 0
|
||||
result = confirm("Are you sure? Deleting this task will hurt you (to prevent deleting, then re-creating red tasks).")
|
||||
if result != true
|
||||
return # Cancel. Don't delete, don't hurt user
|
||||
else
|
||||
task.set('type','habit') # hack to make sure it hits HP, instead of performing "undo checkbox"
|
||||
scoring.score({user:model.at('_user'), task:task, direction:'down'})
|
||||
|
||||
# prevent accidently deleting long-standing tasks
|
||||
else
|
||||
task.set('type','habit') # hack to make sure it hits HP, instead of performing "undo checkbox"
|
||||
scoring.score({user:model.at('_user'), task:task, direction:'down'})
|
||||
result = confirm("Are you sure you want to delete this task?")
|
||||
return if result != true
|
||||
|
||||
#TODO bug where I have to delete from _users.tasks AND _{type}List,
|
||||
# fix when query subscriptions implemented properly
|
||||
$('[rel=tooltip]').tooltip('hide')
|
||||
model.del('_user.tasks.'+task.get('id'))
|
||||
task.remove()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<ui:connectionAlert>
|
||||
<div id="head">
|
||||
<div class='pull-right'>
|
||||
<a class='btn pull-right' onClick="$('#copy-link-section').toggle();"><i class=icon-user></i></a><br/>
|
||||
<a class='btn pull-right' onClick="$('#copy-link-section').toggle();"><i class=icon-bookmark></i></a><br/>
|
||||
<div id=copy-link-section style='display:none;' class=well>
|
||||
<h3>Secret Link</h3>
|
||||
<p>Authentication isn't yet available (<a href="https://github.com/lefnire/habitrpg#how-do-i-log-in--save-my-data">follow progress here</a>),<br/>
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
<div class="bar" style="width: {percent(_user.stats.exp,_user._tnl)}%;"></div>
|
||||
<span class="progress-text">
|
||||
{#if _user.history.exp}
|
||||
<a x-bind=click:toggleChart data-toggle-id="exp-chart" data-history-path="_user.history.exp"><i class=icon-signal></i></a>
|
||||
<a x-bind=click:toggleChart data-toggle-id="exp-chart" data-history-path="_user.history.exp" rel=tooltip title="Progress"><i class=icon-signal></i></a>
|
||||
{/}
|
||||
<i class=icon-star></i> {round(_user.stats.exp)} / {_user._tnl}
|
||||
</span>
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{#if _user.history.todos}
|
||||
<a x-bind=click:toggleChart data-toggle-id="todos-chart" data-history-path="_user.history.todos"><i class=icon-signal></i></a>
|
||||
<a x-bind=click:toggleChart data-toggle-id="todos-chart" data-history-path="_user.history.todos" rel=tooltip title="Progress"><i class=icon-signal></i></a>
|
||||
<div id="todos-chart" style="display:none;"></div>
|
||||
{/}
|
||||
</app:taskColumn>
|
||||
|
|
@ -208,9 +208,10 @@
|
|||
<div class="task-meta-controls">
|
||||
|
||||
<div class="hover-show">
|
||||
<a x-bind=click:toggleTaskEdit data-hide-id="{{:task.id}}-chart" data-toggle-id="{{:task.id}}-edit"><i class="icon-pencil"></i></a>
|
||||
<a x-bind=click:toggleTaskEdit data-hide-id="{{:task.id}}-chart" data-toggle-id="{{:task.id}}-edit" rel=tooltip title="Edit"><i class="icon-pencil"></i></a>
|
||||
<a x-bind=click:del rel=tooltip title="Delete"><i class="icon-trash"></i></a>
|
||||
{#if :task.history}
|
||||
<a x-bind=click:toggleChart data-toggle-id="{{:task.id}}-chart" data-hide-id="{{:task.id}}-edit" data-history-path="_user.tasks.{{:task.id}}.history">
|
||||
<a x-bind=click:toggleChart data-toggle-id="{{:task.id}}-chart" data-hide-id="{{:task.id}}-edit" data-history-path="_user.tasks.{{:task.id}}.history" rel=tooltip title="Progress">
|
||||
<i class="icon-signal"></i>
|
||||
</a>
|
||||
{/}
|
||||
|
|
@ -267,8 +268,7 @@
|
|||
</label>
|
||||
</div>
|
||||
{/}
|
||||
<button type=submit class="btn">Save</button>
|
||||
<button x-bind=click:del class="btn btn-danger">Delete</button>
|
||||
<button type=submit class="btn">Save & Close</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue