Add basic autocomplete support for "quick row" feature
This commit is contained in:
parent
68bd3047c4
commit
935a6b2a68
4 changed files with 58 additions and 7 deletions
|
@ -152,9 +152,9 @@ class BatchMasterView(MasterView):
|
|||
if kwargs['mobile']:
|
||||
if self.mobile_rows_creatable:
|
||||
kwargs.setdefault('add_item_title', "Add Item")
|
||||
if self.mobile_rows_quickable:
|
||||
kwargs.setdefault('quick_row_entry_placeholder', "Enter {}".format(
|
||||
self.rattail_config.product_key_title()))
|
||||
if self.mobile_rows_quickable:
|
||||
kwargs.setdefault('quick_row_entry_placeholder', "Enter {}".format(
|
||||
self.rattail_config.product_key_title()))
|
||||
if kwargs['execute_enabled']:
|
||||
url = self.get_action_url('execute', batch)
|
||||
kwargs['execute_form'] = self.make_execute_form(batch, action_url=url)
|
||||
|
@ -490,6 +490,18 @@ class BatchMasterView(MasterView):
|
|||
return False
|
||||
return True
|
||||
|
||||
def rows_quickable_for(self, batch):
|
||||
"""
|
||||
Must return boolean indicating whether the "quick row" feature should
|
||||
be allowed for the given batch. By default, returns ``False`` if batch
|
||||
has already been executed or marked complete, and ``True`` otherwise.
|
||||
"""
|
||||
if batch.executed:
|
||||
return False
|
||||
if batch.complete:
|
||||
return False
|
||||
return True
|
||||
|
||||
def configure_row_grid(self, g):
|
||||
super(BatchMasterView, self).configure_row_grid(g)
|
||||
|
||||
|
|
|
@ -1790,6 +1790,18 @@ class MasterView(View):
|
|||
context['row_model_title_plural'] = self.get_row_model_title_plural()
|
||||
context['row_action_url'] = self.get_row_action_url
|
||||
|
||||
if mobile:
|
||||
|
||||
if self.mobile_rows_creatable:
|
||||
context['add_item_title'] = "Add Record"
|
||||
|
||||
if self.mobile_rows_quickable:
|
||||
context['quick_row_entry_placeholder'] = "Enter search text"
|
||||
|
||||
# quick row does *not* use autocomplete by default
|
||||
context['quick_row_autocomplete'] = False
|
||||
context['quick_row_autocomplete_url'] = '#'
|
||||
|
||||
context.update(data)
|
||||
context.update(self.template_kwargs(**context))
|
||||
if hasattr(self, 'template_kwargs_{}'.format(template)):
|
||||
|
@ -2552,6 +2564,13 @@ class MasterView(View):
|
|||
"""
|
||||
return True
|
||||
|
||||
def rows_quickable_for(self, instance):
|
||||
"""
|
||||
Must return boolean indicating whether the "quick row" feature should
|
||||
be allowed for the given instance. Returns ``True`` by default.
|
||||
"""
|
||||
return True
|
||||
|
||||
def row_editable(self, row):
|
||||
"""
|
||||
Returns boolean indicating whether or not the given row can be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue