updates
This commit is contained in:
@@ -39,5 +39,5 @@ angular.module('app.frontend', [
|
||||
});
|
||||
})
|
||||
.config(['$qProvider', function ($qProvider) {
|
||||
$qProvider.errorOnUnhandledRejections(false);
|
||||
// $qProvider.errorOnUnhandledRejections(false);
|
||||
}]);
|
||||
|
||||
@@ -8,14 +8,6 @@ class BaseCtrl {
|
||||
// $auth.updatePassword(data);
|
||||
// apiController.setMk(new_keys.mk);
|
||||
// }
|
||||
|
||||
// var note = new Note();
|
||||
// note.content = {title: "hello", text: "world"};
|
||||
// console.log("note content", note.content);
|
||||
// console.log("note title", note.title);
|
||||
// console.log("note json", JSON.stringify(note));
|
||||
//
|
||||
// console.log("Copy", _.cloneDeep(note));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ angular.module('app.frontend')
|
||||
|
||||
this.setNote = function(note, oldNote) {
|
||||
this.editorMode = 'edit';
|
||||
if(note.content.text.length == 0) {
|
||||
if(note.content.text.length == 0 && note.dummy) {
|
||||
this.focusTitle(100);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,10 @@ angular.module('app.frontend')
|
||||
this.changesMade = function() {
|
||||
this.note.hasChanges = true;
|
||||
this.note.dummy = false;
|
||||
apiController.saveDraftToDisk(this.note);
|
||||
if(this.user.uuid) {
|
||||
// signed out users have local autosave, dont need draft saving
|
||||
apiController.saveDraftToDisk(this.note);
|
||||
}
|
||||
|
||||
if(saveTimeout) $timeout.cancel(saveTimeout);
|
||||
if(statusTimeout) $timeout.cancel(statusTimeout);
|
||||
|
||||
@@ -74,6 +74,7 @@ angular.module('app.frontend')
|
||||
$timeout(function(){
|
||||
apiController.login(this.loginData.email, this.loginData.user_password, function(response){
|
||||
if(response.errors) {
|
||||
console.log("login error", response.errors);
|
||||
this.loginData.status = response.errors[0];
|
||||
} else {
|
||||
this.onAuthSuccess(response.user);
|
||||
|
||||
@@ -122,7 +122,7 @@ angular.module('app.frontend')
|
||||
if(this.noteFilter.text.length == 0) {
|
||||
note.visible = true;
|
||||
} else {
|
||||
note.visible = note.title.toLowerCase().includes(this.noteFilter.text) || note.text.toLowerCase().includes(this.noteFilter.text);
|
||||
note.visible = note.content.title.toLowerCase().includes(this.noteFilter.text) || note.content.text.toLowerCase().includes(this.noteFilter.text);
|
||||
}
|
||||
return note.visible;
|
||||
}.bind(this)
|
||||
|
||||
@@ -13,7 +13,7 @@ angular.module('app.frontend')
|
||||
if(!url) {
|
||||
url = localStorage.getItem("server");
|
||||
if(!url) {
|
||||
url = location.protocol + "//" + domainName() + (location.port ? ':' + location.port: '');
|
||||
url = "https://n3.standardnotes.org";
|
||||
}
|
||||
}
|
||||
return url;
|
||||
@@ -38,7 +38,7 @@ angular.module('app.frontend')
|
||||
if(!url) {
|
||||
url = localStorage.getItem("server");
|
||||
if(!url) {
|
||||
url = location.protocol + "//" + domainName() + (location.port ? ':' + location.port: '');
|
||||
url = "https://n3.standardnotes.org";
|
||||
this.setServer(url);
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,6 @@ angular.module('app.frontend')
|
||||
Restangular.one("users/current").get().then(function(response){
|
||||
var plain = response.plain();
|
||||
var items = plain.items;
|
||||
console.log("Current user items", items);
|
||||
this.decryptItemsWithLocalKey(items);
|
||||
items = this.mapResponseItemsToLocalModels(items);
|
||||
var user = _.omit(plain, ["items"]);
|
||||
@@ -88,7 +87,6 @@ angular.module('app.frontend')
|
||||
this.getAuthParamsForEmail(email, function(authParams){
|
||||
Neeto.crypto.computeEncryptionKeysForUser(_.merge({email: email, password: password}, authParams), function(keys){
|
||||
this.setMk(keys.mk);
|
||||
console.log("Signing in with", authParams, "pw", keys);
|
||||
var request = Restangular.one("auth/sign_in");
|
||||
request.user = {password: keys.pw, email: email};
|
||||
request.post().then(function(response){
|
||||
@@ -215,6 +213,11 @@ angular.module('app.frontend')
|
||||
}
|
||||
|
||||
this.saveItems = function(items, callback) {
|
||||
if(!this.user.uuid) {
|
||||
this.writeItemsToLocalStorage();
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
var request = Restangular.one("users", this.user.uuid).one("items");
|
||||
request.items = _.map(items, function(item){
|
||||
return this.createRequestParamsForItem(item);
|
||||
@@ -281,7 +284,7 @@ angular.module('app.frontend')
|
||||
|
||||
this.deleteItem = function(item, callback) {
|
||||
if(!this.user.uuid) {
|
||||
this.writeUserToLocalStorage(this.user);
|
||||
this.writeItemsToLocalStorage();
|
||||
callback(true);
|
||||
} else {
|
||||
Restangular.one("users", this.user.uuid).one("items", item.uuid).remove()
|
||||
@@ -403,13 +406,11 @@ angular.module('app.frontend')
|
||||
return JSON.parse(JSON.stringify(object));
|
||||
}
|
||||
|
||||
this.writeUserToLocalStorage = function(user) {
|
||||
var saveUser = _.cloneDeep(user);
|
||||
saveUser.items = Item.filterDummyItems(saveUser.items);
|
||||
saveUser.tags.forEach(function(tag){
|
||||
tag.items = null;
|
||||
}.bind(this))
|
||||
this.writeToLocalStorage('user', saveUser);
|
||||
this.writeItemsToLocalStorage = function() {
|
||||
var items = _.map(modelManager.items, function(item){
|
||||
return this.paramsForItem(item, false, ["created_at", "updated_at"], true)
|
||||
}.bind(this));
|
||||
this.writeToLocalStorage('items', items);
|
||||
}
|
||||
|
||||
this.writeToLocalStorage = function(key, value) {
|
||||
@@ -417,10 +418,11 @@ angular.module('app.frontend')
|
||||
}
|
||||
|
||||
this.localUser = function() {
|
||||
var user = JSON.parse(localStorage.getItem('user'));
|
||||
if(!user) {
|
||||
user = {items: [], tags: []};
|
||||
}
|
||||
var user = {};
|
||||
var items = JSON.parse(localStorage.getItem('items'));
|
||||
items = this.mapResponseItemsToLocalModels(items);
|
||||
modelManager.items = items;
|
||||
user.items = items;
|
||||
user.shouldMerge = true;
|
||||
return user;
|
||||
}
|
||||
@@ -430,7 +432,7 @@ angular.module('app.frontend')
|
||||
*/
|
||||
|
||||
this.saveDraftToDisk = function(draft) {
|
||||
// localStorage.setItem("draft", JSON.stringify(draft));
|
||||
localStorage.setItem("draft", JSON.stringify(draft));
|
||||
}
|
||||
|
||||
this.clearDraft = function() {
|
||||
|
||||
@@ -32,6 +32,10 @@ class ItemManager {
|
||||
});
|
||||
}
|
||||
|
||||
addItem(item) {
|
||||
this.items.push(item);
|
||||
}
|
||||
|
||||
// returns dirty item references that need saving
|
||||
deleteItem(item) {
|
||||
var dirty = [];
|
||||
|
||||
@@ -44,11 +44,13 @@ class ModelManager extends ItemManager {
|
||||
addNote(note) {
|
||||
if(!_.find(this.notes, {uuid: note.uuid})) {
|
||||
this.notes.unshift(note);
|
||||
this.addItem(note);
|
||||
}
|
||||
}
|
||||
|
||||
addTag(tag) {
|
||||
this.tags.unshift(tag);
|
||||
this.addItem(tag);
|
||||
}
|
||||
|
||||
addTagToNote(tag, note) {
|
||||
|
||||
@@ -84,8 +84,7 @@
|
||||
display: inline-block;
|
||||
|
||||
a {
|
||||
color: white;
|
||||
// font-size: 12px;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.public-link {
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
.panel {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
bottom: 20px;
|
||||
min-width: 300px;
|
||||
z-index: 1000;
|
||||
margin-top: 15px;
|
||||
|
||||
@@ -179,7 +179,9 @@ $section-header-height: 70px;
|
||||
border-radius: 4px;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(#e9e9e9, 0.8);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
margin-top: -6px;
|
||||
background-color: #d7d7d7 !important;
|
||||
float: right;
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(#d7d7d7, 0.8) !important;
|
||||
|
||||
@@ -10,6 +10,16 @@
|
||||
.panel-body
|
||||
.account-items
|
||||
.account-item.registration-login{"ng-if" => "!ctrl.user.email"}
|
||||
.account-item
|
||||
.meta-container
|
||||
.title Server
|
||||
.desc Enter your <a href="http://standardfile.github.io" target="_blank">Standard File</a> server address, or use the default.
|
||||
.action-container
|
||||
%form.account-form{'ng-submit' => 'ctrl.changeServer()', 'name' => "serverChangeForm"}
|
||||
.form-tag.has-feedback
|
||||
%input.form-control{:name => 'server', :placeholder => 'Server URL', :required => true, :type => 'text', 'ng-model' => 'ctrl.serverData.url'}
|
||||
%button.btn.dark-button.btn-block{:type => 'submit', "data-style" => "expand-right", "data-size" => "s", "state" => "buttonState"}
|
||||
%span.ladda-label Set Server
|
||||
.meta-container
|
||||
.title Sign in or Register
|
||||
.desc
|
||||
@@ -57,17 +67,6 @@
|
||||
%span
|
||||
Import Data from Archive
|
||||
|
||||
.account-item
|
||||
.meta-container
|
||||
.title Server
|
||||
.desc Use a custom Standard Notes server to store and retrieve your account data.
|
||||
.action-container
|
||||
%form.account-form{'ng-submit' => 'ctrl.changeServer()', 'name' => "serverChangeForm"}
|
||||
.form-tag.has-feedback
|
||||
%input.form-control{:name => 'server', :placeholder => 'Server URL', :required => true, :type => 'text', 'ng-model' => 'ctrl.serverData.url'}
|
||||
%button.btn.dark-button.btn-block{:type => 'submit', "data-style" => "expand-right", "data-size" => "s", "state" => "buttonState"}
|
||||
%span.ladda-label Change Server
|
||||
|
||||
.links{"ng-if" => "ctrl.user.email"}
|
||||
.link-item
|
||||
%a{"ng-click" => "ctrl.changePasswordPressed()"} Change Password
|
||||
|
||||
61
vendor/assets/javascripts/transpiled.js
vendored
61
vendor/assets/javascripts/transpiled.js
vendored
@@ -389,7 +389,7 @@ angular.module('app.frontend', ['ui.router', 'restangular', 'oc.lazyLoad', 'angu
|
||||
};
|
||||
});
|
||||
}).config(['$qProvider', function ($qProvider) {
|
||||
$qProvider.errorOnUnhandledRejections(false);
|
||||
// $qProvider.errorOnUnhandledRejections(false);
|
||||
}]);
|
||||
;angular.module('app.frontend').config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
|
||||
|
||||
@@ -437,14 +437,6 @@ var BaseCtrl = function BaseCtrl($rootScope, modelManager) {
|
||||
// apiController.setMk(new_keys.mk);
|
||||
// }
|
||||
|
||||
// var note = new Note();
|
||||
// note.content = {title: "hello", text: "world"};
|
||||
// console.log("note content", note.content);
|
||||
// console.log("note title", note.title);
|
||||
// console.log("note json", JSON.stringify(note));
|
||||
//
|
||||
// console.log("Copy", _.cloneDeep(note));
|
||||
|
||||
_classCallCheck(this, BaseCtrl);
|
||||
};
|
||||
|
||||
@@ -516,7 +508,7 @@ angular.module('app.frontend').controller('BaseCtrl', BaseCtrl);
|
||||
|
||||
this.setNote = function (note, oldNote) {
|
||||
this.editorMode = 'edit';
|
||||
if (note.content.text.length == 0) {
|
||||
if (note.content.text.length == 0 && note.dummy) {
|
||||
this.focusTitle(100);
|
||||
}
|
||||
|
||||
@@ -582,7 +574,10 @@ angular.module('app.frontend').controller('BaseCtrl', BaseCtrl);
|
||||
this.changesMade = function () {
|
||||
this.note.hasChanges = true;
|
||||
this.note.dummy = false;
|
||||
apiController.saveDraftToDisk(this.note);
|
||||
if (this.user.uuid) {
|
||||
// signed out users have local autosave, dont need draft saving
|
||||
apiController.saveDraftToDisk(this.note);
|
||||
}
|
||||
|
||||
if (saveTimeout) $timeout.cancel(saveTimeout);
|
||||
if (statusTimeout) $timeout.cancel(statusTimeout);
|
||||
@@ -773,6 +768,7 @@ angular.module('app.frontend').controller('BaseCtrl', BaseCtrl);
|
||||
$timeout(function () {
|
||||
apiController.login(this.loginData.email, this.loginData.user_password, function (response) {
|
||||
if (response.errors) {
|
||||
console.log("login error", response.errors);
|
||||
this.loginData.status = response.errors[0];
|
||||
} else {
|
||||
this.onAuthSuccess(response.user);
|
||||
@@ -1123,7 +1119,7 @@ angular.module('app.frontend').controller('BaseCtrl', BaseCtrl);
|
||||
if (this.noteFilter.text.length == 0) {
|
||||
note.visible = true;
|
||||
} else {
|
||||
note.visible = note.title.toLowerCase().includes(this.noteFilter.text) || note.text.toLowerCase().includes(this.noteFilter.text);
|
||||
note.visible = note.content.title.toLowerCase().includes(this.noteFilter.text) || note.content.text.toLowerCase().includes(this.noteFilter.text);
|
||||
}
|
||||
return note.visible;
|
||||
}.bind(this);
|
||||
@@ -1495,7 +1491,7 @@ var User = function User(json_obj) {
|
||||
if (!url) {
|
||||
url = localStorage.getItem("server");
|
||||
if (!url) {
|
||||
url = location.protocol + "//" + domainName() + (location.port ? ':' + location.port : '');
|
||||
url = "https://n3.standardnotes.org";
|
||||
}
|
||||
}
|
||||
return url;
|
||||
@@ -1519,7 +1515,7 @@ var User = function User(json_obj) {
|
||||
if (!url) {
|
||||
url = localStorage.getItem("server");
|
||||
if (!url) {
|
||||
url = location.protocol + "//" + domainName() + (location.port ? ':' + location.port : '');
|
||||
url = "https://n3.standardnotes.org";
|
||||
this.setServer(url);
|
||||
}
|
||||
}
|
||||
@@ -1552,7 +1548,6 @@ var User = function User(json_obj) {
|
||||
Restangular.one("users/current").get().then(function (response) {
|
||||
var plain = response.plain();
|
||||
var items = plain.items;
|
||||
console.log("Current user items", items);
|
||||
this.decryptItemsWithLocalKey(items);
|
||||
items = this.mapResponseItemsToLocalModels(items);
|
||||
var user = _.omit(plain, ["items"]);
|
||||
@@ -1567,7 +1562,6 @@ var User = function User(json_obj) {
|
||||
this.getAuthParamsForEmail(email, function (authParams) {
|
||||
Neeto.crypto.computeEncryptionKeysForUser(_.merge({ email: email, password: password }, authParams), function (keys) {
|
||||
this.setMk(keys.mk);
|
||||
console.log("Signing in with", authParams, "pw", keys);
|
||||
var request = Restangular.one("auth/sign_in");
|
||||
request.user = { password: keys.pw, email: email };
|
||||
request.post().then(function (response) {
|
||||
@@ -1691,6 +1685,11 @@ var User = function User(json_obj) {
|
||||
};
|
||||
|
||||
this.saveItems = function (items, callback) {
|
||||
if (!this.user.uuid) {
|
||||
this.writeItemsToLocalStorage();
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
var request = Restangular.one("users", this.user.uuid).one("items");
|
||||
request.items = _.map(items, function (item) {
|
||||
return this.createRequestParamsForItem(item);
|
||||
@@ -1755,7 +1754,7 @@ var User = function User(json_obj) {
|
||||
|
||||
this.deleteItem = function (item, callback) {
|
||||
if (!this.user.uuid) {
|
||||
this.writeUserToLocalStorage(this.user);
|
||||
this.writeItemsToLocalStorage();
|
||||
callback(true);
|
||||
} else {
|
||||
Restangular.one("users", this.user.uuid).one("items", item.uuid).remove().then(function (response) {
|
||||
@@ -1873,13 +1872,11 @@ var User = function User(json_obj) {
|
||||
return JSON.parse(JSON.stringify(object));
|
||||
};
|
||||
|
||||
this.writeUserToLocalStorage = function (user) {
|
||||
var saveUser = _.cloneDeep(user);
|
||||
saveUser.items = Item.filterDummyItems(saveUser.items);
|
||||
saveUser.tags.forEach(function (tag) {
|
||||
tag.items = null;
|
||||
this.writeItemsToLocalStorage = function () {
|
||||
var items = _.map(modelManager.items, function (item) {
|
||||
return this.paramsForItem(item, false, ["created_at", "updated_at"], true);
|
||||
}.bind(this));
|
||||
this.writeToLocalStorage('user', saveUser);
|
||||
this.writeToLocalStorage('items', items);
|
||||
};
|
||||
|
||||
this.writeToLocalStorage = function (key, value) {
|
||||
@@ -1887,10 +1884,11 @@ var User = function User(json_obj) {
|
||||
};
|
||||
|
||||
this.localUser = function () {
|
||||
var user = JSON.parse(localStorage.getItem('user'));
|
||||
if (!user) {
|
||||
user = { items: [], tags: [] };
|
||||
}
|
||||
var user = {};
|
||||
var items = JSON.parse(localStorage.getItem('items'));
|
||||
items = this.mapResponseItemsToLocalModels(items);
|
||||
modelManager.items = items;
|
||||
user.items = items;
|
||||
user.shouldMerge = true;
|
||||
return user;
|
||||
};
|
||||
@@ -1900,7 +1898,7 @@ var User = function User(json_obj) {
|
||||
*/
|
||||
|
||||
this.saveDraftToDisk = function (draft) {
|
||||
// localStorage.setItem("draft", JSON.stringify(draft));
|
||||
localStorage.setItem("draft", JSON.stringify(draft));
|
||||
};
|
||||
|
||||
this.clearDraft = function () {
|
||||
@@ -2034,6 +2032,11 @@ var ItemManager = function () {
|
||||
return item.content_type == contentType;
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'addItem',
|
||||
value: function addItem(item) {
|
||||
this.items.push(item);
|
||||
}
|
||||
|
||||
// returns dirty item references that need saving
|
||||
|
||||
@@ -2135,12 +2138,14 @@ var ModelManager = function (_ItemManager) {
|
||||
value: function addNote(note) {
|
||||
if (!_.find(this.notes, { uuid: note.uuid })) {
|
||||
this.notes.unshift(note);
|
||||
this.addItem(note);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'addTag',
|
||||
value: function addTag(tag) {
|
||||
this.tags.unshift(tag);
|
||||
this.addItem(tag);
|
||||
}
|
||||
}, {
|
||||
key: 'addTagToNote',
|
||||
|
||||
2
vendor/assets/javascripts/transpiled.js.map
vendored
2
vendor/assets/javascripts/transpiled.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user