Add collapsed classes on app element
This commit is contained in:
@@ -11,6 +11,17 @@ angular.module('app')
|
||||
$rootScope.$broadcast('new-update-available', version);
|
||||
}
|
||||
|
||||
$rootScope.$on("panel-resized", (event, info) => {
|
||||
if(info.panel == "notes") { this.notesCollapsed = info.collapsed; }
|
||||
if(info.panel == "tags") { this.tagsCollapsed = info.collapsed; }
|
||||
|
||||
let appClass = "";
|
||||
if(this.notesCollapsed) { appClass += "collapsed-notes"; }
|
||||
if(this.tagsCollapsed) { appClass += " collapsed-tags"; }
|
||||
|
||||
$scope.appClass = appClass;
|
||||
})
|
||||
|
||||
/* Used to avoid circular dependencies where syncManager cannot be imported but rootScope can */
|
||||
$rootScope.sync = function(source) {
|
||||
syncManager.sync();
|
||||
|
||||
@@ -66,14 +66,18 @@ angular.module('app')
|
||||
let width = authManager.getUserPrefValue("notesPanelWidth");
|
||||
if(width) {
|
||||
this.panelController.setWidth(width);
|
||||
if(this.panelController.isCollapsed) {
|
||||
$rootScope.$broadcast("panel-resized", {panel: "notes", collapsed: this.panelController.isCollapsed})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.loadPreferences();
|
||||
|
||||
this.onPanelResize = function(newWidth) {
|
||||
this.onPanelResize = function(newWidth, lastLeft, isAtMaxWidth, isCollapsed) {
|
||||
authManager.setUserPrefValue("notesPanelWidth", newWidth);
|
||||
authManager.syncUserPreferences();
|
||||
$rootScope.$broadcast("panel-resized", {panel: "notes", collapsed: isCollapsed})
|
||||
}
|
||||
|
||||
angular.element(document).ready(() => {
|
||||
|
||||
@@ -47,13 +47,17 @@ angular.module('app')
|
||||
let width = authManager.getUserPrefValue("tagsPanelWidth");
|
||||
if(width) {
|
||||
this.panelController.setWidth(width);
|
||||
if(this.panelController.isCollapsed) {
|
||||
$rootScope.$broadcast("panel-resized", {panel: "tags", collapsed: this.panelController.isCollapsed})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.loadPreferences();
|
||||
|
||||
this.onPanelResize = function(newWidth) {
|
||||
this.onPanelResize = function(newWidth, lastLeft, isAtMaxWidth, isCollapsed) {
|
||||
authManager.setUserPrefValue("tagsPanelWidth", newWidth, true);
|
||||
$rootScope.$broadcast("panel-resized", {panel: "tags", collapsed: isCollapsed})
|
||||
}
|
||||
|
||||
this.componentManager = componentManager;
|
||||
|
||||
@@ -32,6 +32,10 @@ class PanelResizer {
|
||||
scope.control.flash = function() {
|
||||
scope.flash();
|
||||
}
|
||||
|
||||
scope.control.isCollapsed = function() {
|
||||
return scope.isCollapsed();
|
||||
}
|
||||
}
|
||||
|
||||
controller($scope, $element, modelManager, actionsManager, $timeout, $compile) {
|
||||
@@ -61,7 +65,7 @@ class PanelResizer {
|
||||
$scope.setWidth(minWidth);
|
||||
}
|
||||
$scope.finishSettingWidth();
|
||||
$scope.onResizeFinish()(lastWidth, lastLeft, $scope.isAtMaxWidth());
|
||||
$scope.onResizeFinish()(lastWidth, lastLeft, $scope.isAtMaxWidth(), collapsed);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -274,7 +278,7 @@ class PanelResizer {
|
||||
let isMaxWidth = $scope.isAtMaxWidth();
|
||||
|
||||
if($scope.onResizeFinish) {
|
||||
$scope.onResizeFinish()(lastWidth, lastLeft, isMaxWidth);
|
||||
$scope.onResizeFinish()(lastWidth, lastLeft, isMaxWidth, $scope.isCollapsed());
|
||||
}
|
||||
|
||||
$scope.finishSettingWidth();
|
||||
|
||||
Reference in New Issue
Block a user