0001-workflows-add-jump-action-on-status-lines-54024.patch
tests/admin_pages/test_workflow.py | ||
---|---|---|
896 | 896 |
assert resp.text.count('ComputedExpressionWidget') == 1 |
897 | 897 | |
898 | 898 | |
899 |
def test_workflows_jump_target_links(pub): |
|
900 |
create_superuser(pub) |
|
901 |
Workflow.wipe() |
|
902 |
workflow = Workflow(name='foo') |
|
903 |
st1 = workflow.add_status(name='baz') |
|
904 |
st2 = workflow.add_status(name='bar') |
|
905 | ||
906 |
jump = JumpWorkflowStatusItem() |
|
907 |
jump.id = '_jump' |
|
908 |
jump.timeout = 86400 |
|
909 |
jump.status = st2.id |
|
910 |
st1.items.append(jump) |
|
911 |
jump.parent = st1 |
|
912 | ||
913 |
workflow.store() |
|
914 | ||
915 |
app = login(get_app(pub)) |
|
916 |
resp = app.get('/backoffice/workflows/1/status/1/') |
|
917 |
assert resp.pyquery.find('.jump a').attr.href == 'http://example.net/backoffice/workflows/1/status/2/' |
|
918 | ||
919 |
for no_target in ('_previous', '_broken', None): |
|
920 |
jump.status = no_target |
|
921 |
workflow.store() |
|
922 |
resp = app.get('/backoffice/workflows/1/status/1/') |
|
923 |
assert not resp.pyquery.find('.jump a') |
|
924 | ||
925 | ||
899 | 926 |
def test_workflows_edit_sms_action(pub): |
900 | 927 |
create_superuser(pub) |
901 | 928 |
Workflow.wipe() |
wcs/qommon/static/css/dc2/admin.scss | ||
---|---|---|
1 | 1 |
$primary-color: #386ede; |
2 | 2 |
$secondary-color: #00d6eb; |
3 | 3 |
$string-color: str-slice($primary-color + '', 2); |
4 |
$actions: add, duplicate, edit, remove; |
|
4 |
$actions: add, duplicate, edit, jump, remove;
|
|
5 | 5 | |
6 | 6 |
@mixin clearfix { |
7 | 7 |
&::after { |
... | ... | |
2023 | 2023 |
&.view { |
2024 | 2024 |
margin-top: 2px; |
2025 | 2025 |
} |
2026 |
&.remove, &.add, &.edit, &.duplicate { |
|
2026 |
&.remove, &.add, &.edit, &.duplicate, &.jump {
|
|
2027 | 2027 |
padding: 0; |
2028 | 2028 |
border: 0; |
2029 | 2029 |
background: transparent; |
... | ... | |
2042 | 2042 |
background: url(/static/css/icons/action-#{$action}.small.#{$string-color}.png) center center no-repeat; |
2043 | 2043 |
background-size: 20px; |
2044 | 2044 |
background-image: url(/static/css/icons/action-#{$action}.small.#{$string-color}.png), |
2045 |
url(/static/css/icons/action-#{$action}.hover.png); |
|
2045 |
url(/static/css/icons/action-#{$action}.hover.png);
|
|
2046 | 2046 |
&:hover { |
2047 | 2047 |
background-image: url(/static/css/icons/action-#{$action}.hover.png); |
2048 | 2048 |
} |
wcs/templates/wcs/backoffice/workflow-status.html | ||
---|---|---|
32 | 32 |
<li class="biglistitem" id="itemId_{{ item.id }}"> |
33 | 33 |
<a href="items/{{ item.id }}/">{{ item.render_as_line|safe }}</a> |
34 | 34 |
<p class="commands"> |
35 |
{% with item.get_target_status_url as url %} |
|
36 |
{% if url %}<span class="jump"><a href="{{ url }}" title="{% trans "Go to Target" %}">{% trans "Go to Target" %}</a></span>{% endif %} |
|
37 |
{% endwith %} |
|
35 | 38 |
{% if not workflow.is_readonly %} |
36 | 39 |
<span class="edit"><a href="items/{{ item.id }}/" title="{% trans "Edit" %}">{% trans "Edit" %}</a></span> |
37 | 40 |
<span class="remove"><a href="items/{{ item.id }}/delete" rel="popup" title="{% trans "Delete" %}">{% trans "Delete" %}</a></span> |
wcs/wf/wscall.py | ||
---|---|---|
521 | 521 |
formdata.store() |
522 | 522 |
raise AbortActionException() |
523 | 523 | |
524 |
def get_target_status_url(self): |
|
525 |
# do not return anything as target status are accessory |
|
526 |
return None |
|
527 | ||
524 | 528 |
def get_target_status(self): |
525 | 529 |
# always return self status as a target so it's included in the |
526 | 530 |
# workflow visualisation as a "normal" action, in addition to |
wcs/workflows.py | ||
---|---|---|
1680 | 1680 |
continue |
1681 | 1681 |
yield item |
1682 | 1682 | |
1683 |
def get_admin_url(self): |
|
1684 |
return self.parent.get_admin_url() + 'status/%s/' % self.id |
|
1685 | ||
1683 | 1686 |
def evaluate_live_form(self, form, filled, user): |
1684 | 1687 |
for item in self.get_active_items(form, filled, user): |
1685 | 1688 |
item.evaluate_live_form(form, filled, user) |
... | ... | |
2187 | 2190 |
def get_substitution_variables(self, formdata): |
2188 | 2191 |
return {} |
2189 | 2192 | |
2193 |
def get_target_status_url(self): |
|
2194 |
if not getattr(self, 'status', None) or self.status == '_previous': |
|
2195 |
return None |
|
2196 | ||
2197 |
targets = [x for x in self.parent.parent.possible_status if x.id == self.status] |
|
2198 |
if not targets: |
|
2199 |
return None |
|
2200 | ||
2201 |
return targets[0].get_admin_url() |
|
2202 | ||
2190 | 2203 |
def get_target_status(self, formdata=None): |
2191 | 2204 |
"""Returns a list of status this item can lead to.""" |
2192 | 2205 |
if not getattr(self, 'status', None): |
2193 |
- |