From eb532ff3186faf58523dd509c6d208bdd9195e53 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 27 Mar 2013 20:44:20 +0100 Subject: adding dudes --- js/public/app.js | 113 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 85 insertions(+), 28 deletions(-) (limited to 'js/public/app.js') diff --git a/js/public/app.js b/js/public/app.js index 8105c27dd..74e80c2c8 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -68,7 +68,7 @@ License along with this library. If not, see . /* -ownCloud - News +ownCloud - news @author Bernhard Posselt @copyright 2012 Bernhard Posselt nukeawhale@gmail.com @@ -88,34 +88,93 @@ License along with this library. If not, see . */ +(function() { + + angular.module('News').directive('clickFocus', function() { + return function(scope, elm, attr) { + var options; + options = scope.$eval(attr.clickFocus); + if (angular.isDefined(options) && angular.isDefined(options.selector)) { + return elm.click(function() { + return $(options.selector).focus(); + }); + } + }; + }); + +}).call(this); + +// Generated by CoffeeScript 1.4.0 + /* -Turns a normal select into a folder select with the ability to create new -folders + +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 . */ (function() { - angular.module('News').directive('addFolderSelect', [ - '$rootScope', 'FolderModel', function($rootScope, FolderModel) { - return function(scope, elm, attr) { - var options; - options = { - singleSelect: true, - selectedFirst: true, - createText: $(elm).data('create'), - createCallback: function(selected, value) { - if (FolderModel.nameExists(value)) { - return false; - } else { - return $rootScope.$broadcast('createFolder', value); - } - } - }; - return $(elm).multiSelect(options); - }; - } - ]); + angular.module('News').directive('clickFocus', function() { + return function(scope, elm, attr) { + var options; + options = scope.$eval(attr.clickFocus); + if (angular.isDefined(options) && angular.isDefined(options.selector)) { + return elm.click(function() { + return $(options.selector).focus(); + }); + } + }; + }); + +}).call(this); + +// Generated by CoffeeScript 1.4.0 + +/* + +ownCloud - App Framework + +@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 . +*/ + + +(function() { + + angular.module('OC').directive('focusFirstInput', function() { + return function(scope, elm, attr) { + return elm.find('input:first').focus(); + }; + }); }).call(this); @@ -280,10 +339,10 @@ License along with this library. If not, see . this.$scope.addFolder = function(folderName) { _this.$scope.folderEmptyError = false; _this.$scope.folderExistsError = false; - folderName = folderName.trim(); - if (angular.isUndefined(folderName) || folderName === '') { + if (angular.isUndefined(folderName) || folderName.trim() === '') { _this.$scope.folderEmptyError = true; } else { + folderName = folderName.trim(); if (_this._folderModel.nameExists(folderName)) { _this.$scope.folderExistsError = true; } @@ -292,13 +351,11 @@ License along with this library. If not, see . _this._isAddingFolder = true; return _this._persistence.createFolder(folderName, 0, function() { _this.$scope.folderName = ''; + _this.$scope.addNewFolder = false; return _this._isAddingFolder = false; }); } }; - this.$scope.$on('createFolder', function(scope, folderName) { - return $scope.addFolder(folderName); - }); } FeedController.prototype.toggleFolder = function(folderId) { -- cgit v1.2.3