Merge pull request #347 from owncloud/CalDAV-And-Export

Add CalDAV-Link and export function
This commit is contained in:
raimund-schluessler 2016-08-11 14:34:42 +02:00 committed by GitHub
commit 72026da720
5 changed files with 126 additions and 15 deletions

View file

@ -47,10 +47,21 @@
#app-navigation .app-navigation-entry-menu li {
float: inherit;
width: auto !important;
padding: 10px;
opacity: 0.5;
cursor: pointer;
height: 38px;
}
#app-navigation .app-navigation-entry-menu li>a,
#app-navigation .app-navigation-entry-menu li>span {
width: 100%;
padding: 10px;
display: inline-block;
line-height: normal;
height: auto;
min-height: auto;
box-sizing: border-box;
}
#app-navigation .app-navigation-entry-menu li img,
#app-navigation .app-navigation-entry-menu li span{
cursor: pointer;
@ -65,11 +76,13 @@
#app-navigation .app-navigation-entry-menu li button{
float: inherit;
}
#app-navigation li.edit .app-navigation-entry-edit {
#app-navigation li.edit .app-navigation-entry-edit.name,
#app-navigation li.caldav .app-navigation-entry-edit.caldav {
display: inline-block;
height: auto;
}
#app-navigation li .app-navigation-entry-edit {
#app-navigation li .app-navigation-entry-edit.name,
#app-navigation li .app-navigation-entry-edit.caldav {
display: none;
}
#app-navigation li a > span.icon {
@ -1541,9 +1554,14 @@ ol[dnd-list] .dndPlaceholder {
background-color: white;
}
#app-navigation .app-navigation-entry-edit input[type="text"] {
#app-navigation .app-navigation-entry-edit.name input[type="text"] {
width: calc(100% - 72px);
}
#app-navigation .app-navigation-entry-edit.caldav input[type="text"] {
width: calc(100% - 36px);
}
.error input.edit {
color: #e9322d;
border-color: #e9322d !important;

View file

@ -100,6 +100,29 @@ angular.module('Tasks').controller('ListController', [
}, 50);
};
this._$scope.showCalDAVUrl = function(calendar) {
_$scope.status.addingList = false;
_$scope.nameError = false;
$location.path('/calendars/' + _$scope.route.calendarID + '/edit/caldav');
_$timeout(function() {
$('#list_' + calendar.uri + ' input.caldav').focus();
}, 50);
};
this._$scope.hideCalDAVUrl = function() {
$location.path('/calendars/' + _$scope.route.calendarID);
};
this._$scope.download = function (calendar) {
var url = calendar.url;
// cut off last slash to have a fancy name for the ics
if (url.slice(url.length - 1) === '/') {
url = url.slice(0, url.length - 1);
}
url += '?export';
$window.open(url);
};
this._$scope.checkNew = function(event,name) {
_$scope.checkName(event,name);
};

View file

