fixes #181: press ESC to reset input field (list of tickets only)

This commit is contained in:
Davide Alberani 2017-05-03 20:17:33 +02:00
parent 1047dc47b4
commit c3f93609c1
5 changed files with 24 additions and 2 deletions

View file

@ -28,7 +28,7 @@
<form class="form-inline">
<div class="form-group">
<label for="query-tickets">{{'Search:' | translate}}</label>
<input eventman-focus type="text" id="query-tickets" class="form-control" placeholder="{{'Name or email' | translate}}" ng-model="query" ng-model-options="{debounce: 350}">
<input eventman-focus type="text" id="query-tickets" class="form-control query-input" placeholder="{{'Name or email or key:value' | translate}}" ng-model="query" ng-model-options="{debounce: 350}" esc-key="resetInput()">
</div>&nbsp;<label>&nbsp;<input type="checkbox" ng-model="registeredFilterOptions.all" /> {{'Show cancelled tickets' | translate}}</label>
</form>
</div>

View file

@ -705,6 +705,10 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event',
} catch(err) {}
};
$scope.resetInput = function() {
$scope.query = "";
};
$scope.$on('$destroy', function() {
$scope.EventUpdates && $scope.EventUpdates.close();
});

View file

@ -40,3 +40,16 @@ eventManApp.directive('resetFocus', function () {
};
});
eventManApp.directive('escKey', function() {
return function(scope, element, attrs) {
element.bind('keydown keypress', function(evt) {
if (evt.which === 27) {
scope.$apply(function() {
scope.$eval(attrs.escKey);
});
evt.preventDefault();
}
});
};
});

View file

@ -111,3 +111,7 @@ input[type=text].form-control, input[type=search].form-control {
:not(.no-leave)#toast-container > div.ng-leave {
transition-duration: .2s;
}
.query-input {
min-width: 400px;
}

View file

@ -28,7 +28,7 @@
"Attendees:": "Partecipanti:",
"Registered:": "Registrato:",
"Search:": "Cerca:",
"Name or email": "Nome o email",
"Name or email or key:value": "Nome, email o chiave:valore",
"Show cancelled tickets": "Mostra i biglietti cancellati",
"filtered item/s": "elementi filtrati",
"export CSV": "esporta in CSV",
@ -91,6 +91,7 @@
"Join again this event": "Partecipa di nuovo a questo evento",
"All Tickets": "Tutti i biglietti",
"Tickets:": "Biglietti",
"Name or email": "Nome o email",
"update user information": "aggiorna le informazioni dell'utente",
"Old password": "Vecchia password",
"New password": "Nuova password",