Menu updates
This commit is contained in:
@@ -22,7 +22,8 @@ angular.module('app.frontend')
|
||||
}
|
||||
}
|
||||
})
|
||||
.controller('FooterCtrl', function ($rootScope, authManager, modelManager, $timeout, dbManager, syncManager, storageManager, passcodeManager) {
|
||||
.controller('FooterCtrl', function ($rootScope, authManager, modelManager, $timeout, dbManager,
|
||||
syncManager, storageManager, passcodeManager, componentManager, singletonManager) {
|
||||
|
||||
this.user = authManager.user;
|
||||
|
||||
@@ -106,4 +107,63 @@ angular.module('app.frontend')
|
||||
this.newUpdateAvailable = false;
|
||||
alert("A new update is ready to install. Updates address performance and security issues, as well as bug fixes and feature enhancements. Simply quit Standard Notes and re-open it for the update to be applied.")
|
||||
}
|
||||
|
||||
|
||||
/* Rooms */
|
||||
|
||||
this.componentManager = componentManager;
|
||||
this.rooms = [];
|
||||
|
||||
modelManager.addItemSyncObserver("room-bar", "SN|Component", (allItems, validItems, deletedItems, source) => {
|
||||
this.rooms = _.uniq(this.rooms.concat(allItems.filter((candidate) => {return candidate.area == "rooms"})))
|
||||
.filter((candidate) => {return !candidate.deleted});
|
||||
});
|
||||
|
||||
componentManager.registerHandler({identifier: "roomBar", areas: ["rooms"], activationHandler: (component) => {
|
||||
if(component.active) {
|
||||
$timeout(() => {
|
||||
var iframe = componentManager.iframeForComponent(component);
|
||||
if(iframe) {
|
||||
var lastSize = component.getRoomLastSize();
|
||||
if(lastSize) {
|
||||
componentManager.handleSetSizeEvent(component, lastSize);
|
||||
}
|
||||
iframe.onload = function() {
|
||||
componentManager.registerComponentWindow(component, iframe.contentWindow);
|
||||
}.bind(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, actionHandler: (component, action, data) => {
|
||||
if(action == "set-size") {
|
||||
componentManager.handleSetSizeEvent(component, data);
|
||||
component.setRoomLastSize(data);
|
||||
}
|
||||
}});
|
||||
|
||||
this.selectRoom = function(room) {
|
||||
room.show = !room.show;
|
||||
if(room.show) {
|
||||
this.componentManager.activateComponent(room);
|
||||
} else {
|
||||
this.hideRoom(room);
|
||||
}
|
||||
}
|
||||
|
||||
this.hideRoom = function(room) {
|
||||
room.show = false;
|
||||
this.componentManager.deactivateComponent(room);
|
||||
}
|
||||
|
||||
// Handle singleton ProLink instance
|
||||
singletonManager.registerSingleton({content_type: "SN|Component", package_info: {identifier: "org.standardnotes.prolink"}}, (resolvedSingleton) => {
|
||||
console.log("Roombar received resolved ProLink", resolvedSingleton);
|
||||
}, (valueCallback) => {
|
||||
console.log("Creating prolink");
|
||||
// Safe to create. Create and return object.
|
||||
let url = window._prolink_package_url;
|
||||
packageManager.installPackage(url, (component) => {
|
||||
valueCallback(component);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
class RoomBar {
|
||||
|
||||
constructor() {
|
||||
this.restrict = "E";
|
||||
this.templateUrl = "frontend/directives/room-bar.html";
|
||||
this.scope = {
|
||||
};
|
||||
}
|
||||
|
||||
controller($rootScope, $scope, desktopManager, syncManager, modelManager, componentManager, $timeout, singletonManager, packageManager) {
|
||||
'ngInject';
|
||||
|
||||
$scope.componentManager = componentManager;
|
||||
$scope.rooms = [];
|
||||
|
||||
modelManager.addItemSyncObserver("room-bar", "SN|Component", (allItems, validItems, deletedItems, source) => {
|
||||
$scope.rooms = _.uniq($scope.rooms.concat(allItems.filter((candidate) => {return candidate.area == "rooms"})))
|
||||
.filter((candidate) => {return !candidate.deleted});
|
||||
});
|
||||
|
||||
componentManager.registerHandler({identifier: "roomBar", areas: ["rooms"], activationHandler: (component) => {
|
||||
if(component.active) {
|
||||
$timeout(() => {
|
||||
var iframe = componentManager.iframeForComponent(component);
|
||||
if(iframe) {
|
||||
var lastSize = component.getRoomLastSize();
|
||||
if(lastSize) {
|
||||
componentManager.handleSetSizeEvent(component, lastSize);
|
||||
}
|
||||
iframe.onload = function() {
|
||||
componentManager.registerComponentWindow(component, iframe.contentWindow);
|
||||
}.bind(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, actionHandler: (component, action, data) => {
|
||||
if(action == "set-size") {
|
||||
componentManager.handleSetSizeEvent(component, data);
|
||||
component.setRoomLastSize(data);
|
||||
}
|
||||
}});
|
||||
|
||||
$scope.selectRoom = function(room) {
|
||||
room.show = !room.show;
|
||||
if(room.show) {
|
||||
this.componentManager.activateComponent(room);
|
||||
} else {
|
||||
$scope.hideRoom(room);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.hideRoom = function(room) {
|
||||
room.show = false;
|
||||
this.componentManager.deactivateComponent(room);
|
||||
}
|
||||
|
||||
// Handle singleton ProLink instance
|
||||
singletonManager.registerSingleton({content_type: "SN|Component", package_info: {identifier: "org.standardnotes.prolink"}}, (resolvedSingleton) => {
|
||||
console.log("Roombar received resolved ProLink", resolvedSingleton);
|
||||
}, (valueCallback) => {
|
||||
console.log("Creating prolink");
|
||||
// Safe to create. Create and return object.
|
||||
let url = window._prolink_package_url;
|
||||
packageManager.installPackage(url, (component) => {
|
||||
valueCallback(component);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
angular.module('app.frontend').directive('roomBar', () => new RoomBar);
|
||||
Reference in New Issue
Block a user