Skip to content

Commit

Permalink
Merge pull request #347 from owncloud/CalDAV-And-Export
Browse files Browse the repository at this point in the history
Add CalDAV-Link and export function
  • Loading branch information
raimund-schluessler authored Aug 11, 2016
2 parents 6edab40 + 3f2ae64 commit 72026da
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 15 deletions.
26 changes: 22 additions & 4 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
23 changes: 23 additions & 0 deletions js/app/controllers/listcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
14 changes: 13 additions & 1 deletion js/app/services/models/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
},
Expand Down
37 changes: 36 additions & 1 deletion js/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
},
Expand Down
41 changes: 32 additions & 9 deletions templates/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class="collection"
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)">
Expand All @@ -57,17 +58,33 @@ class="collection"
</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')); ?>">
Expand All @@ -77,13 +94,19 @@ class="collection"
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)">
Expand Down

0 comments on commit 72026da

Please sign in to comment.