summaryrefslogtreecommitdiffstats
path: root/js/public/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/public/app.js')
-rw-r--r--js/public/app.js100
1 files changed, 78 insertions, 22 deletions
diff --git a/js/public/app.js b/js/public/app.js
index f5fdf95ae..767c957e1 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -103,6 +103,59 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
+// Generated by CoffeeScript 1.6.2
+/*
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.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/>.
+*/
+
+
+(function() {
+ angular.module('News').directive('droppable', [
+ '$rootScope', function($rootScope) {
+ return function(scope, elm, attr) {
+ var $elem, details;
+
+ $elem = $(elm);
+ details = {
+ accept: '.feed',
+ hoverClass: 'drag-and-drop',
+ greedy: true,
+ drop: function(event, ui) {
+ var data;
+
+ $('.drag-and-drop').removeClass('drag-and-drop');
+ data = {
+ folderId: parseInt($elem.data('id'), 10),
+ feedId: parseInt($(ui.draggable).data('id'), 10)
+ };
+ $rootScope.$broadcast('moveFeedToFolder', data);
+ return scope.$apply(attr.droppable);
+ }
+ };
+ return $elem.droppable(details);
+ };
+ }
+ ]);
+
+}).call(this);
+
// Generated by CoffeeScript 1.4.0
/*
@@ -209,10 +262,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
var FeedController;
FeedController = (function() {
- function FeedController($scope, _persistence, _folderBl, _feedBl, _subscriptionsBl, _starredBl, _unreadCountFormatter) {
+ function FeedController(_$scope, _persistence, _folderBl, _feedBl, _subscriptionsBl, _starredBl, _unreadCountFormatter) {
var _this = this;
- this.$scope = $scope;
+ this._$scope = _$scope;
this._persistence = _persistence;
this._folderBl = _folderBl;
this._feedBl = _feedBl;
@@ -221,57 +274,57 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
this._unreadCountFormatter = _unreadCountFormatter;
this._isAddingFolder = false;
this._isAddingFeed = false;
- this.$scope.folderBl = this._folderBl;
- this.$scope.feedBl = this._feedBl;
- this.$scope.subscriptionsBl = this._subscriptionsBl;
- this.$scope.starredBl = this._starredBl;
- this.$scope.unreadCountFormatter = this._unreadCountFormatter;
- this.$scope.isAddingFolder = function() {
+ this._$scope.folderBl = this._folderBl;
+ this._$scope.feedBl = this._feedBl;
+ this._$scope.subscriptionsBl = this._subscriptionsBl;
+ this._$scope.starredBl = this._starredBl;
+ this._$scope.unreadCountFormatter = this._unreadCountFormatter;
+ this._$scope.isAddingFolder = function() {
return _this._isAddingFolder;
};
- this.$scope.isAddingFeed = function() {
+ this._$scope.isAddingFeed = function() {
return _this._isAddingFeed;
};
- this.$scope.addFeed = function(feedUrl, parentFolderId) {
+ this._$scope.addFeed = function(feedUrl, parentFolderId) {
var onError, onSuccess;
if (parentFolderId == null) {
parentFolderId = 0;
}
- _this.$scope.feedEmptyError = false;
- _this.$scope.feedError = false;
+ _this._$scope.feedEmptyError = false;
+ _this._$scope.feedError = false;
if (angular.isUndefined(feedUrl) || feedUrl.trim() === '') {
- _this.$scope.feedEmptyError = true;
+ _this._$scope.feedEmptyError = true;
}
- if (!_this.$scope.feedEmptyError) {
+ if (!_this._$scope.feedEmptyError) {
_this._isAddingFeed = true;
onError = function() {
- _this.$scope.feedError = true;
+ _this._$scope.feedError = true;
return _this._isAddingFeed = false;
};
onSuccess = function(data) {
if (data.status === 'error') {
return onError();
} else {
- _this.$scope.feedUrl = '';
+ _this._$scope.feedUrl = '';
return _this._isAddingFeed = false;
}
};
return _this._persistence.createFeed(feedUrl.trim(), parentFolderId, onSuccess, onError);
}
};
- this.$scope.addFolder = function(folderName) {
- _this.$scope.folderEmptyError = false;
- _this.$scope.folderExistsError = false;
+ this._$scope.addFolder = function(folderName) {
+ _this._$scope.folderEmptyError = false;
+ _this._$scope.folderExistsError = false;
if (angular.isUndefined(folderName) || folderName.trim() === '') {
- _this.$scope.folderEmptyError = true;
+ _this._$scope.folderEmptyError = true;
} else {
folderName = folderName.trim();
if (_this._folderModel.nameExists(folderName)) {
- _this.$scope.folderExistsError = true;
+ _this._$scope.folderExistsError = true;
}
}
- if (!(_this.$scope.folderEmptyError || _this.$scope.folderExistsError)) {
+ if (!(_this._$scope.folderEmptyError || _this._$scope.folderExistsError)) {
_this._isAddingFolder = true;
return _this._persistence.createFolder(folderName, 0, function() {
_this.$scope.folderName = '';
@@ -280,6 +333,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
});
}
};
+ this._$scope.$on('moveFeedToFolder', function(scope, data) {
+ return console.log(data);
+ });
}
return FeedController;