calendar/js/app/controllers/subscriptioncontroller.js

64 lines
2.3 KiB
JavaScript

/**
* ownCloud - Calendar App
*
* @author Raghu Nayyar
* @author Georg Ehrke
* @copyright 2016 Raghu Nayyar <beingminimal@gmail.com>
* @copyright 2016 Georg Ehrke <oc.list@georgehrke.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Controller: SubscriptionController
* Description: Takes care of Subscription List in the App Navigation.
*/
app.controller('SubscriptionController', ['$scope', function($scope) {}]);
/*
app.controller('SubscriptionController', ['$scope', '$rootScope', '$window', 'SubscriptionModel', 'CalendarModel', 'Restangular',
function ($scope, $rootScope, $window, SubscriptionModel, CalendarModel, Restangular) {
'use strict';
$scope.subscriptions = SubscriptionModel.getAll();
var subscriptionResource = Restangular.all('subscriptions');
var backendResource = Restangular.all('backends');
backendResource.getList().then(function (backendObject) {
$scope.subscriptiontypeSelect = SubscriptionModel.getSubscriptionNames(backendObject);
$scope.selectedsubscriptionbackendmodel = $scope.subscriptiontypeSelect[0]; // to remove the empty model.
}, function (response) {
OC.Notification.show(t('calendar', response.data.message));
});
$scope.newSubscriptionUrl = '';
$scope.create = function () {
subscriptionResource.post({
type: $scope.selectedsubscriptionbackendmodel.type,
url: $scope.newSubscriptionUrl
}).then(function (newSubscription) {
SubscriptionModel.create(newSubscription);
$rootScope.$broadcast('createdSubscription', {
subscription: newSubscription
});
}, function (response) {
OC.Notification.show(t('calendar', response.data.message));
});
$scope.newSubscriptionUrl = '';
};
}
]);
*/