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 | |
parent | bf93d491cefd19fe8ab339725d4c7ce627b6308b (diff) |
adding dudes
-rw-r--r-- | css/addnew.css | 39 | ||||
-rw-r--r-- | css/feeds.css | 4 | ||||
-rw-r--r-- | css/owncloud.css | 8 | ||||
-rw-r--r-- | css/settings.css | 4 | ||||
-rw-r--r-- | js/app/controllers/feedcontroller.coffee | 10 | ||||
-rw-r--r-- | js/app/directives/clickfocus.coffee (renamed from js/app/directives/addfolderselect.coffee) | 26 | ||||
-rw-r--r-- | js/app/directives/focus.coffee | 32 | ||||
-rw-r--r-- | js/app/services/models/feedmodel.coffee | 1 | ||||
-rw-r--r-- | js/public/app.js | 113 | ||||
-rw-r--r-- | js/tests/controllers/feedcontrollerSpec.coffee | 1 | ||||
-rw-r--r-- | templates/main.php | 5 | ||||
-rw-r--r-- | templates/part.addnew.php | 57 |
12 files changed, 216 insertions, 84 deletions
diff --git a/css/addnew.css b/css/addnew.css index 17ea8f17f..52759e755 100644 --- a/css/addnew.css +++ b/css/addnew.css @@ -2,15 +2,44 @@ background-image: url('%appswebroot%/news/img/add.svg'); } +.add-new:hover a.opened { + background-color: transparent !important; +} + .add-new-popup { display: none; - padding: 0 15px; + padding: 15px 10px; } -.add-new-popup .personalblock:first-child legend { - padding-top: 15px; +.add-new input[type=text] { + width: 120px; } -.add-new input[type=text] { - width: 100px; +.add-new select { + width: 134px; + margin-top: 1px !important; +} + +.add-new input { + height: 16px !important; +} + +.add-new input, +.add-new select { + margin: 0 0 5px 0; + display: inline-block; + float: left; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-right: 0; +} + +.add-new button { + margin: 0 0 5px 0; + display: inline-block; + float: left; + border-bottom-left-radius: 0; + border-top-left-radius: 0; + height: 30px !important; + margin-top: 1px; }
\ No newline at end of file diff --git a/css/feeds.css b/css/feeds.css index 53de5cb28..22a290318 100644 --- a/css/feeds.css +++ b/css/feeds.css @@ -99,4 +99,6 @@ button.action:hover { #app-navigation .multiselect { height:20px; -}
\ No newline at end of file +} + + diff --git a/css/owncloud.css b/css/owncloud.css index e6aa01f61..743ba1369 100644 --- a/css/owncloud.css +++ b/css/owncloud.css @@ -15,7 +15,7 @@ -moz-box-sizing: border-box; box-sizing: border-box; text-shadow: 0 1px 0 rgba(255, 255, 255, .9); } -#app-navigation li.active { background-color: #ccc; text-shadow: 0 1px 0 rgba(255,255,255,.7); } +#app-navigation li.active { background-color: #ddd; text-shadow: 0 1px 0 rgba(255,255,255,.7); } #app-navigation > ul > li { border-bottom: 1px solid #ddd; @@ -35,7 +35,7 @@ -moz-box-sizing: border-box; box-sizing: border-box; white-space: nowrap; text-overflow: ellipsis; color: #333; } -#app-navigation li:hover > a { background-color: #ccc; } +#app-navigation li:hover > a { background-color: #ddd; } #app-navigation > ul > li:hover { border-top: 1px solid #ccc; border-bottom: 1px solid #ccc;} #app-navigation button.collapse { display: none; } @@ -80,8 +80,8 @@ } #app-navigation > ul li.open:hover { - -webkit-box-shadow: inset 0 0 3px #cccccc; - box-shadow: inset 0 0 3px #cccccc; + -webkit-box-shadow: inset 0 0 3px #ddd; + box-shadow: inset 0 0 3px #ddd; border-top: 1px solid #ccc; } diff --git a/css/settings.css b/css/settings.css index 11573d04a..acf4d0498 100644 --- a/css/settings.css +++ b/css/settings.css @@ -4,3 +4,7 @@ width:0; height:0; } + +#app-settings .opened:hover { + background-color: transparent !important; +} diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee index 33d23d935..82586378f 100644 --- a/js/app/controllers/feedcontroller.coffee +++ b/js/app/controllers/feedcontroller.coffee @@ -99,15 +99,16 @@ angular.module('News').factory '_FeedController', -> @_persistence.createFeed(feedUrl.trim(), parentFolderId, onSuccess, onError) + @$scope.addFolder = (folderName) => @$scope.folderEmptyError = false @$scope.folderExistsError = false - folderName = folderName.trim() - if angular.isUndefined(folderName) or folderName == '' + if angular.isUndefined(folderName) or folderName.trim() == '' @$scope.folderEmptyError = true else + folderName = folderName.trim() if @_folderModel.nameExists(folderName) @$scope.folderExistsError = true @@ -115,13 +116,10 @@ angular.module('News').factory '_FeedController', -> @_isAddingFolder = true @_persistence.createFolder folderName, 0, => @$scope.folderName = '' + @$scope.addNewFolder = false @_isAddingFolder = false - @$scope.$on 'createFolder', (scope, folderName) => - $scope.addFolder(folderName) - - toggleFolder: (folderId) -> folder = @_folderModel.getById(folderId) diff --git a/js/app/directives/addfolderselect.coffee b/js/app/directives/clickfocus.coffee index 41a111823..725ca46c4 100644 --- a/js/app/directives/addfolderselect.coffee +++ b/js/app/directives/clickfocus.coffee @@ -1,6 +1,6 @@ ### -ownCloud - News +ownCloud - news @author Bernhard Posselt @copyright 2012 Bernhard Posselt nukeawhale@gmail.com @@ -21,26 +21,12 @@ 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 -### -angular.module('News').directive 'addFolderSelect', -['$rootScope', 'FolderModel', ($rootScope, FolderModel) -> +angular.module('News').directive 'clickFocus', -> return (scope, elm, attr) -> + options = scope.$eval(attr.clickFocus) - options = - singleSelect: true - selectedFirst: true - createText: $(elm).data('create') - createCallback: (selected, value) -> - if FolderModel.nameExists(value) - return false - else - $rootScope.$broadcast 'createFolder', value - - - $(elm).multiSelect(options) + if angular.isDefined(options) and angular.isDefined(options.selector) + elm.click -> + $(options.selector).focus() -]
\ No newline at end of file diff --git a/js/app/directives/focus.coffee b/js/app/directives/focus.coffee new file mode 100644 index 000000000..725ca46c4 --- /dev/null +++ b/js/app/directives/focus.coffee @@ -0,0 +1,32 @@ +### + +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/>. + +### + + +angular.module('News').directive 'clickFocus', -> + + return (scope, elm, attr) -> + options = scope.$eval(attr.clickFocus) + + if angular.isDefined(options) and angular.isDefined(options.selector) + elm.click -> + $(options.selector).focus() + diff --git a/js/app/services/models/feedmodel.coffee b/js/app/services/models/feedmodel.coffee index 96f187e75..bd10ccb8b 100644 --- a/js/app/services/models/feedmodel.coffee +++ b/js/app/services/models/feedmodel.coffee @@ -67,7 +67,6 @@ angular.module('News').factory '_FeedModel', entry[key] = value - removeById: (id) -> item = @getById(id) delete @_urlHash[item.urlHash] 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) { diff --git a/js/tests/controllers/feedcontrollerSpec.coffee b/js/tests/controllers/feedcontrollerSpec.coffee index a37430d26..af3f40d00 100644 --- a/js/tests/controllers/feedcontrollerSpec.coffee +++ b/js/tests/controllers/feedcontrollerSpec.coffee @@ -333,6 +333,7 @@ describe '_FeedController', -> expect(@scope.folderName).toBe('') expect(@scope.isAddingFolder()).toBeFalsy() + expect(@scope.addNewFolder).toBeFalsy() it 'should not add feeds that have no url', => diff --git a/templates/main.php b/templates/main.php index 6bb71c9ae..e1ab78539 100644 --- a/templates/main.php +++ b/templates/main.php @@ -1,7 +1,5 @@ <?php -\OCP\Util::addScript('core', 'multiselect'); - \OCP\Util::addScript('appframework', 'vendor/angular/angular'); \OCP\Util::addScript('appframework', 'public/app'); @@ -37,7 +35,8 @@ class="settings-button" oc-click-slide-toggle="{ selector: '#app-settings-content', - hideOnFocusLost: true + hideOnFocusLost: true, + cssClass: 'opened' }"></button> </div> <div id="app-settings-content"> diff --git a/templates/part.addnew.php b/templates/part.addnew.php index e78c5f97f..0a167d157 100644 --- a/templates/part.addnew.php +++ b/templates/part.addnew.php @@ -1,15 +1,19 @@ <li class="add-new"> <a class="list-title list-title-with-icon" - oc-click-slide-toggle="{ - selector: '.add-new-popup', - hideOnFocusLost: true - }" href="#"> - <?php p($l->t('New'))?> + oc-click-slide-toggle="{ + selector: '.add-new-popup', + hideOnFocusLost: true, + cssClass: 'opened' + }" + href="#" + click-focus="{ + selector: '.add-new-popup input[ng-model=feedUrl]' + }"> + <?php p($l->t('Add Website'))?> </a> - <div class="add-new-popup"> + <div class="add-new-popup" > <fieldset class="personalblock"> - <legend><strong><?php p($l->t('Add Subscription')); ?></strong></legend> <p class="error"> <span ng-show="feedEmptyError"><?php p($l->t('Address must not be empty!')); ?></span> <span ng-show="feedError"> @@ -18,25 +22,46 @@ <span ng-show="folderExistsError"><?php p($l->t('Folder exists already')); ?></span> </p> <form> + <input type="text" ng-model="feedUrl" placeholder="<?php p($l->t('Address')); ?>" - ng-disabled="isAddingFeed() || isAddingFolder()"> + ng-disabled="isAddingFeed() || isAddingFolder()" + name="adress" + autofocus> <button title="<?php p($l->t('Add')); ?>" + class="primary" ng-class="{loading: isAddingFeed()}" - ng-disabled="adding" - ng-click="addFeed(feedUrl, folderId)"><?php p($l->t('Add')); ?></button> + ng-disabled="isAddingFeed() || isAddingFolder()" + ng-click="addFeed(feedUrl, folderId.id)"><?php p($l->t('Add')); ?></button> + <select name="folder" data-create="<?php p($l->t('New folder')); ?>" - title="<?php p($l->t('Folder')); ?> -" ng-model="folderId" + title="<?php p($l->t('Folder')); ?>" + ng-model="folderId" ng-disabled="isAddingFolder()" ng-options="folder.name for folder in folders" - add-folder-select - multiple="multiple"> - <option value="" selected="selected">- <?php p($l->t('Top Level')); ?></option> - <option>create</option> + ng-hide="addNewFolder"> + <option value="" selected="selected"><?php p($l->t('Choose folder')); ?></option> </select> + <button title="<?php p($l->t('Add')); ?>" + ng-click="addNewFolder=true" + ng-hide="addNewFolder"><?php p($l->t('New')); ?></button> + <input type="text" + ng-model="folderName" + ng-disabled="isAddingFolder()" + ng-show="addNewFolder" + name="foldername" + placeholder="<?php p($l->t('Folder name')); ?>" + autofocus + ui-keyup="{13: 'addFolder(folderName)'}"/> + <button title="<?php p($l->t('Add')); ?>" + ng-show="addNewFolder" + ng-click="addFolder(folderName)" + ng-disabled="isAddingFolder()" + ng-class="{loading: isAddingFolder()}"> + <?php p($l->t('Create')); ?> + </button> </form> </fieldset> </div> |