diff options
author | Raimund Schlüßler <raimund.schluessler@googlemail.com> | 2016-08-11 15:26:19 +0300 |
---|---|---|
committer | Raimund Schlüßler <raimund.schluessler@googlemail.com> | 2016-08-11 15:26:19 +0300 |
commit | 3f2ae64639cfa44171f4576ab1a1a9b962e3278f (patch) | |
tree | 8c3ae98dccff0e32aa55beb7524fb08f6bc5dc60 /js | |
parent | 6edab40e09ce2d80a92bb075a97ba020e592bbe9 (diff) |
Add CalDAV-Link and export function
Diffstat (limited to 'js')
-rw-r--r-- | js/app/controllers/listcontroller.js | 23 | ||||
-rw-r--r-- | js/app/services/models/calendar.js | 14 | ||||
-rw-r--r-- | js/public/app.js | 37 |
3 files changed, 72 insertions, 2 deletions
diff --git a/js/app/controllers/listcontroller.js b/js/app/controllers/listcontroller.js index 57c30961..e8501535 100644 --- a/js/app/controllers/listcontroller.js +++ b/js/app/controllers/listcontroller.js @@ -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); }; diff --git a/js/app/services/models/calendar.js b/js/app/services/models/calendar.js index 2d1c92a5..14dfb17a 100644 --- a/js/app/services/models/calendar.js +++ b/js/app/services/models/calendar.js @@ -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; }, diff --git a/js/public/app.js b/js/public/app.js index 2f8221ec..03bb6209 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -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; }, |