diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-26 18:04:02 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-26 18:04:02 +0100 |
commit | c8d3f8fb4681f6993f1c9389e507df0724f56579 (patch) | |
tree | 312b48cdbc17c23d1e7aac6513f40e0a5813fdbf /js/public/app.js | |
parent | 8e1e0f5281c1ee49fe7f6d84ba8f2b709ebf7f40 (diff) |
added casting information for data objects
Diffstat (limited to 'js/public/app.js')
-rw-r--r-- | js/public/app.js | 100 |
1 files changed, 79 insertions, 21 deletions
diff --git a/js/public/app.js b/js/public/app.js index e720ed428..505eb558c 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -88,6 +88,58 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. */ +/* +Turns a normal select into a folder select with the ability to create new +folders +*/ + + +(function() { + + angular.module('News').directive('addFolderSelect', [ + '$rootScope', function() { + return function(scope, elm, attr) { + var options; + options = { + singleSelect: true, + selectedFirst: true, + createText: $(elm).data('create'), + createdCallback: function(selected, value) { + console.log(selected); + return console.log(value); + } + }; + return $(elm).multiSelect(options); + }; + } + ]); + +}).call(this); + +// Generated by CoffeeScript 1.4.0 + +/* + +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').controller('SettingsController', [ @@ -196,36 +248,30 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return _this.toggleFolder(folderId); }; this.$scope.addFeed = function(feedUrl, parentFolderId) { - var feed, onError, onSuccess, _i, _len, _ref; + var onError, onSuccess; if (parentFolderId == null) { parentFolderId = 0; } _this.$scope.feedEmptyError = false; - _this.$scope.feedExistsError = false; _this.$scope.feedError = false; if (angular.isUndefined(feedUrl) || feedUrl.trim() === '') { _this.$scope.feedEmptyError = true; - } else { - feedUrl = feedUrl.trim(); - _ref = _this._feedModel.getAll(); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - feed = _ref[_i]; - if (feedUrl === feed.url) { - _this.$scope.feedExistsError = true; - } - } } - if (!(_this.$scope.feedEmptyError || _this.$scope.feedExistsError)) { + if (!_this.$scope.feedEmptyError) { _this._isAddingFeed = true; - onSuccess = function() { - _this.$scope.feedUrl = ''; - return _this._isAddingFeed = false; - }; onError = function() { _this.$scope.feedError = true; return _this._isAddingFeed = false; }; - return _this._persistence.createFeed(feedUrl, parentFolderId, onSuccess, onError); + onSuccess = function(data) { + if (data.status === 'error') { + return onError(); + } else { + _this.$scope.feedUrl = ''; + return _this._isAddingFeed = false; + } + }; + return _this._persistence.createFeed(feedUrl.trim(), parentFolderId, onSuccess, onError); } }; this.$scope.addFolder = function(folderName) { @@ -272,11 +318,23 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; FeedController.prototype.isShown = function(type, id) { - if (this.isShowAll()) { + var hasUnread; + hasUnread = this.getUnreadCount(type, id) > 0; + if (hasUnread) { return true; } else { - return this.getUnreadCount(type, id) > 0; + if (this.isShowAll()) { + switch (type) { + case this._feedType.Subscriptions: + return this._feedModel.size() > 0; + case this._feedType.Folder: + return this._folderModel.size() > 0; + case this._feedType.Feed: + return this._feedModel.size() > 0; + } + } } + return false; }; FeedController.prototype.isShowAll = function() { @@ -616,8 +674,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. } FeedModel.prototype.add = function(item) { - if (item.icon === 'url()') { - item.icon = 'url(' + this._utils.imagePath('news', 'rss.svg') + ')'; + if (item.faviconLink === null) { + item.faviconLink = 'url(' + this._utils.imagePath('news', 'rss.svg') + ')'; } return FeedModel.__super__.add.call(this, item); }; |