dbmanager delete item

This commit is contained in:
Mo Bitar
2017-01-12 20:29:16 -06:00
parent 3ffc9ee667
commit d615d1aebe
5 changed files with 13 additions and 7 deletions

View File

@@ -519,7 +519,7 @@ angular.module('app.frontend')
this.writeItemsToLocalStorage = function(items, callback) { this.writeItemsToLocalStorage = function(items, callback) {
var params = items.map(function(item) { var params = items.map(function(item) {
return this.paramsForItem(item, this.isUserSignedIn(), ["created_at", "updated_at", "presentation_url"], false) return this.paramsForItem(item, this.isUserSignedIn(), ["created_at", "updated_at", "presentation_url", "dirty"], false)
}.bind(this)); }.bind(this));
dbManager.saveItems(params, callback); dbManager.saveItems(params, callback);

View File

@@ -155,7 +155,7 @@ class ExtensionManager {
}.bind(this)) }.bind(this))
} else { } else {
params.item = this.outgoingParamsForItem(item, extension); params.items = [this.outgoingParamsForItem(item, extension)];
} }
this.performPost(action, extension, params, function(response){ this.performPost(action, extension, params, function(response){

View File

@@ -1,6 +1,7 @@
class ModelManager { class ModelManager {
constructor() { constructor(dbManager) {
this.dbManager = dbManager;
this.notes = []; this.notes = [];
this.tags = []; this.tags = [];
this.itemSyncObservers = []; this.itemSyncObservers = [];
@@ -217,6 +218,8 @@ class ModelManager {
} else if(item.content_type == "Extension") { } else if(item.content_type == "Extension") {
_.pull(this._extensions, item); _.pull(this._extensions, item);
} }
this.dbManager.deleteItem(item);
} }
/* /*

View File

@@ -2437,7 +2437,7 @@ var Tag = function (_Item3) {
this.writeItemsToLocalStorage = function (items, callback) { this.writeItemsToLocalStorage = function (items, callback) {
var params = items.map(function (item) { var params = items.map(function (item) {
return this.paramsForItem(item, this.isUserSignedIn(), ["created_at", "updated_at", "presentation_url"], false); return this.paramsForItem(item, this.isUserSignedIn(), ["created_at", "updated_at", "presentation_url", "dirty"], false);
}.bind(this)); }.bind(this));
dbManager.saveItems(params, callback); dbManager.saveItems(params, callback);
@@ -3189,7 +3189,7 @@ var ExtensionManager = function () {
return params; return params;
}.bind(this)); }.bind(this));
} else { } else {
params.item = this.outgoingParamsForItem(item, extension); params.items = [this.outgoingParamsForItem(item, extension)];
} }
this.performPost(action, extension, params, function (response) { this.performPost(action, extension, params, function (response) {
@@ -3352,9 +3352,10 @@ angular.module('app.frontend').service('extensionManager', ExtensionManager);
}); });
; ;
var ModelManager = function () { var ModelManager = function () {
function ModelManager() { function ModelManager(dbManager) {
_classCallCheck(this, ModelManager); _classCallCheck(this, ModelManager);
this.dbManager = dbManager;
this.notes = []; this.notes = [];
this.tags = []; this.tags = [];
this.itemSyncObservers = []; this.itemSyncObservers = [];
@@ -3686,6 +3687,8 @@ var ModelManager = function () {
} else if (item.content_type == "Extension") { } else if (item.content_type == "Extension") {
_.pull(this._extensions, item); _.pull(this._extensions, item);
} }
this.dbManager.deleteItem(item);
} }
/* /*

File diff suppressed because one or more lines are too long