Merge pull request #1631 from nextcloud/bugfix/noid/do_not_show_calendar_picker_if_only_one_writeable

Hide calendar-picker if user has only one writable calendar
This commit is contained in:
Georg Ehrke 2019-11-05 13:06:59 +00:00 committed by GitHub
commit 9a8f8bbfd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -242,6 +242,19 @@ export default {
selectedCalendar() {
return this.$store.getters.getCalendarById(this.calendarId)
},
/**
* Returns whether or not to display the calendar-picker
*
* @returns {boolean}
*/
showCalendarPicker() {
// Always show the calendar's name when we are in a read-only calendar
if (this.isReadOnly) {
return true
}
return this.$store.getters.sortedCalendars.length > 1
},
/**
* Returns the preferred timezone of the user.
* If the timezone is set to automatic, it returns the detected one

View File

@ -83,6 +83,7 @@
</div>
<div v-if="!isLoading" class="app-sidebar-tab__content">
<PropertyCalendarPicker
v-if="showCalendarPicker"
:calendars="calendars"
:calendar="selectedCalendar"
:is-read-only="isReadOnly"

View File

@ -76,7 +76,7 @@
@toggleAllDay="toggleAllDay" />
<PropertyCalendarPicker
v-if="!isLoading"
v-if="!isLoading && showCalendarPicker"
:calendars="calendars"
:calendar="selectedCalendar"
:is-read-only="isReadOnly"