mirror of https://github.com/keeweb/keeweb.git
save to binary and xml
This commit is contained in:
parent
aed45a5b70
commit
56a05c8185
1
TODO.md
1
TODO.md
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
- [ ] add/edit groups
|
- [ ] add/edit groups
|
||||||
- [ ] dropbox
|
- [ ] dropbox
|
||||||
- [ ] save+xml
|
|
||||||
- [ ] generate
|
- [ ] generate
|
||||||
- [ ] tags autocomplete
|
- [ ] tags autocomplete
|
||||||
- [ ] file settings
|
- [ ] file settings
|
||||||
|
|
|
@ -126,6 +126,14 @@ var FileModel = Backbone.Model.extend({
|
||||||
if (!this.get('demo')) {
|
if (!this.get('demo')) {
|
||||||
this.set('modified', true);
|
this.set('modified', true);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getData: function() {
|
||||||
|
return this.db.save();
|
||||||
|
},
|
||||||
|
|
||||||
|
getXml: function() {
|
||||||
|
return this.db.saveXml();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ var AppView = Backbone.View.extend({
|
||||||
return item.get('file').cid === e.fileId;
|
return item.get('file').cid === e.fileId;
|
||||||
});
|
});
|
||||||
if (this.views.settings) {
|
if (this.views.settings) {
|
||||||
if (!this.views.settings.file || this.views.settings.file === menuItem.get('file')) {
|
if (this.views.settings.file === menuItem.get('file')) {
|
||||||
this.showEntries();
|
this.showEntries();
|
||||||
} else {
|
} else {
|
||||||
this.model.menu.select({ item: menuItem });
|
this.model.menu.select({ item: menuItem });
|
||||||
|
@ -186,7 +186,7 @@ var AppView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
saveAll: function() {
|
saveAll: function() {
|
||||||
Alerts.notImplemented();
|
this.showFileSettings({ fileId: this.model.files.first().cid });
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSettings: function() {
|
toggleSettings: function() {
|
||||||
|
|
|
@ -1,12 +1,40 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Backbone = require('backbone');
|
var Backbone = require('backbone'),
|
||||||
|
FeatureDetector = require('../../util/feature-detector'),
|
||||||
|
Alerts = require('../../util/alerts'),
|
||||||
|
FileSaver = require('filesaver');
|
||||||
|
|
||||||
var SettingsAboutView = Backbone.View.extend({
|
var SettingsAboutView = Backbone.View.extend({
|
||||||
template: require('templates/settings/settings-file.html'),
|
template: require('templates/settings/settings-file.html'),
|
||||||
|
|
||||||
|
events: {
|
||||||
|
'click .settings__file-button-save-file': 'saveToFile',
|
||||||
|
'click .settings__file-button-export-xml': 'exportAsXml',
|
||||||
|
'click .settings__file-button-save-dropbox': 'saveToDropbox'
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
this.renderTemplate(this.model);
|
this.renderTemplate({
|
||||||
|
file: this.model,
|
||||||
|
cmd: FeatureDetector.actionShortcutSymbol(true)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
saveToFile: function() {
|
||||||
|
var data = this.model.getData();
|
||||||
|
var blob = new Blob([data], {type: 'application/octet-stream'});
|
||||||
|
FileSaver.saveAs(blob, this.model.get('name') + '.kdbx');
|
||||||
|
},
|
||||||
|
|
||||||
|
exportAsXml: function() {
|
||||||
|
var data = this.model.getXml();
|
||||||
|
var blob = new Blob([data], {type: 'text/xml'});
|
||||||
|
FileSaver.saveAs(blob, this.model.get('name') + '.xml');
|
||||||
|
},
|
||||||
|
|
||||||
|
saveToDropbox: function() {
|
||||||
|
Alerts.notImplemented();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1 +1,8 @@
|
||||||
<h1><i class="fa fa-lock"></i> <%- get('name') %></h1>
|
<h1><i class="fa fa-lock"></i> <%- file.get('name') %></h1>
|
||||||
|
<p>This database is opened as local file. To enable auto-save and saving with shortcut <%= cmd %>S,
|
||||||
|
please, save it to Dropbox.</p>
|
||||||
|
<div class="settings__file-buttons">
|
||||||
|
<button class="settings__file-button-save-file btn-silent">Save to file</button>
|
||||||
|
<button class="settings__file-button-export-xml btn-silent">Export to XML</button>
|
||||||
|
<button class="settings__file-button-save-dropbox btn-silent">Save to Dropbox</button>
|
||||||
|
</div>
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
"dropbox": "antelle/dropbox-js#0.10.3",
|
"dropbox": "antelle/dropbox-js#0.10.3",
|
||||||
"font-awesome": "~4.4.0",
|
"font-awesome": "~4.4.0",
|
||||||
"install": "~1.0.4",
|
"install": "~1.0.4",
|
||||||
"kdbxweb": "~0.1.7",
|
"kdbxweb": "~0.1.8",
|
||||||
"normalize.css": "~3.0.3",
|
"normalize.css": "~3.0.3",
|
||||||
"pikaday": "~1.3.3",
|
"pikaday": "~1.3.3",
|
||||||
"zepto": "~1.1.6",
|
"zepto": "~1.1.6",
|
||||||
|
|
Loading…
Reference in New Issue