import/export

This commit is contained in:
Mo Bitar
2016-12-16 12:39:32 -06:00
parent 15a227daa2
commit c8d0159223
13 changed files with 160 additions and 215 deletions

View File

@@ -123,7 +123,7 @@ angular.module('app.frontend')
this.downloadDataArchive = function() {
var link = document.createElement('a');
link.setAttribute('download', 'neeto.json');
link.href = apiController.notesDataFile(this.user);
link.href = apiController.itemsDataFile();
link.click();
}

View File

@@ -7,25 +7,17 @@ angular.module('app.frontend')
var onUserSet = function() {
apiController.setUser($scope.defaultUser);
$scope.allTag = new Tag({all: true});
$scope.allTag.content.name = "All";
$scope.allTag.content.title = "All";
$scope.tags = modelManager.tags;
// apiController.verifyEncryptionStatusOfAllItems($scope.defaultUser, function(success){});
}
apiController.getCurrentUser(function(response){
if(response && !response.errors) {
console.log("Get user response", response);
$scope.defaultUser = new User(response);
modelManager.items = _.map(response.items, function(json_obj){
if(json_obj.content_type == "Note") {
return new Note(json_obj);
} else if(json_obj.content_type == "Tag") {
return new Tag(json_obj);
} else {
return new Item(json_obj);
}
});
apiController.getCurrentUser(function(user, items){
if(user && items) {
console.log("Get user response", user, items);
$scope.defaultUser = user;
modelManager.items = items;
$rootScope.title = "Notes — Neeto";
onUserSet();
} else {

View File

@@ -71,7 +71,7 @@ angular.module('app.frontend')
var originalTagName = "";
this.onTagTitleFocus = function(tag) {
originalTagName = tag.content.name;
originalTagName = tag.content.title;
}
this.tagTitleDidChange = function(tag) {
@@ -80,14 +80,14 @@ angular.module('app.frontend')
this.saveTag = function($event, tag) {
this.editingTag = null;
if(tag.content.name.length == 0) {
tag.content.name = originalTagName;
if(tag.content.title.length == 0) {
tag.content.title = originalTagName;
originalTagName = "";
return;
}
$event.target.blur();
if(!tag.content.name || tag.content.name.length == 0) {
if(!tag.content.title || tag.content.title.length == 0) {
return;
}

View File

@@ -4,8 +4,8 @@ angular.module('app.frontend')
$scope.saveUsername = function() {
apiController.setUsername(user, $scope.formData.username, function(response){
var username = response.root_path;
user.presentation = response;
var username = response.username;
user.username = username;
callback(username);
$scope.closeThisDialog();
})