diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-23 15:28:35 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-23 15:28:35 +0100 |
commit | 503817875b5ffa26a96fa478dc81de5032d82271 (patch) | |
tree | 6bbde3bad0b57c633db458277e7be7a6b19c7bb3 /coffee | |
parent | 8f637cfb85f551f6e6e73ec3ff7ea1190a0f30d4 (diff) |
removed old files from the previous news version
Diffstat (limited to 'coffee')
41 files changed, 0 insertions, 2324 deletions
diff --git a/coffee/Gruntfile.coffee b/coffee/Gruntfile.coffee deleted file mode 100644 index 51e03d5f5..000000000 --- a/coffee/Gruntfile.coffee +++ /dev/null @@ -1,102 +0,0 @@ -### -# ownCloud news app -# -# @author Alessandro Cosentino -# @author Bernhard Posselt -# Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### - -module.exports = (grunt) -> - - grunt.loadNpmTasks('grunt-contrib-coffee') - grunt.loadNpmTasks('grunt-contrib-concat') - grunt.loadNpmTasks('grunt-contrib-watch') - grunt.loadNpmTasks('grunt-coffeelint') - grunt.loadNpmTasks('gruntacular'); - - grunt.initConfig - - meta: - pkg: grunt.file.readJSON('package.json') - version: '<%= meta.pkg.version %>' - banner: '/**\n' + - ' * <%= meta.pkg.description %> - v<%= meta.version %>\n' + - ' *\n' + - '<% _.forEach(meta.pkg.contributors, function(contributor){ %>' + - ' * Copyright (c) <%= grunt.template.today("yyyy") %> - ' + - '<%= contributor.name %> <<%= contributor.email %>>\n' + - '<% }) %>' + - ' *\n' + - ' * This file is licensed under the Affero General Public License version 3 or later.\n' + - ' * See the COPYING-README file\n' + - ' *\n' + - ' */' - prefix: '(function(angular, $, OC, oc_requesttoken){' - suffix: '})(window.angular, jQuery, OC, oc_requesttoken);' - build: 'build/' - production: '../js/' - - concat: - app: - options: - banner: '<%= meta.banner %>\n' - src: '<%= meta.build %>main.js' - dest: '<%= meta.production %>app.js' - owncloud: - src: ['lib/owncloud.coffee', 'lib/services/*.coffee'] - dest: '<%= meta.build %>owncloud.coffee' - news: - src: [ - 'app.coffee' - 'services/*.coffee' - 'controllers/*.coffee' - 'directives/*.coffee' - 'filters/*.coffee' - ] - dest: '<%= meta.build %>news.coffee' - - coffee: - compile: - files: - '<%= meta.build %>main.js': [ - '<%= meta.build %>owncloud.coffee' - '<%= meta.build %>news.coffee' - ] - coffeelint: - app: [ - 'app.coffee' - 'services/*.coffee' - 'controllers/*.coffee' - 'directives/*.coffee' - 'filters/*.coffee' - 'lib/**/*.coffee' - ] - coffeelintOptions: - 'no_tabs': - 'level': 'ignore' - 'indentation': - 'level': 'ignore' - - watch: - app: - files: './**/*.coffee', - tasks: 'compile' - - - grunt.registerTask('run', ['watch']) - grunt.registerTask('lint', ['coffeelint']) - grunt.registerTask('compile', [ - #'coffeelint' - 'concat:owncloud' - 'concat:news' - 'coffee' - 'concat:app' - ] - ) diff --git a/coffee/Makefile b/coffee/Makefile deleted file mode 100644 index 68ea18599..000000000 --- a/coffee/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -all: watch - - -deps: - cd $(CURDIR) - npm install --save-dev - -watch: compile - $(CURDIR)/node_modules/.bin/grunt --config $(CURDIR)/Gruntfile.coffee run - -compile: - mkdir -p $(CURDIR)/build - $(CURDIR)/node_modules/.bin/grunt --config $(CURDIR)/Gruntfile.coffee compile - -clean: - rm -rf $(CURDIR)/build diff --git a/coffee/app.coffee b/coffee/app.coffee deleted file mode 100644 index 174893515..000000000 --- a/coffee/app.coffee +++ /dev/null @@ -1,42 +0,0 @@ -### -# ownCloud news app -# -# @author Alessandro Cosentino -# @author Bernhard Posselt -# Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### - -app = angular.module('News', ['ui']).config ($provide) -> - # enter your config values in here - config = - MarkReadTimeout: 500 - ScrollTimeout: 500 - initialLoadedItemsNr: 20 - FeedUpdateInterval: 6000000 - - $provide.value('Config', config) - - -app.run ['PersistenceNews', (PersistenceNews) -> - PersistenceNews.loadInitial() -] - - -$(document).ready -> - # this is used to forces browser to reload content after refreshing - # and thus clearing the scroll cache - $(this).keyup (e) -> - if (e.which == 116) || (e.which == 82 && e.ctrlKey) - document.location.reload(true) - return false - - # click on upload button should trigger the file input - $('#browselink').click -> - $('#file_upload_start').trigger('click') diff --git a/coffee/controllers/controller.coffee b/coffee/controllers/controller.coffee deleted file mode 100644 index 27ea614a2..000000000 --- a/coffee/controllers/controller.coffee +++ /dev/null @@ -1,18 +0,0 @@ -### -# ownCloud news app -# -# @author Alessandro Cosentino -# @author Bernhard Posselt -# Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### - -angular.module('News').factory 'Controller', -> - class Controller - constructor: () -> diff --git a/coffee/controllers/controllers.coffee b/coffee/controllers/controllers.coffee deleted file mode 100644 index 1474a7b39..000000000 --- a/coffee/controllers/controllers.coffee +++ /dev/null @@ -1,43 +0,0 @@ -### -# ownCloud news app -# -# @author Alessandro Cosentino -# @author Bernhard Posselt -# Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### - -angular.module('News').controller 'SettingsController', -['_SettingsController', '$scope', '$rootScope', 'PersistenceNews', 'OPMLParser', 'FeedModel', -(_SettingsController, $scope, $rootScope, PersistenceNews, OPMLParser, FeedModel) -> - return new _SettingsController($scope, $rootScope, PersistenceNews, - OPMLParser, FeedModel) -] - -angular.module('News').controller 'ItemController', -['_ItemController', '$scope', 'ItemModel', 'ActiveFeed', 'PersistenceNews', 'FeedModel', -'StarredCount', 'GarbageRegistry', 'ShowAll', 'Loading', '$rootScope', 'FeedType', -(_ItemController, $scope, ItemModel, ActiveFeed, PersistenceNews, FeedModel, -StarredCount, GarbageRegistry, ShowAll, Loading, $rootScope, FeedType) -> - return new _ItemController($scope, ItemModel, ActiveFeed, PersistenceNews - FeedModel, StarredCount, GarbageRegistry, - ShowAll, Loading, $rootScope, FeedType) -] - -angular.module('News').controller 'FeedController', -['_FeedController', '$scope', 'FeedModel', 'FeedType', 'FolderModel', 'ActiveFeed', 'PersistenceNews', -'StarredCount', 'ShowAll', 'ItemModel', 'GarbageRegistry', '$rootScope', 'Loading', -'Config', -(_FeedController, $scope, FeedModel, FeedType, FolderModel, ActiveFeed, PersistenceNews -StarredCount, ShowAll, ItemModel, GarbageRegistry, $rootScope, Loading, Config) -> - return new _FeedController($scope, FeedModel, FolderModel, FeedType, - ActiveFeed, PersistenceNews, StarredCount, ShowAll, - ItemModel, GarbageRegistry, $rootScope, Loading, - Config) -]
\ No newline at end of file diff --git a/coffee/controllers/feedcontroller.coffee b/coffee/controllers/feedcontroller.coffee deleted file mode 100644 index d2bb85a84..000000000 --- a/coffee/controllers/feedcontroller.coffee +++ /dev/null @@ -1,281 +0,0 @@ -### -# ownCloud news app -# -# @author Alessandro Cosentino -# @author Bernhard Posselt -# Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### -angular.module('News').factory '_FeedController', ['Controller', (Controller) -> - - class FeedController extends Controller - - constructor: (@$scope, @feedModel, @folderModel, @feedType, @activeFeed, - @persistence, @starredCount, @showAll, @itemModel, - @garbageRegistry, @$rootScope, @loading, @config) -> - - @showSubscriptions = true - - @$scope.feeds = @feedModel.getItems() - @$scope.folders = @folderModel.getItems() - @$scope.feedType = @feedType - - @$scope.getShowAll = => - return @showAll.showAll - - @$scope.setShowAll = (value) => - @showAll.showAll = value - @persistence.showAll(value) - @$rootScope.$broadcast('triggerHideRead') - - @$scope.addFeed = (url, folder) => - @$scope.feedEmptyError = false - @$scope.feedExistsError = false - @$scope.feedError = false - - if url == undefined or url.trim() == '' - @$scope.feedEmptyError = true - else - url = url.trim() - for feed in @feedModel.getItems() - if url == feed.url # FIXME: can we really compare this - @$scope.feedExistsError = true - - if not (@$scope.feedEmptyError or @$scope.feedExistsError) - if folder == undefined - folderId = 0 - else - folderId = folder.id - @$scope.adding = true - onSuccess = => - @$scope.feedUrl = '' - @$scope.adding = false - onError = => - @$scope.feedError = true - @$scope.adding = false - @persistence.createFeed(url, folderId, onSuccess, onError) - - - @$scope.addFolder = (name) => - @$scope.folderEmptyError = false - @$scope.folderExistsError = false - - if name == undefined or name.trim() == '' - @$scope.folderEmptyError = true - else - name = name.trim() - for folder in @folderModel.getItems() - if name.toLowerCase() == folder.name.toLowerCase() - @$scope.folderExistsError = true - - if not (@$scope.folderEmptyError or @$scope.folderExistsError) - @addingFolder = true - onSuccess = => - @$scope.folderName = '' - @addingFolder = false - @persistence.createFolder(name, onSuccess) - - @$scope.toggleFolder = (folderId) => - folder = @folderModel.getItemById(folderId) - folder.open = !folder.open - @persistence.collapseFolder(folder.id, folder.open) - - - @$scope.isFeedActive = (type, id) => - if type == @activeFeed.type && id == @activeFeed.id - return true - else - return false - - - @$scope.loadFeed = (type, id) => - @loadFeed(type, id) - - - @$scope.getUnreadCount = (type, id) => - count = @getUnreadCount(type, id) - if count > 999 - return "999+" - else - return count - - - @$scope.renameFolder = -> - alert 'not implemented yet, needs better solution' - - - @$scope.triggerHideRead = => - @triggerHideRead() - - - @$scope.isShown = (type, id) => - switch type - when @feedType.Subscriptions then return @showSubscriptions - when @feedType.Starred then return @starredCount.count > 0 - - - @$scope.delete = (type, id) => - switch type - when @feedType.Folder - @folderModel.removeById(id) - @persistence.deleteFolder(id) - - when @feedType.Feed - @feedModel.removeById(id) - @persistence.deleteFeed(id) - - - @$scope.markAllRead = (type, id) => - switch type - when @feedType.Feed - for itemId, item of @itemModel.getItemsByTypeAndId(type, id) - item.isRead = true - feed = @feedModel.getItemById(id) - feed.unreadCount = 0 - mostRecentItemId = @itemModel.getHighestId(type, id) - @persistence.setAllItemsRead(feed.id, mostRecentItemId) - - when @feedType.Folder - for itemId, item of @itemModel.getItemsByTypeAndId(type, id) - item.isRead = true - for feedId in @itemModel.getFeedsOfFolderId(id) - feed = @feedModel.getItemById(feedId) - feed.unreadCount = 0 - mostRecentItemId = @itemModel.getHighestId(type, feedId) - @persistence.setAllItemsRead(feedId, mostRecentItemId) - - when @feedType.Subscriptions - for itemId, item of @itemModel.getItemsByTypeAndId(type, id) - item.isRead = true - for feed in @feedModel.getItems() - feed.unreadCount = 0 - mostRecentItemId = @itemModel.getHighestId(type, feed.id) - @persistence.setAllItemsRead(feed.id, mostRecentItemId) - - @$scope.$on 'triggerHideRead', => - @itemModel.clearCache() - @triggerHideRead() - @loadFeed(activeFeed.type, activeFeed.id) - - @$scope.$on 'loadFeed', (scope, params) => - @loadFeed(params.type, params.id) - - @$scope.$on 'moveFeedToFolder', (scope, params) => - @moveFeedToFolder(params.feedId, params.folderId) - - setInterval => - @updateFeeds() - , @config.FeedUpdateInterval - - - - updateFeeds: -> - for feed in @feedModel.getItems() - @persistence.updateFeed(feed.id) - - - moveFeedToFolder: (feedId, folderId) -> - feed = @feedModel.getItemById(feedId) - if feed.folderId != folderId - feed.folderId = folderId - @feedModel.markAccessed() - @persistence.moveFeedToFolder(feedId, folderId) - - - loadFeed: (type, id) -> - # to not go crazy with autopaging, clear the caches if we switch the - # type of the feed. if the caches only contain seperate feeds, the - # cache and autopage logic works fine. if the feed contains more than - # one - if type != @activeFeed.type or id != @activeFeed.id - if not (type == @feedType.Feed && @activeFeed.type == @feedType.Feed) - @itemModel.clearCache() - - @activeFeed.id = id - @activeFeed.type = type - @$scope.triggerHideRead() - @persistence.loadFeed(type, id, - @itemModel.getHighestId(type, id), - @itemModel.getHighestTimestamp(type, id), @config.initialLoadedItemsNr) - - - triggerHideRead: () -> - preventParentFolder = 0 - - # feeds - for feed in @feedModel.getItems() - if @showAll.showAll == false && @getUnreadCount(@feedType.Feed, feed.id) == 0 - - # we dont hide the selected feed and folder. But we also dont hide - # the parent folder of the selcted feed - if @activeFeed.type == @feedType.Feed && @activeFeed.id == feed.id - feed.show = true - preventParentFolder = feed.folderId - else - feed.show = false - else - feed.show = true - - # folders - for folder in @folderModel.getItems() - if @showAll.showAll == false && @getUnreadCount(@feedType.Folder, folder.id) == 0 - # prevent hiding when childfeed is active - if (@activeFeed.type == @feedType.Folder && @activeFeed.id == folder.id) || preventParentFolder == folder.id - folder.show = true - else - folder.show = false - else - folder.show = true - - # subscriptions - if @showAll.showAll == false && @getUnreadCount(@feedType.Subscriptions, 0) == 0 - if @activeFeed.type == @feedType.Subscriptions - @showSubscriptions = true - else - @showSubscriptions = false - else - @showSubscriptions = true - - # starred - if @showAll.showAll == false && @getUnreadCount(@feedType.Starred, 0) == 0 - if @activeFeed.type == @feedType.Starred - @showStarred = true - else - @showStarred = false - else - @showStarred = true - - @garbageRegistry.clear() - - - - getUnreadCount: (type, id) -> - switch type - when @feedType.Feed - return @feedModel.getItemById(id).unreadCount - - when @feedType.Folder - counter = 0 - for feed in @feedModel.getItems() - if feed.folderId == id - counter += feed.unreadCount - return counter - - when @feedType.Starred - return @starredCount.count - - when @feedType.Subscriptions - counter = 0 - for feed in @feedModel.getItems() - counter += feed.unreadCount - return counter - - - return FeedController -]
\ No newline at end of file diff --git a/coffee/controllers/itemcontroller.coffee b/coffee/controllers/itemcontroller.coffee deleted file mode 100644 index 0a8b182f5..000000000 --- a/coffee/controllers/itemcontroller.coffee +++ /dev/null @@ -1,97 +0,0 @@ -### -# ownCloud news app -# -# @author Alessandro Cosentino -# @author Bernhard Posselt -# Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -### - -angular.module('News').factory '_ItemController', ['Controller', (Controller) -> - - class ItemController extends Controller - - constructor: (@$scope, @itemModel, @activeFeed, @persistence, @feedModel, - @starredCount, @garbageRegistry, @showAll, @loading - @$rootScope, @feedType) -> - - @batchSize = 4 - @loaderQueue = 0 - - @$scope.getItems = (type, id) => - return @itemModel.getItemsByTypeAndId(type, id) - - @$scope.items = @itemModel.getItems() - @$scope.loading = @loading - - - @$scope.scroll = => - - @$scope.activeFeed = @activeFeed - - @$scope.$on 'read', (scope, params) => - @$scope.markRead(params.id, params.feed) - - - @$scope.loadFeed = (feedId) => - params = - id: feedId - type: @feedType.Feed - @$rootScope.$broadcast 'loadFeed', params - - - @$scope.markRead = (itemId, feedId) => - item = @itemModel.getItemById(itemId) - feed = @feedModel.getItemById(feedId) - - if not item.keptUnread && !item.isRead - item.isRead = true - feed.unreadCount -= 1 - - # this item will be completely deleted if showAll is false - if not @showAll.showAll - @garbageRegistry.register(item) - - @persistence.markRead(itemId, true) - - - @$scope.keepUnread = (itemId, feedId) => - item = @itemModel.getItemById(itemId) - feed = @feedModel.getItemById(feedId) - - - item.keptUnread = !item.keptUnread - - if item.isRead - item.isRead = false - feed.unreadCount += 1 - - @persistence.markRead(itemId, false) - - - @$scope.isKeptUnread = (itemId) => - return @itemModel.getItemById(itemId).keptUnread - - - @$scope.toggleImportant = (itemId) => - item = @itemModel.getItemById(itemId) - - # cache - @itemModel.setImportant(itemId, !item.isImportant) - - if item.isImportant - @starredCount.count += 1 - else - @starredCount.count -= 1 - - @persistence.setImportant(itemId, item.isImportant) - - - return ItemController -]
\ No newline at end of file diff --git a/coffee/controllers/settingscontroller.coffee b/coffee/controllers/settingscontroller.coffee deleted file mode 100644 index 4da81c316..000000000 --- a/coffee/controllers/settingscontroller.coffee +++ /dev/null @@ -1,60 +0,0 @@ -### -# ownCloud news app -# -# @author Alessandro Cosentino -# @author Bernhard Posselt -# Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero |