Various tweaks for mobile receiving batches

this is temporary, soon will refactor all that again..
This commit is contained in:
Lance Edgar 2017-05-22 13:13:44 -05:00
parent 5cb3f15616
commit d93b91f491
4 changed files with 29 additions and 11 deletions

View file

@ -110,9 +110,6 @@
% if master is not Undefined and master.listing: % if master is not Undefined and master.listing:
<h1>${model_title_plural}</h1> <h1>${model_title_plural}</h1>
% elif index_title is not Undefined and index_url is not Undefined:
<h1>${h.link_to(index_title, index_url)}</h1>
<h2>${self.page_title()}</h2>
% elif capture(self.page_title): % elif capture(self.page_title):
<h2>${self.page_title()}</h2> <h2>${self.page_title()}</h2>
% endif % endif

View file

@ -0,0 +1,8 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/base.mako" />
<%def name="title()">Receiving</%def>
${h.link_to("New Receiving Batch", url('purchases.batch.mobile_create'), class_='ui-btn')}
${h.link_to("View Receiving Batches", url('mobile.purchases.batch'), class_='ui-btn')}

View file

@ -413,6 +413,11 @@ class BatchMasterView(MasterView):
super(BatchMasterView, self).delete_instance(batch) super(BatchMasterView, self).delete_instance(batch)
def get_fallback_templates(self, template, mobile=False): def get_fallback_templates(self, template, mobile=False):
if mobile:
return [
'/mobile/newbatch/{}.mako'.format(template),
'/mobile/master/{}.mako'.format(template),
]
return [ return [
'/newbatch/{}.mako'.format(template), '/newbatch/{}.mako'.format(template),
'/master/{}.mako'.format(template), '/master/{}.mako'.format(template),

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8; -*-
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar # Copyright © 2010-2017 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -80,6 +80,7 @@ class PurchaseBatchView(BatchMasterView):
rows_creatable = True rows_creatable = True
rows_editable = True rows_editable = True
edit_with_rows = False edit_with_rows = False
supports_mobile = True
order_form_header_columns = [ order_form_header_columns = [
"UPC", "UPC",
@ -915,9 +916,16 @@ class PurchaseBatchView(BatchMasterView):
result['image_url'] = pod.get_image_url(self.rattail_config, upc) result['image_url'] = pod.get_image_url(self.rattail_config, upc)
return result return result
def mobile_index(self): def mobile_menu(self):
self.mobile = True """
return self.render_to_response('mobile_index', {}) Mobile menu page for purchasing/receiving batches
"""
return self.render_to_response('menu', {}, mobile=True)
def get_mobile_data(self, session=None):
# TODO: for now, only show receiving batches..
return self.get_data(session=session)\
.filter(model.PurchaseBatch.mode == self.enum.PURCHASE_BATCH_MODE_RECEIVING)
def mobile_create(self): def mobile_create(self):
""" """
@ -963,9 +971,9 @@ class PurchaseBatchView(BatchMasterView):
model_key = cls.get_model_key() model_key = cls.get_model_key()
model_title = cls.get_model_title() model_title = cls.get_model_title()
# mobile index # mobile menu
config.add_route('{}.mobile'.format(route_prefix), '/mobile{}'.format(url_prefix)) config.add_route('{}.mobile_menu'.format(route_prefix), '/mobile{}/menu'.format(url_prefix))
config.add_view(cls, attr='mobile_index', route_name='{}.mobile'.format(route_prefix), config.add_view(cls, attr='mobile_menu', route_name='{}.mobile_menu'.format(route_prefix),
permission='{}.list'.format(permission_prefix)) permission='{}.list'.format(permission_prefix))
# mobile create # mobile create