Skip to content

Commit

Permalink
Merge pull request #89 from nextcloud/sidebar_hide_calendars_input_if…
Browse files Browse the repository at this point in the history
…_only_one

editor: show calendar selection only if more than one writable calendar is available
  • Loading branch information
georgehrke authored Sep 25, 2016
2 parents 85b2a64 + 2dff209 commit 849496c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions js/app/controllers/editorcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ app.controller('EditorController', ['$scope', 'TimezoneService', 'AutoCompletion
$scope.eventsrepeatview = true;
}
};

/**
* Everything calendar select
*/
$scope.showCalendarSelection = function() {
const writableCalendars = $scope.calendars.filter(function (c) {
return c.isWritable();
});

return writableCalendars.length > 1;
};

/**
* Everything date and time
*/
Expand Down
3 changes: 2 additions & 1 deletion templates/editor.popover.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class="events--input h2"
/>
<select
ng-model="calendar"
ng-options="c as c.displayname for c in calendars | orderBy:['order'] | calendarSelectorFilter: oldCalendar"></select>
ng-options="c as c.displayname for c in calendars | orderBy:['order'] | calendarSelectorFilter: oldCalendar"
ng-show="showCalendarSelection()"></select>
</fieldset>

<fieldset class="event-time events--fieldset" ng-disabled="readOnly">
Expand Down
3 changes: 2 additions & 1 deletion templates/editor.sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class="advanced--input h2"
autofocus="autofocus"/>
<select
ng-model="calendar"
ng-options="c as c.displayname for c in calendars | orderBy:['order'] | calendarSelectorFilter: oldCalendar"></select>
ng-options="c as c.displayname for c in calendars | orderBy:['order'] | calendarSelectorFilter: oldCalendar"
ng-show="showCalendarSelection()"></select>
</fieldset>

<fieldset class="advanced--fieldset start-end-container" ng-disabled="readOnly">
Expand Down

0 comments on commit 849496c

Please sign in to comment.