add direct apply button to changesets and fix form button

This commit is contained in:
Laura Klünder 2024-12-02 11:48:16 +01:00
parent 435a271eab
commit fda3c2f85d
3 changed files with 9 additions and 1 deletions

View file

@ -138,6 +138,9 @@
{% if can_propose %}
<button type="submit" class="btn btn-primary" name="propose" value="1">{% trans 'Propose' %}</button>
{% endif %}
{% if can_commit %}
<button type="submit" class="btn btn-primary" name="commit" value="1">{% trans 'Apply' %}</button>
{% endif %}
{% if can_end_review %}
<button type="submit" class="btn btn-danger" name="reject" value="1">{% trans 'Reject' %}</button>
<button type="submit" class="btn btn-success" name="apply" value="1">{% trans 'Accept' %}</button>

View file

@ -25,7 +25,9 @@
{% buttons %}
<a href="{% url 'editor.changesets.detail' pk=changeset.pk %}" class="btn btn-default">{% trans 'Back' %}</a>
<div class="pull-right">
<button type="submit" class="btn btn-primary">{% trans 'Save' %}</button>
<button type="submit" class="btn btn-primary">
{% if action_label %}{{ action_label }}{% else %}{% trans 'Save' %}{% endif %}
</button>
</div>
{% endbuttons %}
</form>

View file

@ -78,6 +78,7 @@ def changeset_detail(request, pk):
return render(request, 'editor/changeset_edit.html', {
'changeset': changeset,
'action': 'propose',
'action_label': _('Propose'),
'form': form,
})
@ -109,6 +110,7 @@ def changeset_detail(request, pk):
return render(request, 'editor/changeset_edit.html', {
'changeset': changeset,
'action': 'commit',
'action_label': _('Apply'),
'form': form,
})
@ -212,6 +214,7 @@ def changeset_detail(request, pk):
'changeset': changeset,
'can_edit': can_edit,
'can_delete': can_delete,
'can_commit': changeset.can_commit(request),
'can_propose': changeset.can_propose(request),
'can_unpropose': changeset.can_unpropose(request),
'can_start_review': changeset.can_start_review(request),