delete ext option, full screen padding
This commit is contained in:
@@ -44,7 +44,13 @@ angular.module('app.frontend')
|
||||
}
|
||||
|
||||
this.submitNewExtensionForm = function() {
|
||||
extensionManager.addExtension(this.newExtensionData.url)
|
||||
if(this.newExtensionData.url) {
|
||||
extensionManager.addExtension(this.newExtensionData.url, function(response){
|
||||
if(!response) {
|
||||
alert("Unable to register this extension. Make sure the link is valid and try again.");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.selectedAction = function(action, extension) {
|
||||
@@ -55,6 +61,12 @@ angular.module('app.frontend')
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteExtension = function(extension) {
|
||||
if(confirm("Are you sure you want to delete this extension?")) {
|
||||
extensionManager.deleteExtension(extension);
|
||||
}
|
||||
}
|
||||
|
||||
this.reloadExtensionsPressed = function() {
|
||||
if(confirm("For your security, reloading extensions will disable any currently enabled repeat actions.")) {
|
||||
extensionManager.refreshExtensionsFromServer();
|
||||
@@ -149,18 +161,6 @@ angular.module('app.frontend')
|
||||
}.bind(this))
|
||||
}
|
||||
|
||||
this.forgotPasswordSubmit = function() {
|
||||
// $auth.requestPasswordReset(this.resetData)
|
||||
// .then(function(resp) {
|
||||
// this.resetData.response = "Success";
|
||||
// // handle success response
|
||||
// }.bind(this))
|
||||
// .catch(function(resp) {
|
||||
// // handle error response
|
||||
// this.resetData.response = "Error";
|
||||
// }.bind(this));
|
||||
}
|
||||
|
||||
this.encryptionStatusForNotes = function() {
|
||||
var allNotes = modelManager.filteredNotes;
|
||||
var countEncrypted = 0;
|
||||
@@ -173,10 +173,12 @@ angular.module('app.frontend')
|
||||
return countEncrypted + "/" + allNotes.length + " notes encrypted";
|
||||
}
|
||||
|
||||
this.archiveEncryptionFormat = {encrypted: true};
|
||||
|
||||
this.downloadDataArchive = function() {
|
||||
var link = document.createElement('a');
|
||||
link.setAttribute('download', 'notes.json');
|
||||
link.href = apiController.itemsDataFile();
|
||||
link.href = apiController.itemsDataFile(this.archiveEncryptionFormat.encrypted);
|
||||
link.click();
|
||||
}
|
||||
|
||||
|
||||
@@ -273,8 +273,8 @@ angular.module('app.frontend')
|
||||
return this.paramsForItem(item, !item.isPublic(), additionalFields, false);
|
||||
}
|
||||
|
||||
this.paramsForExportFile = function(item) {
|
||||
return _.omit(this.paramsForItem(item, false, ["created_at", "updated_at"], true), ["deleted"]);
|
||||
this.paramsForExportFile = function(item, encrypted) {
|
||||
return _.omit(this.paramsForItem(item, encrypted, ["created_at", "updated_at"], true), ["deleted"]);
|
||||
}
|
||||
|
||||
this.paramsForExtension = function(item, encrypted) {
|
||||
@@ -358,6 +358,8 @@ angular.module('app.frontend')
|
||||
|
||||
this.importJSONData = function(jsonString, callback) {
|
||||
var data = JSON.parse(jsonString);
|
||||
console.log("importing data", data);
|
||||
this.decryptItems(data.items);
|
||||
modelManager.mapResponseItemsToLocalModels(data.items);
|
||||
modelManager.items.forEach(function(item){
|
||||
item.setDirty(true);
|
||||
@@ -369,7 +371,7 @@ angular.module('app.frontend')
|
||||
Export
|
||||
*/
|
||||
|
||||
this.itemsDataFile = function() {
|
||||
this.itemsDataFile = function(encrypted) {
|
||||
var textFile = null;
|
||||
var makeTextFile = function (text) {
|
||||
var data = new Blob([text], {type: 'text/json'});
|
||||
@@ -387,7 +389,7 @@ angular.module('app.frontend')
|
||||
}.bind(this);
|
||||
|
||||
var items = _.map(modelManager.allItemsMatchingTypes(["Tag", "Note"]), function(item){
|
||||
return this.paramsForExportFile(item);
|
||||
return this.paramsForExportFile(item, encrypted);
|
||||
}.bind(this));
|
||||
|
||||
var data = {
|
||||
@@ -532,13 +534,15 @@ angular.module('app.frontend')
|
||||
if(item.deleted == true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(item.content.substring(0, 3) == "001" && item.enc_item_key) {
|
||||
// is encrypted
|
||||
this.decryptSingleItem(item, masterKey);
|
||||
} else {
|
||||
// is base64 encoded
|
||||
item.content = Neeto.crypto.base64Decode(item.content.substring(3, item.content.length))
|
||||
var isString = typeof item.content === 'string' || item.content instanceof String;
|
||||
if(isString) {
|
||||
if(item.content.substring(0, 3) == "001" && item.enc_item_key) {
|
||||
// is encrypted
|
||||
this.decryptSingleItem(item, masterKey);
|
||||
} else {
|
||||
// is base64 encoded
|
||||
item.content = Neeto.crypto.base64Decode(item.content.substring(3, item.content.length))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,8 +55,22 @@ class ExtensionManager {
|
||||
console.log("ext with dec", this.decryptedExtensions);
|
||||
}
|
||||
|
||||
addExtension(url) {
|
||||
this.retrieveExtensionFromServer(url, null);
|
||||
addExtension(url, callback) {
|
||||
this.retrieveExtensionFromServer(url, callback);
|
||||
}
|
||||
|
||||
deleteExtension(extension) {
|
||||
for(var action of extension.actions) {
|
||||
_.pull(this.decryptedExtensions, extension);
|
||||
if(action.repeat_type) {
|
||||
if(this.isRepeatActionEnabled(action)) {
|
||||
this.disableRepeatAction(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.modelManager.setItemToBeDeleted(extension);
|
||||
this.apiController.sync(null);
|
||||
}
|
||||
|
||||
retrieveExtensionFromServer(url, callback) {
|
||||
@@ -69,6 +83,7 @@ class ExtensionManager {
|
||||
}.bind(this))
|
||||
.catch(function(response){
|
||||
console.log("Error registering extension", response);
|
||||
callback(null);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -185,10 +200,11 @@ class ExtensionManager {
|
||||
|
||||
queueAction(action, extension, delay, changedItems) {
|
||||
this.actionQueue = this.actionQueue || [];
|
||||
if(_.find(this.actionQueue, action)) {
|
||||
if(_.find(this.actionQueue, {url: action.url})) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Successfully queued", action, this.actionQueue.length);
|
||||
this.actionQueue.push(action);
|
||||
|
||||
setTimeout(function () {
|
||||
@@ -199,15 +215,13 @@ class ExtensionManager {
|
||||
}
|
||||
|
||||
triggerWatchAction(action, extension, changedItems) {
|
||||
// console.log("Watch action triggered", action, changedItems);
|
||||
if(action.repeat_timeout > 0) {
|
||||
var lastExecuted = action.lastExecuted;
|
||||
var diffInSeconds = (new Date() - lastExecuted)/1000;
|
||||
console.log("last executed", action.lastExecuted, "diff", diffInSeconds, "repeatFreq", action.repeatFrequency);
|
||||
if(diffInSeconds < action.repeat_timeout) {
|
||||
var delay = action.repeat_timeout - diffInSeconds;
|
||||
console.log("delaying action by", delay);
|
||||
this.queueAction(action, delay, changedItems);
|
||||
console.log("Delaying action by", delay);
|
||||
this.queueAction(action, extension, delay, changedItems);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,21 @@
|
||||
|
||||
.section-title-bar {
|
||||
border-bottom: none !important;
|
||||
|
||||
&.fullscreen {
|
||||
opacity: 0.0;
|
||||
-webkit-transition: all 300ms ease-in-out;
|
||||
-moz-transition: all 300ms ease-in-out;
|
||||
-ms-transition: all 300ms ease-in-out;
|
||||
-o-transition: all 300ms ease-in-out;
|
||||
transition: all 300ms ease-in-out;
|
||||
|
||||
&:hover {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
// z-index: -1;
|
||||
}
|
||||
}
|
||||
|
||||
$heading-height: 90px;
|
||||
@@ -65,6 +80,26 @@
|
||||
|
||||
}
|
||||
|
||||
.fullscreen-ghost-bar {
|
||||
|
||||
position: absolute;
|
||||
width: 20%;
|
||||
height: 200px;
|
||||
z-index: 100;
|
||||
//
|
||||
// &:hover + .section-title-bar {
|
||||
// // show section title bar when hover over ghost bar
|
||||
// opacity: 1.0;
|
||||
// z-index: 100;
|
||||
// }
|
||||
|
||||
// &:not(:hover) + .section-title-bar {
|
||||
// // display: none;
|
||||
// opacity: 1.0;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
.editor-content {
|
||||
max-height: 100%;
|
||||
|
||||
@@ -74,9 +109,14 @@
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
overflow: auto;
|
||||
|
||||
text-align: center; // centers children div horizontally
|
||||
z-index: 10;
|
||||
padding-top: $heading-height;
|
||||
|
||||
&.fullscreen {
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
.sampler-container {
|
||||
margin-top: 10px;
|
||||
padding: 15px;
|
||||
@@ -101,6 +141,12 @@
|
||||
padding-top: 17px;
|
||||
font-size: 17px;
|
||||
resize: none;
|
||||
|
||||
&.fullscreen {
|
||||
padding: 85px 10%;
|
||||
max-width: 1200px;
|
||||
display: inline-block;;
|
||||
}
|
||||
}
|
||||
|
||||
.preview {
|
||||
@@ -110,6 +156,13 @@
|
||||
line-height: 23px;
|
||||
overflow-y: scroll;
|
||||
padding: 0px 15px;
|
||||
text-align: left;
|
||||
|
||||
&.fullscreen {
|
||||
padding: 85px 10%;
|
||||
max-width: 1200px;
|
||||
display: inline-block;;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.section.editor{"ng-class" => "{'fullscreen' : ctrl.fullscreen}"}
|
||||
.content
|
||||
.section-title-bar.editor-heading{"ng-class" => "{'shared' : ctrl.note.isPublic() }"}
|
||||
-# %span.fullscreen-ghost-bar{"ng-if" => "ctrl.fullscreen"}
|
||||
.section-title-bar.editor-heading{"ng-class" => "{'shared' : ctrl.note.isPublic(), 'fullscreen' : ctrl.fullscreen }"}
|
||||
.title
|
||||
%input.input#note-title-editor{"ng-model" => "ctrl.note.title", "ng-keyup" => "$event.keyCode == 13 && ctrl.saveTitle($event)",
|
||||
"ng-disabled" => "ctrl.note.locked", "ng-change" => "ctrl.nameChanged()", "ng-focus" => "ctrl.onNameFocus()",
|
||||
@@ -55,10 +56,10 @@
|
||||
"ng-disabled" => "ctrl.note.locked", "ng-change" => "ctrl.urlChanged()", "ng-focus" => "ctrl.onUrlFocus()",
|
||||
"select-on-click" => "true", "autofocus" => "true"}
|
||||
|
||||
.editor-content{"ng-class" => "{'shared' : ctrl.note.isPublic() }"}
|
||||
.editor-content{"ng-class" => "{'shared' : ctrl.note.isPublic(), 'fullscreen' : ctrl.fullscreen }"}
|
||||
.sampler-container{"ng-if" => "ctrl.showSampler", "ng-click" => "ctrl.focusEditor()"}
|
||||
%strong.name-sampler.sampler{"typewrite" => "true", "text" => "ctrl.demoNoteNames", "type-delay" => "30", "initial-delay" => "1.5s",
|
||||
"iteration-callback" => "ctrl.callback", "prebegin-fn" => "ctrl.prebeginFn", "iteration-delay" => "2000", "cursor" => ""}
|
||||
%textarea.editable#note-text-editor{"ng-disabled" => "ctrl.note.locked", "ng-show" => "ctrl.editorMode == 'edit'", "ng-model" => "ctrl.note.text",
|
||||
%textarea.editable#note-text-editor{"ng-class" => "{'fullscreen' : ctrl.fullscreen }", "ng-disabled" => "ctrl.note.locked", "ng-show" => "ctrl.editorMode == 'edit'", "ng-model" => "ctrl.note.text",
|
||||
"ng-change" => "ctrl.contentChanged()", "ng-click" => "ctrl.clickedTextArea()", "ng-focus" => "ctrl.onContentFocus()"}
|
||||
.preview{"ng-if" => "ctrl.editorMode == 'preview'", "ng-bind-html" => "ctrl.renderedContent()", "ng-dblclick" => "ctrl.onPreviewDoubleClick()"}
|
||||
.preview{"ng-class" => "{'fullscreen' : ctrl.fullscreen }", "ng-if" => "ctrl.editorMode == 'preview'", "ng-bind-html" => "ctrl.renderedContent()", "ng-dblclick" => "ctrl.onPreviewDoubleClick()"}
|
||||
|
||||
@@ -74,9 +74,15 @@
|
||||
.account-item{"ng-if" => "ctrl.user.email"}
|
||||
.meta-container
|
||||
.title Data Archives
|
||||
.desc Note: data archives that you download using the link below are decrypted before save. You should take care to store them in a safe location.
|
||||
.options{"style" => "font-size: 12px; margin-top: 4px;"}
|
||||
%label
|
||||
%input{"type" => "radio", "ng-model" => "ctrl.archiveEncryptionFormat.encrypted", "ng-value" => "true", "ng-change" => "ctrl.archiveEncryptionFormat.encrypted = true"}
|
||||
Encrypted
|
||||
%label
|
||||
%input{"type" => "radio", "ng-model" => "ctrl.archiveEncryptionFormat.encrypted", "ng-value" => "false", "ng-change" => "ctrl.archiveEncryptionFormat.encrypted = false"}
|
||||
Decrypted
|
||||
.action-container
|
||||
%a{"ng-click" => "ctrl.downloadDataArchive()"} Download Latest Data Archive
|
||||
%a{"ng-click" => "ctrl.downloadDataArchive()"} Download Data Archive
|
||||
%br
|
||||
%label#import-archive
|
||||
%input{"type" => "file", "style" => "display: none;", "file-change" => "->", "handler" => "ctrl.importFileSelected(files)"}
|
||||
@@ -124,15 +130,16 @@
|
||||
.spinner{"style" => "margin-top: 3px;"}
|
||||
.last-run{"ng-if" => "action.lastExecuted && !action.running"}
|
||||
Last executed {{action.lastExecuted | appDateTime}}
|
||||
%a{"ng-click" => "ctrl.deleteExtension(extension)", "style" => "margin-top: 22px; display: block;"} Remove extension
|
||||
|
||||
.extension-link
|
||||
%a{"ng-click" => "ctrl.toggleExtensionForm()"} Add new extension
|
||||
|
||||
%form.extension-form{"ng-if" => "ctrl.showNewExtensionForm"}
|
||||
.form-tag.has-feedback
|
||||
%input.form-control{:autofocus => 'autofocus', :name => 'url', :placeholder => 'Extension URL', :required => true, :type => 'text', 'ng-model' => 'ctrl.newExtensionData.url'}
|
||||
%button.btn.dark-button.btn-block{:type => 'submit', "data-style" => "expand-right", "data-size" => "s", "state" => "buttonState"}
|
||||
%span.ladda-label{"ng-click" => "ctrl.submitNewExtensionForm()"} Add Extension
|
||||
%input.form-control{:autofocus => 'autofocus', :name => 'url', :placeholder => 'Extension URL', :required => true, :type => 'url', 'ng-model' => 'ctrl.newExtensionData.url'}
|
||||
%button.btn.dark-button.btn-block{"ng-click" => "ctrl.submitNewExtensionForm()", :type => 'submit', "data-style" => "expand-right", "data-size" => "s", "state" => "buttonState"}
|
||||
%span.ladda-label Add Extension
|
||||
|
||||
.extension-link
|
||||
%a{"ng-click" => "ctrl.reloadExtensionsPressed()", "ng-if" => "ctrl.extensionManager.extensions.length > 0"} Reload all extensions
|
||||
|
||||
Reference in New Issue
Block a user