workflows: add form action details in list of actions (#76014) #669
|
@ -1584,7 +1584,7 @@ def test_workflows_edit_display_form_action(pub):
|
|||
|
||||
resp.forms[0]['action-interaction'] = 'Form'
|
||||
resp = resp.forms[0].submit().follow()
|
||||
resp = resp.click(re.compile('^Form$'))
|
||||
resp = resp.click(r'Form \(not completed\)')
|
||||
resp.form['varname'] = 'myform'
|
||||
resp = resp.forms[0].submit('submit').follow()
|
||||
# fields page
|
||||
|
|
|
@ -794,3 +794,22 @@ def test_workflow_form_file_access(pub):
|
|||
account.user_id = user.id
|
||||
account.store()
|
||||
login(get_app(pub), username='foo2', password='foo2').get(resp.pyquery('#t1').attr.href, status=403)
|
||||
|
||||
|
||||
def test_workflow_form_line_details(pub):
|
||||
workflow = Workflow(name='choice')
|
||||
st1 = workflow.add_status('Status1', 'st1')
|
||||
display_form = st1.add_action('form')
|
||||
|
||||
assert display_form.get_line_details() == 'not completed'
|
||||
|
||||
role = pub.role_class(name='foorole')
|
||||
role.store()
|
||||
display_form.by = [role.id]
|
||||
assert display_form.get_line_details() == 'not completed'
|
||||
|
||||
display_form.formdef = WorkflowFormFieldsFormDef(item=display_form)
|
||||
display_form.formdef.fields = [
|
||||
fields.BlockField(id='1', label='test', block_slug='foobar', varname='fooblock'),
|
||||
]
|
||||
assert display_form.get_line_details() == 'by foorole'
|
||||
|
|
|
@ -135,6 +135,11 @@ class FormWorkflowStatusItem(WorkflowStatusItem):
|
|||
# force new defaut value
|
||||
self.hide_submit_button = True
|
||||
|
||||
def get_line_details(self):
|
||||
if not self.formdef or not self.by:
|
||||
return _('not completed')
|
||||
return _('by %s') % self.render_list_of_roles(self.by)
|
||||
|
||||
@property
|
||||
def submit_button_label(self):
|
||||
# make submit button go to fields page when there are not yet any field.
|
||||
|
|
Loading…
Reference in New Issue