Improve "touch" logic for employees
also use app handler for default touch logic
This commit is contained in:
parent
3726a2685a
commit
862198cf82
|
@ -304,6 +304,11 @@ class EmployeeView(MasterView):
|
||||||
items.append(HTML.tag('li', c=six.text_type(department)))
|
items.append(HTML.tag('li', c=six.text_type(department)))
|
||||||
return HTML.tag('ul', c=items)
|
return HTML.tag('ul', c=items)
|
||||||
|
|
||||||
|
def touch_instance(self, employee):
|
||||||
|
app = self.get_rattail_app()
|
||||||
|
employment = app.get_employment_handler()
|
||||||
|
employment.touch_employee(self.Session(), employee)
|
||||||
|
|
||||||
def get_version_child_classes(self):
|
def get_version_child_classes(self):
|
||||||
return [
|
return [
|
||||||
(model.Person, 'uuid', 'person_uuid'),
|
(model.Person, 'uuid', 'person_uuid'),
|
||||||
|
|
|
@ -1159,11 +1159,8 @@ class MasterView(View):
|
||||||
"""
|
"""
|
||||||
Perform actual "touch" logic for the given object.
|
Perform actual "touch" logic for the given object.
|
||||||
"""
|
"""
|
||||||
change = model.Change()
|
app = self.get_rattail_app()
|
||||||
change.class_name = obj.__class__.__name__
|
app.touch_object(self.Session(), obj)
|
||||||
change.instance_uuid = obj.uuid
|
|
||||||
change = self.Session.merge(change)
|
|
||||||
change.deleted = False
|
|
||||||
|
|
||||||
def versions(self):
|
def versions(self):
|
||||||
"""
|
"""
|
||||||
|
@ -4795,7 +4792,12 @@ class MasterView(View):
|
||||||
if cls.touchable:
|
if cls.touchable:
|
||||||
config.add_tailbone_permission(permission_prefix, '{}.touch'.format(permission_prefix),
|
config.add_tailbone_permission(permission_prefix, '{}.touch'.format(permission_prefix),
|
||||||
"\"Touch\" a {} to trigger datasync for it".format(model_title))
|
"\"Touch\" a {} to trigger datasync for it".format(model_title))
|
||||||
config.add_route('{}.touch'.format(route_prefix), '{}/touch'.format(instance_url_prefix))
|
config.add_route('{}.touch'.format(route_prefix),
|
||||||
|
'{}/touch'.format(instance_url_prefix),
|
||||||
|
# TODO: should add this restriction after the old
|
||||||
|
# jquery theme is no longer in use
|
||||||
|
#request_method='POST'
|
||||||
|
)
|
||||||
config.add_view(cls, attr='touch', route_name='{}.touch'.format(route_prefix),
|
config.add_view(cls, attr='touch', route_name='{}.touch'.format(route_prefix),
|
||||||
permission='{}.touch'.format(permission_prefix))
|
permission='{}.touch'.format(permission_prefix))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue