diff --git a/src/esn.calendar.libs/app/services/calendar-visibility-service.js b/src/esn.calendar.libs/app/services/calendar-visibility-service.js index 6fa851c9..5178825c 100644 --- a/src/esn.calendar.libs/app/services/calendar-visibility-service.js +++ b/src/esn.calendar.libs/app/services/calendar-visibility-service.js @@ -12,7 +12,8 @@ require('../app.constants.js'); return { getHiddenCalendars: getHiddenCalendars, isHidden: isHidden, - toggle: toggle + toggle: toggle, + showCalendarHideOthers }; //////////// @@ -23,6 +24,23 @@ require('../app.constants.js'); }); } + function showCalendarHideOthers(calendarToShow, calendarsToHide) { + + $rootScope.$broadcast(CAL_EVENTS.CALENDARS.TOGGLE_VIEW, { + calendarUniqueId: calendarToShow, + hidden: false + }); + + calendarsToHide.forEach(function(calendar) { + const calId = calendar.getUniqueId(); + + $rootScope.$broadcast(CAL_EVENTS.CALENDARS.TOGGLE_VIEW, { + calendarUniqueId: calId, + hidden: true + }); + }); + } + function toggle(calendar) { var calId = calendar.getUniqueId(); diff --git a/src/linagora.esn.calendar/app/components/calendars-list/calendars-list.controller.js b/src/linagora.esn.calendar/app/components/calendars-list/calendars-list.controller.js index ee921816..730ab811 100644 --- a/src/linagora.esn.calendar/app/components/calendars-list/calendars-list.controller.js +++ b/src/linagora.esn.calendar/app/components/calendars-list/calendars-list.controller.js @@ -20,7 +20,6 @@ const _ = require('lodash'); self.$onInit = $onInit; self.activate = activate; - //////////// function $onInit() { @@ -30,7 +29,7 @@ const _ = require('lodash'); self.sharedCalendars = []; self.hiddenCalendars = {}; self.toggleCalendar = calendarVisibilityService.toggle; - + self.selectAllCalendars = selectAllCalendars; self.activate(); } @@ -52,6 +51,14 @@ const _ = require('lodash'); }); } + function selectAllCalendars() { + const calendars = userAndExternalCalendars(self.calendars); + + calendars.userCalendars.forEach(function(calendar) { + calendarVisibilityService.toggle(calendar); + }); + } + function listCalendars() { return calendarService.listPersonalAndAcceptedDelegationCalendars(session.user._id).then(function(calendars) { self.calendars = _.clone(calendars); diff --git a/src/linagora.esn.calendar/app/components/calendars-list/calendars-list.pug b/src/linagora.esn.calendar/app/components/calendars-list/calendars-list.pug index fd90f3a0..315fb6dd 100644 --- a/src/linagora.esn.calendar/app/components/calendars-list/calendars-list.pug +++ b/src/linagora.esn.calendar/app/components/calendars-list/calendars-list.pug @@ -2,7 +2,9 @@ cal-user-calendars-list( user-calendars="$ctrl.userCalendars", toggle-calendar="$ctrl.toggleCalendar", - hidden-calendars="$ctrl.hiddenCalendars" + hidden-calendars="$ctrl.hiddenCalendars", + select-all-calendars="$ctrl.selectAllCalendars" + ) cal-external-calendars-list( diff --git a/src/linagora.esn.calendar/app/components/calendars-list/external/external-calendars-list.pug b/src/linagora.esn.calendar/app/components/calendars-list/external/external-calendars-list.pug index 65aacd74..18eb591a 100644 --- a/src/linagora.esn.calendar/app/components/calendars-list/external/external-calendars-list.pug +++ b/src/linagora.esn.calendar/app/components/calendars-list/external/external-calendars-list.pug @@ -2,7 +2,7 @@ .lv-item.calendar-item.calendar-header-title.hidden-md .media .pull-left - i.mdi.mdi-calendar + i.mdi.mdi-checkbox-blank-circle.all-calendars-selected .media-body .lv-title {{ 'Shared calendars' | translate }} .lv-item.calendar-item.calendar-header-title-desktop.visible-md.clickable.toggle-submenu.waves-classic(esn-toggle) @@ -11,7 +11,7 @@ .caret-submenu i.mdi.mdi-menu-down .calendar-item-left - i.mdi.mdi-calendar + i.mdi.mdi-checkbox-blank-circle.all-calendars-selected(ng-click="$ctrl.selectAllCalendars()") .media-body .lv-title {{ 'Shared calendars' | translate }} diff --git a/src/linagora.esn.calendar/app/components/calendars-list/items/item/configuration/calendars-list-item-configuration.controller.js b/src/linagora.esn.calendar/app/components/calendars-list/items/item/configuration/calendars-list-item-configuration.controller.js index 14c5b966..143e6095 100644 --- a/src/linagora.esn.calendar/app/components/calendars-list/items/item/configuration/calendars-list-item-configuration.controller.js +++ b/src/linagora.esn.calendar/app/components/calendars-list/items/item/configuration/calendars-list-item-configuration.controller.js @@ -4,17 +4,22 @@ angular.module('esn.calendar') .controller('CalendarsListItemConfigurationController', CalendarsListItemConfigurationController); - function CalendarsListItemConfigurationController($state) { + function CalendarsListItemConfigurationController($state, calendarVisibilityService) { var self = this; self.$onInit = $onInit; function $onInit() { self.onOptionClick = onOptionClick; + self.showAndHide = showAndHide; } function onOptionClick() { $state.go('calendar.main.edit', { calendarUniqueId: self.calendarId }); } + + function showAndHide() { + calendarVisibilityService.showCalendarHideOthers(self.calendarId); + } } })(angular); diff --git a/src/linagora.esn.calendar/app/components/calendars-list/items/item/configuration/configuration-list.pug b/src/linagora.esn.calendar/app/components/calendars-list/items/item/configuration/configuration-list.pug index 6fe7c154..eee6e556 100644 --- a/src/linagora.esn.calendar/app/components/calendars-list/items/item/configuration/configuration-list.pug +++ b/src/linagora.esn.calendar/app/components/calendars-list/items/item/configuration/configuration-list.pug @@ -1,4 +1,8 @@ md-menu-item md-button(ng-click="$ctrl.onOptionClick()") md-icon(md-menu-origin, md-svg-icon="settings", aria-label="settings open Icon") - | {{ 'Settings' | translate }} \ No newline at end of file + | {{ 'Settings' | translate }} +md-menu-item + md-button(ng-click="$ctrl.showAndHide()") + md-icon(md-menu-origin, md-svg-icon="eye", aria-label="show calendar Icon") + | {{ 'Show only this calendar' | translate }} \ No newline at end of file diff --git a/src/linagora.esn.calendar/app/components/calendars-list/user/user-calendars-list.component.js b/src/linagora.esn.calendar/app/components/calendars-list/user/user-calendars-list.component.js index 157bb91f..6f66fc49 100644 --- a/src/linagora.esn.calendar/app/components/calendars-list/user/user-calendars-list.component.js +++ b/src/linagora.esn.calendar/app/components/calendars-list/user/user-calendars-list.component.js @@ -7,7 +7,8 @@ bindings: { userCalendars: '=', toggleCalendar: '=', - hiddenCalendars: '=' + hiddenCalendars: '=', + selectAllCalendars: '=' } }); })(angular); diff --git a/src/linagora.esn.calendar/app/components/calendars-list/user/user-calendars-list.pug b/src/linagora.esn.calendar/app/components/calendars-list/user/user-calendars-list.pug index caed2db9..0671c205 100644 --- a/src/linagora.esn.calendar/app/components/calendars-list/user/user-calendars-list.pug +++ b/src/linagora.esn.calendar/app/components/calendars-list/user/user-calendars-list.pug @@ -2,16 +2,16 @@ .lv-item.calendar-item.calendar-header-title.hidden-md .media .pull-left - i.mdi.mdi-calendar + i.mdi.mdi-checkbox-blank-circle.all-calendars-selected .media-body .lv-title {{ 'My calendars' | translate }} - .lv-item.calendar-item.calendar-header-title-desktop.visible-md.clickable.toggle-submenu.waves-classic(esn-toggle) + .lv-item.calendar-item.calendar-header-title-desktop.visible-md.clickable.toggle-submenu.waves-classic .media .badge-container .caret-submenu i.mdi.mdi-menu-down .calendar-item-left - i.mdi.mdi-calendar + i.mdi.mdi-checkbox-blank-circle.all-calendars-selected(ng-click="$ctrl.selectAllCalendars()") .media-body .lv-title {{ 'My calendars' | translate }}