Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
(js) Persistent state of center list in Calendars
Fixes #3861
  • Loading branch information
cgx committed Nov 21, 2016
1 parent 909b18b commit 99b0025
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion NEWS
Expand Up @@ -3,7 +3,7 @@

New features
- [core] support repetitive email alarms on tasks and events (#1053)
- [web] allow to hide center column on large screens
- [web] allow to hide center column on large screens (#3861)
- [eas] relaxed permission requirements for subscription synchronizations (#3118 and #3180)

Enhancements
Expand Down
8 changes: 5 additions & 3 deletions UI/Scheduler/UIxCalMainView.m
Expand Up @@ -278,27 +278,29 @@ - (WOResponse *) saveSelectedListAction
- (WOResponse *) saveListStateAction
{
WORequest *request;
NSDictionary *params;
NSString *state;

[self _setupContext];
request = [context request];
params = [[request contentAsString] objectFromJSONString];

state = [request formValueForKey: @"state"];
state = [params objectForKey: @"state"];
[moduleSettings setObject: state
forKey: @"ListState"];
[us synchronize];

return [self responseWithStatus: 204];
}

- (NSString *) listStateStyle
- (BOOL) listIsCollapsed
{
NSString *state;

[self _setupContext];
state = [moduleSettings objectForKey: @"ListState"];

return (state && [state compare: @"collapse"] == NSOrderedSame)? @"display: none;" : @"";
return (state && [state compare: @"collapse"] == NSOrderedSame);
}

- (WOResponse *) saveFoldersOrderAction
Expand Down
2 changes: 1 addition & 1 deletion UI/Templates/SchedulerUI/UIxCalDayView.wox
Expand Up @@ -9,7 +9,7 @@

<md-card>
<md-card-actions flex-none="flex-none" layout="row" layout-align="start center">
<md-button ng-click="toggleCenter()"
<md-button ng-click="toggleCenter({save: true})"
class="md-icon-button md-primary md-hue-1 hide show-gt-xs"
aria-hidden="true">
<md-icon class="icon-fullscreen"
Expand Down
5 changes: 4 additions & 1 deletion UI/Templates/SchedulerUI/UIxCalMainView.wox
Expand Up @@ -14,6 +14,7 @@
var dayStartHour = <var:string value="dayStartHour"/>;
var currentView = '<var:string value="currentView"/>';
var localeCode = '<var:string value="localeCode" />';
var centerIsClose = <var:string value="listIsCollapsed.jsonRepresentation" />;
</script>
<var:component className="UIxCalendarSelector" />

Expand Down Expand Up @@ -348,7 +349,9 @@
</md-toolbar>
<div layout="row" class="md-flex">

<div class="view-list" layout="column" ng-class="{'view-list--close': centerIsClose}">
<div class="view-list ng-hide" layout="column"
ng-show="list.selectedList >= 0"
ng-class="{'view-list--close': centerIsClose}">
<md-toolbar class="md-accent md-hue-1" flex-none="flex-none"
ng-hide="list.mode.multiple">
<!-- sort/filter mode (default) -->
Expand Down
2 changes: 1 addition & 1 deletion UI/Templates/SchedulerUI/UIxCalMonthView.wox
Expand Up @@ -9,7 +9,7 @@

<md-card>
<md-card-actions flex-none="flex-none" layout="row" layout-align="start center">
<md-button ng-click="toggleCenter()"
<md-button ng-click="toggleCenter({save: true})"
class="md-icon-button md-primary md-hue-1 hide show-gt-xs"
aria-hidden="true">
<md-icon class="icon-fullscreen"
Expand Down
2 changes: 1 addition & 1 deletion UI/Templates/SchedulerUI/UIxCalMulticolumnDayView.wox
Expand Up @@ -9,7 +9,7 @@

<md-card>
<md-card-actions flex-none="flex-none" layout="row" layout-align="start center">
<md-button ng-click="toggleCenter()"
<md-button ng-click="toggleCenter({save: true})"
class="md-icon-button md-primary md-hue-1 hide show-gt-xs"
aria-hidden="true">
<md-icon class="icon-fullscreen"
Expand Down
2 changes: 1 addition & 1 deletion UI/Templates/SchedulerUI/UIxCalWeekView.wox
Expand Up @@ -9,7 +9,7 @@

<md-card>
<md-card-actions flex-none="flex-none" layout="row" layout-align="start center">
<md-button ng-click="toggleCenter()"
<md-button ng-click="toggleCenter({save: true})"
class="md-icon-button md-primary md-hue-1 hide show-gt-xs"
aria-hidden="true">
<md-icon class="icon-fullscreen"
Expand Down
11 changes: 7 additions & 4 deletions UI/WebServerResources/js/Common/navController.js
Expand Up @@ -9,14 +9,15 @@
/**
* @ngInject
*/
navController.$inject = ['$rootScope', '$scope', '$timeout', '$interval', '$http', '$window', '$mdSidenav', '$mdToast', '$mdMedia', '$log', 'sgConstant', 'sgSettings', 'Alarm'];
function navController($rootScope, $scope, $timeout, $interval, $http, $window, $mdSidenav, $mdToast, $mdMedia, $log, sgConstant, sgSettings, Alarm) {
navController.$inject = ['$rootScope', '$scope', '$timeout', '$interval', '$http', '$window', '$mdSidenav', '$mdToast', '$mdMedia', '$log', 'sgConstant', 'sgSettings', 'Resource', 'Alarm'];
function navController($rootScope, $scope, $timeout, $interval, $http, $window, $mdSidenav, $mdToast, $mdMedia, $log, sgConstant, sgSettings, Resource, Alarm) {
var resource = new Resource(sgSettings.baseURL(), sgSettings.activeUser());

$scope.isPopup = sgSettings.isPopup;
$scope.activeUser = sgSettings.activeUser();
$scope.baseURL = sgSettings.baseURL();
$scope.leftIsClose = !$mdMedia(sgConstant['gt-md']);
$scope.centerIsClose = false;
$scope.centerIsClose = !!$window.centerIsClose;

// Show current day in top bar
$scope.currentDay = window.currentDay;
Expand Down Expand Up @@ -53,8 +54,10 @@
$log.debug("toggle right is done");
});
};
$scope.toggleCenter = function() {
$scope.toggleCenter = function(options) {
$scope.centerIsClose = !$scope.centerIsClose;
if (options && options.save)
resource.post(null, 'saveListState', { state: $scope.centerIsClose? 'collapse' : 'rise' });
};
// $scope.openBottomSheet = function() {
// $mdBottomSheet.show({
Expand Down

0 comments on commit 99b0025

Please sign in to comment.