Add mobile support for basic "feedback" dialog

This commit is contained in:
Lance Edgar 2019-03-04 18:12:37 -06:00
parent 006a7096ed
commit ef7466e0d5
4 changed files with 120 additions and 8 deletions

View file

@ -125,7 +125,6 @@ class AuthenticationView(View):
'form': form,
'referrer': referrer,
'image_url': image_url,
'dialog': mobile,
}
def authenticate_user(self, username, password):

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar
# Copyright © 2010-2019 Lance Edgar
#
# This file is part of Rattail.
#
@ -144,7 +144,7 @@ class CommonView(View):
def feedback(self):
"""
Generic view to present/handle the user feedback form.
Generic view to handle the user feedback form.
"""
form = forms.Form(schema=Feedback(), request=self.request)
if form.validate(newstyle=True):
@ -156,6 +156,12 @@ class CommonView(View):
return {'ok': True}
return {'error': "Form did not validate!"}
def mobile_feedback(self):
"""
Generic view to handle the user feedback form on mobile.
"""
return self.feedback()
def consume_batch_id(self):
"""
Consume next batch ID from the PG sequence, and display via flash message.
@ -214,6 +220,8 @@ class CommonView(View):
# feedback
config.add_route('feedback', '/feedback', request_method='POST')
config.add_view(cls, attr='feedback', route_name='feedback', renderer='json')
config.add_route('mobile.feedback', '/mobile/feedback', request_method='POST')
config.add_view(cls, attr='mobile_feedback', route_name='mobile.feedback', renderer='json')
# consume batch ID
config.add_tailbone_permission('common', 'common.consume_batch_id',