confirm delete, extension load actions
This commit is contained in:
@@ -236,8 +236,10 @@ angular.module('app.frontend')
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.deleteNote = function() {
|
this.deleteNote = function() {
|
||||||
this.remove()(this.note);
|
if(confirm("Are you sure you want to delete this note?")) {
|
||||||
this.showMenu = false;
|
this.remove()(this.note);
|
||||||
|
this.showMenu = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clickedEditNote = function() {
|
this.clickedEditNote = function() {
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
class Action {
|
class Action {
|
||||||
constructor(json) {
|
constructor(json) {
|
||||||
_.merge(this, json);
|
_.merge(this, json);
|
||||||
this.running = false; // in case running=true was synced with server since model is uploaded nondiscriminatory
|
this.running = false; // in case running=true was synced with server since model is uploaded nondiscriminatory
|
||||||
this.error = false;
|
this.error = false;
|
||||||
if(this.lastExecuted) {
|
if(this.lastExecuted) {
|
||||||
// is string
|
// is string
|
||||||
this.lastExecuted = new Date(this.lastExecuted);
|
this.lastExecuted = new Date(this.lastExecuted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get permissionsString() {
|
permissionsString() {
|
||||||
|
console.log("permissions", this.permissions);
|
||||||
if(!this.permissions) {
|
if(!this.permissions) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
var permission = this.permissions.charAt(0).toUpperCase() + this.permissions.slice(1); // capitalize first letter
|
var permission = this.permissions.charAt(0).toUpperCase() + this.permissions.slice(1); // capitalize first letter
|
||||||
permission += ": ";
|
permission += ": ";
|
||||||
for(var contentType of this.content_types) {
|
for(var contentType of this.content_types) {
|
||||||
@@ -28,7 +30,7 @@ class Action {
|
|||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
get encryptionModeString() {
|
encryptionModeString() {
|
||||||
if(this.verb != "post") {
|
if(this.verb != "post") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -54,6 +56,12 @@ class Extension extends Item {
|
|||||||
|
|
||||||
this.encrypted = true;
|
this.encrypted = true;
|
||||||
this.content_type = "Extension";
|
this.content_type = "Extension";
|
||||||
|
|
||||||
|
if(json.actions) {
|
||||||
|
this.actions = json.actions.map(function(action){
|
||||||
|
return new Action(action);
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actionsInGlobalContext() {
|
actionsInGlobalContext() {
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ angular.module('app.frontend')
|
|||||||
callback(response.plain());
|
callback(response.plain());
|
||||||
})
|
})
|
||||||
.catch(function(response){
|
.catch(function(response){
|
||||||
console.log("Error getting current user", response);
|
console.log("Error getting auth params", response);
|
||||||
callback(response.data);
|
callback(null);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ angular.module('app.frontend')
|
|||||||
this.login = function(url, email, password, callback) {
|
this.login = function(url, email, password, callback) {
|
||||||
this.getAuthParamsForEmail(url, email, function(authParams){
|
this.getAuthParamsForEmail(url, email, function(authParams){
|
||||||
if(!authParams) {
|
if(!authParams) {
|
||||||
callback({error: "Unable to get authentication parameters."});
|
callback({error : {message: "Unable to get authentication parameters."}});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +72,8 @@ angular.module('app.frontend')
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("compute encryption keys", password, authParams);
|
||||||
|
|
||||||
Neeto.crypto.computeEncryptionKeysForUser(_.merge({password: password}, authParams), function(keys){
|
Neeto.crypto.computeEncryptionKeysForUser(_.merge({password: password}, authParams), function(keys){
|
||||||
var mk = keys.mk;
|
var mk = keys.mk;
|
||||||
var requestUrl = url + "/auth/sign_in";
|
var requestUrl = url + "/auth/sign_in";
|
||||||
@@ -112,7 +114,7 @@ angular.module('app.frontend')
|
|||||||
}.bind(this))
|
}.bind(this))
|
||||||
.catch(function(response){
|
.catch(function(response){
|
||||||
console.log("Registration error", response);
|
console.log("Registration error", response);
|
||||||
callback(response.data);
|
callback(null);
|
||||||
})
|
})
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,9 @@ class DBManager {
|
|||||||
var request = db.transaction("items", "readwrite").objectStore("items").delete(item.uuid);
|
var request = db.transaction("items", "readwrite").objectStore("items").delete(item.uuid);
|
||||||
request.onsuccess = function(event) {
|
request.onsuccess = function(event) {
|
||||||
console.log("Successfully deleted item", item.uuid);
|
console.log("Successfully deleted item", item.uuid);
|
||||||
callback(true);
|
if(callback) {
|
||||||
|
callback(true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}, null)
|
}, null)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class SyncManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get serverURL() {
|
get serverURL() {
|
||||||
return localStorage.getItem("server") || "http://localhost:3000";
|
return localStorage.getItem("server") || "https://n3.standardnotes.org";
|
||||||
}
|
}
|
||||||
|
|
||||||
get masterKey() {
|
get masterKey() {
|
||||||
|
|||||||
@@ -41,12 +41,11 @@
|
|||||||
|
|
||||||
.note {
|
.note {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// max-width: 100%;
|
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
// height: 70px;
|
|
||||||
border-bottom: 1px solid $bg-color;
|
border-bottom: 1px solid $bg-color;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
|
||||||
> .name {
|
> .name {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
%div
|
%div
|
||||||
%a{"ng-click" => "action.showPermissions = !action.showPermissions"} {{action.showPermissions ? "Hide permissions" : "Show permissions"}}
|
%a{"ng-click" => "action.showPermissions = !action.showPermissions"} {{action.showPermissions ? "Hide permissions" : "Show permissions"}}
|
||||||
%div{"ng-if" => "action.showPermissions"}
|
%div{"ng-if" => "action.showPermissions"}
|
||||||
{{action.permissionsString}}
|
{{action.permissionsString()}}
|
||||||
%label.block.normal {{action.encryptionModeString}}
|
%label.block.normal {{action.encryptionModeString()}}
|
||||||
|
|
||||||
%div
|
%div
|
||||||
.mt-5{"ng-if" => "action.repeat_mode"}
|
.mt-5{"ng-if" => "action.repeat_mode"}
|
||||||
|
|||||||
@@ -8,4 +8,5 @@
|
|||||||
"tag" => "selectedTag", "remove" => "deleteNote"}
|
"tag" => "selectedTag", "remove" => "deleteNote"}
|
||||||
|
|
||||||
%editor-section{"ng-if" => "selectedNote", "note" => "selectedNote", "remove" => "deleteNote", "save" => "saveNote", "update-tags" => "updateTagsForNote"}
|
%editor-section{"ng-if" => "selectedNote", "note" => "selectedNote", "remove" => "deleteNote", "save" => "saveNote", "update-tags" => "updateTagsForNote"}
|
||||||
%header{"user" => "defaultUser"}
|
|
||||||
|
%header
|
||||||
|
|||||||
Reference in New Issue
Block a user