0001-backoffice-use-clean-field-labels-on-workflow-page-6.patch
tests/admin_pages/test_workflow.py | ||
---|---|---|
1913 | 1913 |
assert workflow.possible_status[0].items[0].fields == [{'field_id': first_field_id, 'value': 'Hello'}] |
1914 | 1914 | |
1915 | 1915 | |
1916 |
def test_workflows_fields_labels(pub): |
|
1917 |
create_superuser(pub) |
|
1918 | ||
1919 |
FormDef.wipe() |
|
1920 |
Workflow.wipe() |
|
1921 |
workflow = Workflow(name='foo') |
|
1922 |
workflow.backoffice_fields_formdef = WorkflowBackofficeFieldsFormDef(workflow) |
|
1923 |
workflow.backoffice_fields_formdef.fields = [ |
|
1924 |
fields.StringField(id='bo1-1x', label='hello' * 10), |
|
1925 |
fields.CommentField(id='bo2-2x', label='<p>comment field</p>'), |
|
1926 |
] |
|
1927 |
workflow.variables_formdef = WorkflowVariablesFieldsFormDef(workflow=workflow) |
|
1928 |
workflow.variables_formdef.fields = [ |
|
1929 |
fields.StringField(id='bo1-1x', label='hello' * 10, varname='hello'), |
|
1930 |
] |
|
1931 |
workflow.store() |
|
1932 | ||
1933 |
app = login(get_app(pub)) |
|
1934 |
resp = app.get(workflow.get_admin_url()) |
|
1935 |
assert [x.text.strip() for x in resp.pyquery('.backoffice-fields li a')] == [ |
|
1936 |
'hellohellohellohellohellohe(…)', |
|
1937 |
'comment field', |
|
1938 |
] |
|
1939 |
assert [x.text.strip() for x in resp.pyquery('.variables-fields li a')] == [ |
|
1940 |
'hellohellohellohellohellohe(…)', |
|
1941 |
] |
|
1942 | ||
1943 | ||
1916 | 1944 |
def test_workflows_functions(pub): |
1917 | 1945 |
create_superuser(pub) |
1918 | 1946 |
wcs/templates/wcs/backoffice/workflow.html | ||
---|---|---|
59 | 59 |
</div> |
60 | 60 | |
61 | 61 |
{% if not workflow.is_default %} |
62 |
<div class="bo-block"> |
|
62 |
<div class="bo-block variables-fields">
|
|
63 | 63 |
<h3>{% trans "Workflow Variables" %} |
64 | 64 |
{% if not workflow.is_readonly %} |
65 | 65 |
<span class="change">(<a href="variables/">{% trans "change" %}</a>)</span> |
... | ... | |
69 | 69 |
<ul class="biglist"> |
70 | 70 |
{% for field in workflow.variables_formdef.fields %} |
71 | 71 |
{% if field.varname %} |
72 |
<li><a href="variables/fields/{{ field.id }}">{{ field.label }} |
|
72 |
<li><a href="variables/fields/{{ field.id }}">{{ field.ellipsized_label }}
|
|
73 | 73 |
{% if '*' not in field.varname %} |
74 | 74 |
<code class="varname">{{ "{{" }} form_option_{{ field.varname }} }}</code> |
75 | 75 |
{% endif %} |
... | ... | |
119 | 119 |
</ul> |
120 | 120 |
</div> |
121 | 121 | |
122 |
<div class="bo-block"> |
|
122 |
<div class="bo-block backoffice-fields">
|
|
123 | 123 |
<h3>{% trans "Backoffice Fields" %} |
124 | 124 |
{% if not workflow.is_readonly %} |
125 | 125 |
<span class="change">(<a href="backoffice-fields/">{% trans "change" %}</a>)</span> |
... | ... | |
128 | 128 |
{% if workflow.backoffice_fields_formdef %} |
129 | 129 |
<ul class="biglist"> |
130 | 130 |
{% for field in workflow.backoffice_fields_formdef.fields %} |
131 |
<li><a href="backoffice-fields/fields/{{ field.id }}">{{ field.label }} |
|
131 |
<li><a href="backoffice-fields/fields/{{ field.id }}">{{ field.ellipsized_label }}
|
|
132 | 132 |
{% if field.varname %} |
133 | 133 |
<code class="varname">{{ "{{" }} form_var_{{ field.varname }} }}</code> |
134 | 134 |
{% endif %} |
135 |
- |