Fix popover closing on input focus

Signed-off-by: Marin Treselj <marin@pixelipo.com>
This commit is contained in:
Marin Treselj
2017-05-24 11:59:20 +02:00
parent ec6c8d94c1
commit 1143f0807c
2 changed files with 7 additions and 7 deletions

View File

@@ -4,20 +4,20 @@
* @author Julius Härtl <jus@bitgrid.net> * @author Julius Härtl <jus@bitgrid.net>
* *
* @license GNU AGPL version 3 or any later version * @license GNU AGPL version 3 or any later version
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
app.directive('appPopoverMenuUtils', function () { app.directive('appPopoverMenuUtils', function () {
@@ -37,7 +37,8 @@ app.directive('appPopoverMenuUtils', function () {
e.stopPropagation(); e.stopPropagation();
}); });
scope.$on('documentClicked', function (scope, event) { scope.$on('documentClicked', function (scope, event) {
if (event.target !== button) { /* prevent closing popover if target has no-close class */
if (event.target !== button && !$(event.target).hasClass('no-close')) {
menu.addClass('hidden'); menu.addClass('hidden');
} }
button.css('display',''); button.css('display','');
@@ -45,4 +46,3 @@ app.directive('appPopoverMenuUtils', function () {
} }
}; };
}); });

View File

@@ -43,7 +43,7 @@
<div id="popover-controls"> <div id="popover-controls">
<div id="stack-add" ng-if="boardservice.canEdit() && checkCanEdit()"> <div id="stack-add" ng-if="boardservice.canEdit() && checkCanEdit()">
<form class="ng-pristine ng-valid" ng-submit="createStack()"> <form class="ng-pristine ng-valid" ng-submit="createStack()">
<input type="text" placeholder="Add a new stack" <input type="text" class="no-close" placeholder="Add a new stack"
ng-focus="status.addStack=true" ng-focus="status.addStack=true"
ng-blur="status.addStack=false" ng-blur="status.addStack=false"
ng-model="newStack.title" required ng-model="newStack.title" required