redirect at ticket creation

This commit is contained in:
Davide Alberani 2016-06-26 20:45:12 +02:00
parent bccc0c7b74
commit 0512f09e0c
4 changed files with 15 additions and 9 deletions

View file

@ -49,7 +49,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="person in event.persons | splittedFilter:query | registeredFilter | orderBy:personsOrder">
<tr ng-repeat="person in (event.persons || []) | splittedFilter:query | registeredFilter | orderBy:personsOrder">
<td class="text-right">{{$index+1}}</td>
<td>
<span><strong><a ui-sref="person.info({id: person.person_id})"><span class="fa fa-lg fa-user"></span></a>&nbsp;<a ui-sref="event.ticket.edit({id: event._id, ticket_id: person._id})" ng-if="person._id"><span>{{person.name}}</span>&nbsp;<span>{{person.surname}}</span></a></strong></span><span ng-if="!person._id"><span>{{person.name}}</span>&nbsp;<span>{{person.surname}}</span></a></strong></span></span><span ng-if="person.email">&nbsp;&lt;{{person.email}}&gt;</span>

View file

@ -425,7 +425,7 @@ eventManControllers.controller('EventTicketsCtrl', ['$scope', '$state', 'Event',
person._id = $state.params.id; // that's the id of the event, not the person.
EventTicket.add(person, function(ticket) {
$log.debug(ticket);
$state.go('event.ticket.edit', {ticket_id: ticket._id});
$state.go('event.ticket.edit', {id: $scope.event._id, ticket_id: ticket._id});
});
});
};

View file

@ -4,12 +4,12 @@
<div class="container">
<div class="row">
<div class="col-md-7 col-xs-7 vcenter">
<h1><a ui-sref="event.view({id: event._id})" ng-if="event._id">{{event.title}}</a> - {{'new ticket' | translate}}</h1>
<h1><a ui-sref="event.view({id: event._id})" ng-if="event._id">{{event.title}}</a><span ng-if="!ticket._id"> - {{'join this event' | translate}}</span><span ng-if="ticket._id"> - {{'your ticket' | translate}}</span></h1>
</div>
</div>
</div>
<div class="container" ng-if="ticket._id && !ticket.cancelled">
<div class="container" ng-if="!ticket.cancelled">
<div class="row">
<div class="col-md-12">
<div class="panel panel-info table-striped top5">

View file

@ -89,6 +89,7 @@ class BaseHandler(tornado.web.RequestHandler):
'event:tickets-all|create': True,
'events|read': True,
'persons|create': True,
'person|create': True,
'users|create': True
}
@ -513,9 +514,12 @@ class CollectionHandler(BaseHandler):
:param message: message to send
:type message: str
"""
ws = yield tornado.websocket.websocket_connect(self.build_ws_url(path))
ws.write_message(message)
ws.close()
try:
ws = yield tornado.websocket.websocket_connect(self.build_ws_url(path))
ws.write_message(message)
ws.close()
except Exception, e:
self.logger.error('Error yielding WebSocket message: %s', e)
class PersonsHandler(CollectionHandler):
@ -615,8 +619,10 @@ class EventsHandler(CollectionHandler):
self._clean_dict(data)
data['seq'] = self.get_next_seq('event_%s_persons' % id_)
data['seq_hex'] = '%06X' % data['seq']
doc = self.db.query('events',
{'_id': id_, 'persons.person_id': person_id})
if person_id is None:
doc = {}
else:
doc = self.db.query('events', {'_id': id_, 'persons.person_id': person_id})
ret = {'action': 'add', 'person_id': person_id, 'person': data, 'uuid': uuid}
if '_id' in data:
del data['_id']