mirror of https://github.com/keeweb/keeweb.git
trash management
This commit is contained in:
parent
66a0d3dfbf
commit
0ad3aabe60
2
TODO.md
2
TODO.md
|
@ -4,7 +4,7 @@
|
|||
|
||||
- [x] improve open page UX
|
||||
- [x] provide engineer error details on file open
|
||||
- [ ] trash: delete
|
||||
- [x] trash: groups/delete/untrash
|
||||
- [x] move groups/entries
|
||||
- [ ] help/tips
|
||||
- [ ] switch view
|
||||
|
|
|
@ -20,7 +20,6 @@ var EntryModel = Backbone.Model.extend({
|
|||
this.group = group;
|
||||
this.file = file;
|
||||
this._fillByEntry();
|
||||
this._fillInTrash();
|
||||
},
|
||||
|
||||
_fillByEntry: function() {
|
||||
|
@ -91,19 +90,6 @@ var EntryModel = Backbone.Model.extend({
|
|||
return att;
|
||||
},
|
||||
|
||||
_fillInTrash: function() {
|
||||
this.deleted = false;
|
||||
if (this.file.db.meta.recycleBinEnabled) {
|
||||
var trashGroupId = this.file.db.meta.recycleBinUuid.id;
|
||||
for (var group = this.group; group; group = group.group) {
|
||||
if (group.id === trashGroupId) {
|
||||
this.deleted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_entryModified: function() {
|
||||
if (!this.unsaved) {
|
||||
this.unsaved = true;
|
||||
|
@ -223,10 +209,14 @@ var EntryModel = Backbone.Model.extend({
|
|||
if (trashGroup) {
|
||||
trashGroup.addEntry(this);
|
||||
this.group = trashGroup;
|
||||
this.deleted = true;
|
||||
}
|
||||
},
|
||||
|
||||
deleteFromTrash: function() {
|
||||
this.file.db.move(this.entry, null);
|
||||
this.group.removeEntry(this);
|
||||
},
|
||||
|
||||
removeWithoutHistory: function() {
|
||||
var ix = this.group.group.entries.indexOf(this.entry);
|
||||
if (ix >= 0) {
|
||||
|
|
|
@ -128,11 +128,15 @@ var GroupModel = MenuItemModel.extend({
|
|||
if (trashGroup) {
|
||||
trashGroup.addGroup(this);
|
||||
this.parentGroup = trashGroup;
|
||||
this.deleted = true;
|
||||
}
|
||||
this.trigger('delete');
|
||||
},
|
||||
|
||||
deleteFromTrash: function() {
|
||||
this.file.db.move(this.group, null);
|
||||
this.parentGroup.removeGroup(this);
|
||||
},
|
||||
|
||||
removeWithoutHistory: function() {
|
||||
var ix = this.parentGroup.group.groups.indexOf(this.group);
|
||||
if (ix >= 0) {
|
||||
|
|
|
@ -27,7 +27,6 @@ EntryPresenter.prototype = {
|
|||
get created() { return this.entry ? Format.dtStr(this.entry.created) : undefined; },
|
||||
get updated() { return this.entry ? Format.dtStr(this.entry.updated) : undefined; },
|
||||
get expired() { return this.entry ? this.entry.expired : false; },
|
||||
get deleted() { return this.entry ? this.entry.deleted : undefined; },
|
||||
get description() {
|
||||
if (!this.entry) {
|
||||
return '[Group]';
|
||||
|
|
|
@ -15,6 +15,7 @@ var Backbone = require('backbone'),
|
|||
DetailsAttachmentView = require('./details-attachment-view'),
|
||||
Keys = require('../../const/keys'),
|
||||
KeyHandler = require('../../comp/key-handler'),
|
||||
Alerts = require('../../comp/alerts'),
|
||||
CopyPaste = require('../../util/copy-paste'),
|
||||
Format = require('../../util/format'),
|
||||
FileSaver = require('filesaver'),
|
||||
|
@ -36,6 +37,7 @@ var DetailsView = Backbone.View.extend({
|
|||
'click .details__header-title': 'editTitle',
|
||||
'click .details__history-link': 'showHistory',
|
||||
'click .details__buttons-trash': 'moveToTrash',
|
||||
'click .details__buttons-trash-del': 'deleteFromTrash',
|
||||
'click .details__back-button': 'backClick',
|
||||
'dragover .details': 'dragover',
|
||||
'dragleave .details': 'dragleave',
|
||||
|
@ -79,7 +81,8 @@ var DetailsView = Backbone.View.extend({
|
|||
this.$el.html(this.groupTemplate());
|
||||
return;
|
||||
}
|
||||
this.$el.html(this.template(this.model));
|
||||
var model = $.extend({ deleted: this.appModel.filter.trash }, this.model);
|
||||
this.$el.html(this.template(model));
|
||||
this.setSelectedColor(this.model.color);
|
||||
this.addFieldViews();
|
||||
this.scroll = baron({
|
||||
|
@ -466,6 +469,18 @@ var DetailsView = Backbone.View.extend({
|
|||
Backbone.trigger('refresh');
|
||||
},
|
||||
|
||||
deleteFromTrash: function() {
|
||||
Alerts.yesno({
|
||||
header: 'Delete from trash?',
|
||||
body: 'You will not be able to put it back<p class="muted-color">To quickly remove all items from trash, click empty icon in Trash menu</p>',
|
||||
icon: 'minus-circle',
|
||||
success: (function() {
|
||||
this.model.deleteFromTrash();
|
||||
Backbone.trigger('refresh');
|
||||
}).bind(this)
|
||||
});
|
||||
},
|
||||
|
||||
backClick: function() {
|
||||
Backbone.trigger('toggle-details', false);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ var MenuItemView = Backbone.View.extend({
|
|||
Alerts.yesno({
|
||||
header: 'Empty trash?',
|
||||
body: 'You will not be able to put items back',
|
||||
icon: 'trash',
|
||||
icon: 'minus-circle',
|
||||
success: function() {
|
||||
Backbone.trigger('empty-trash');
|
||||
}
|
||||
|
|
|
@ -358,12 +358,16 @@
|
|||
|
||||
.details--drag & { display: none; }
|
||||
|
||||
&-trash {
|
||||
&-trash, &-trash-del {
|
||||
@include icon-btn($error:true);
|
||||
@include align-self(flex-end);
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
&-trash-del {
|
||||
@include th { color: muted-color(); }
|
||||
}
|
||||
|
||||
button ~ button {
|
||||
margin-left: $small-spacing;
|
||||
}
|
||||
|
|
|
@ -13,4 +13,9 @@
|
|||
&__text, &__title {
|
||||
padding: 0 $base-padding-h;
|
||||
}
|
||||
}
|
||||
&__lower-btns {
|
||||
position: absolute;
|
||||
bottom: calc(#{$base-spacing} + 1px);
|
||||
left: $base-spacing;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
<div class="empty-block muted-color">
|
||||
<h1 class="empty-block__title">To restore this group, please drag it to any group outside trash</h1>
|
||||
<div class="empty-block__lower-btns">
|
||||
<i class="details__buttons-trash-del fa fa-minus-circle"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
<div class="scroller__bar-wrapper"><div class="scroller__bar"></div></div>
|
||||
</div>
|
||||
<div class="details__buttons">
|
||||
<% if (!deleted) { %><i class="details__buttons-trash fa fa-trash-o"></i><% } %>
|
||||
<% if (deleted) { %><i class="details__buttons-trash-del fa fa-minus-circle"></i>
|
||||
<% } else { %><i class="details__buttons-trash fa fa-trash-o"></i><% } %>
|
||||
<div class="details__attachments">
|
||||
<% attachments.forEach(function(attachment, ix) { %>
|
||||
<div class="details__attachment" data-id="<%= ix %>"><i class="fa fa-<%= attachment.icon %>"></i> <%- attachment.title %></div>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
Release notes
|
||||
-------------
|
||||
##### v0.2.0 (not released yet)
|
||||
UX improvements, new features, bugfixes
|
||||
UX improvements, offline, trash, protected fields, bugfixes
|
||||
`+` improved open page ux
|
||||
`+` trash management
|
||||
`+` protected fields support
|
||||
`+` keyfiles from Dropbox
|
||||
`+` #17: option to hide entries from subgroups
|
||||
|
|
Loading…
Reference in New Issue