From d0e4f2188f9a987164c3d9a9c889e078ab6ee825 Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sat, 15 Apr 2017 13:35:15 +0200 Subject: [PATCH] show message for no match --- angular_app/js/app.js | 1 + eventman_server.py | 10 +++++++--- static/css/eventman.css | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/angular_app/js/app.js b/angular_app/js/app.js index e015b68..7f29b4d 100644 --- a/angular_app/js/app.js +++ b/angular_app/js/app.js @@ -17,6 +17,7 @@ /* Register our fantastic app. */ var eventManApp = angular.module('eventManApp', [ 'ngRoute', + 'ngAnimate', 'eventManServices', 'eventManControllers', 'ui.bootstrap', diff --git a/eventman_server.py b/eventman_server.py index 9b4d536..dd560ff 100755 --- a/eventman_server.py +++ b/eventman_server.py @@ -816,10 +816,14 @@ class EventsHandler(CollectionHandler): self.send_ws_message('event/%s/tickets/updates' % id_, json.dumps(ret)) self.set_status(400) return ret - elif nr_matches == 1: - old_ticket_data = matching_tickets[0] + elif nr_matches == 0: + ret = {'error': True, 'message': 'no ticket matched', 'query': query, + 'uuid': uuid, 'username': self.current_user_info.get('username', '')} + self.send_ws_message('event/%s/tickets/updates' % id_, json.dumps(ret)) + self.set_status(400) + return ret else: - old_ticket_data = {} + old_ticket_data = matching_tickets[0] # We have changed the "cancelled" status of a ticket to False; check if we still have a ticket available if 'number_of_tickets' in current_event and old_ticket_data.get('cancelled') and not data.get('cancelled'): diff --git a/static/css/eventman.css b/static/css/eventman.css index 2438f85..1ae6e4e 100644 --- a/static/css/eventman.css +++ b/static/css/eventman.css @@ -103,3 +103,8 @@ input[type=text].form-control, input[type=search].form-control { #toast-container.toast-bottom-center>div, #toast-container.toast-center>div, #toast-container.toast-top-center>div { margin-bottom: 4px; } + +:not(.no-enter)#toast-container > div.ng-enter +{ + transition-duration: .1s; +}