@ -23,7 +23,7 @@
*
*/
angular.module('Tasks').factory('Calendar', ['$rootScope', '$filter', function($rootScope, $filter) {
angular.module('Tasks').factory('Calendar', ['$rootScope', '$filter', '$window', function($rootScope, $filter, $window) {
'use strict';
function Calendar(url, props, uri) {
@ -155,6 +155,18 @@ angular.module('Tasks').factory('Calendar', ['$rootScope', '$filter', function($
get url() {
return this._properties.url;
},
get caldav() {
return $window.location.origin + this.url;
},
get exportUrl() {
var url = this.url;
// cut off last slash to have a fancy name for the ics
if (url.slice(url.length - 1) === '/') {
url = url.slice(0, url.length - 1);
}
url += '?export';
return url;
},
get enabled() {
return this._properties.enabled;
},

View file

@ -658,6 +658,29 @@ angular.module('Tasks').controller('ListController', [
}, 50);
};
this._$scope.showCalDAVUrl = function(calendar) {
_$scope.status.addingList = false;
_$scope.nameError = false;
$location.path('/calendars/' + _$scope.route.calendarID + '/edit/caldav');
_$timeout(function() {
$('#list_' + calendar.uri + ' input.caldav').focus();
}, 50);
};
this._$scope.hideCalDAVUrl = function() {
$location.path('/calendars/' + _$scope.route.calendarID);
};
this._$scope.download = function (calendar) {
var url = calendar.url;
// cut off last slash to have a fancy name for the ics
if (url.slice(url.length - 1) === '/') {
url = url.slice(0, url.length - 1);
}
url += '?export';
$window.open(url);
};
this._$scope.checkNew = function(event,name) {
_$scope.checkName(event,name);
};
@ -3033,7 +3056,7 @@ angular.module('Tasks').factory('Loading', [
}).call(this);
angular.module('Tasks').factory('Calendar', ['$rootScope', '$filter', function($rootScope, $filter) {
angular.module('Tasks').factory('Calendar', ['$rootScope', '$filter', '$window', function($rootScope, $filter, $window) {
'use strict';
function Calendar(url, props, uri) {
@ -3165,6 +3188,18 @@ angular.module('Tasks').factory('Calendar', ['$rootScope', '$filter', function($
get url() {
return this._properties.url;
},
get caldav() {
return $window.location.origin + this.url;
},
get exportUrl() {
var url = this.url;
// cut off last slash to have a fancy name for the ics
if (url.slice(url.length - 1) === '/') {
url = url.slice(0, url.length - 1);
}
url += '?export';
return url;
},
get enabled() {
return this._properties.enabled;
},

View file

@ -41,7 +41,8 @@
id="list_{{ calendar.uri }}"
calendarID="{{calendar.uri}}"
ng-repeat="calendar in calendars"
ng-class="{active: calendar.uri==route.calendarID, edit:route.listparameter == 'name' && route.calendarID == calendar.uri}"
ng-class="{ active: calendar.uri==route.calendarID, edit:route.listparameter == 'name' && route.calendarID == calendar.uri,
caldav: route.listparameter == 'caldav' && route.calendarID == calendar.uri}"
dnd-list="draggedTasks"
dnd-drop="dropList(event, index, item)"
dnd-dragover="dragoverList(event, index)">
@ -57,17 +58,33 @@
</div>
<div class="app-navigation-entry-menu" ng-show="calendar.writable">
<ul>
<li title="<?php p($l->t('Edit')); ?>" ng-click="startEdit(calendar)" >
<img class="icon-rename svg" src="<?php p(image_path('core', 'actions/rename.svg'))?>"/>
<span><?php p($l->t('Edit')); ?></span>
<li>
<span title="<?php p($l->t('Edit')); ?>" ng-click="startEdit(calendar)">
<img class="icon-rename svg" src="<?php p(image_path('core', 'actions/rename.svg'))?>"/>
<span><?php p($l->t('Edit')); ?></span>
</span>
</li>
<li title="<?php p($l->t('Delete')); ?>" ng-click="delete(calendar)">
<img class="icon-delete svg" src="<?php p(image_path('core', 'actions/delete.svg'))?>"/>
<span><?php p($l->t('Delete')); ?></span>
<li>
<span title="<?php p($l->t('CalDAV-Link')); ?>" ng-click="showCalDAVUrl(calendar)">
<img class="icon-public svg" src="<?php p(image_path('core', 'actions/public.svg'))?>"/>
<span><?php p($l->t('CalDAV-Link')); ?></span>
</span>
</li>
<li>
<a href="{{calendar.exportUrl}}" download="{{calendar.uri}}.ics" title="<?php p($l->t('Export')); ?>">
<img class="icon-download svg" src="<?php p(image_path('core', 'actions/download.svg'))?>"/>
<span><?php p($l->t('Export')); ?></span>
</a>
</li>
<li>
<span title="<?php p($l->t('Delete')); ?>" ng-click="delete(calendar)">
<img class="icon-delete svg" src="<?php p(image_path('core', 'actions/delete.svg'))?>"/>
<span><?php p($l->t('Delete')); ?></span>
</span>
</li>
</ul>
</div>
<div class="app-navigation-entry-edit" ng-class="{error: nameError}">
<div class="app-navigation-entry-edit name" ng-class="{error: nameError}">
<form>
<input ng-model="calendar.displayname" class="edit hasTooltip" type="text" ng-keyup="checkEdit($event,calendar)" autofocus-on-insert>
<input type="cancel" value="" class="action icon-close svg" ng-click="cancelEdit(calendar)" title="<?php p($l->t('Cancel')); ?>">
@ -77,13 +94,19 @@
selected="calendar.color">
</colorpicker>
</div>
<div class="app-navigation-entry-edit caldav">
<form>
<input class="caldav" ng-value="calendar.caldav" readonly type="text"/>
<input type="cancel" value="" class="action icon-close svg" ng-click="hideCalDAVUrl()" title="<?php p($l->t('Cancel')); ?>">
</form>
</div>
</li>
<li class="newList handler" ng-class="{edit: status.addingList}">
<a class="addlist" ng-click="startCreate()" oc-click-focus="{selector: '#newList', timeout: 0}">
<span class="icon detail-add"></span>
<span class="title"><?php p($l->t('Add List...')); ?></span>
</a>
<div class="app-navigation-entry-edit" ng-class="{error: nameError}">
<div class="app-navigation-entry-edit name" ng-class="{error: nameError}">
<form ng-disabled="isAddingList">
<input id="newList" ng-model="status.newListName" class="edit hasTooltip" type="text" autofocus-on-insert
placeholder="<?php p($l->t('New List')); ?>" ng-keyup="checkNew($event,status.newListName)">