diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 20:44:20 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 20:44:20 +0100 |
commit | eb532ff3186faf58523dd509c6d208bdd9195e53 (patch) | |
tree | 942dae047e30d3e973494d1a2e38d3a0e8066ddd /js/public | |
parent | bf93d491cefd19fe8ab339725d4c7ce627b6308b (diff) |
adding dudes
Diffstat (limited to 'js/public')
-rw-r--r-- | js/public/app.js | 113 |
1 files changed, 85 insertions, 28 deletions
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 <http://www.gnu.org/licenses/>. /* -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 <http://www.gnu.org/licenses/>. */ +(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 <http://www.gnu.org/licenses/>. */ (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 <http://www.gnu.org/licenses/>. +*/ + + +(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 <http://www.gnu.org/licenses/>. 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 <http://www.gnu.org/licenses/>. _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) { |