Allow to change needs review status using parts multiselect action

This commit is contained in:
Jan Böhmer 2022-11-29 00:18:11 +01:00
parent dc81f8272e
commit 6ce6b97b1e
3 changed files with 30 additions and 1 deletions

View file

@ -83,6 +83,14 @@ final class PartsTableActionHandler
$this->denyAccessUnlessGranted('change_favorite', $part);
$part->setFavorite(false);
break;
case 'set_needs_review':
$this->denyAccessUnlessGranted('edit', $part);
$part->setNeedsReview(true);
break;
case 'unset_needs_review':
$this->denyAccessUnlessGranted('edit', $part);
$part->setNeedsReview(false);
break;
case 'delete':
$this->denyAccessUnlessGranted('delete', $part);
$this->entityManager->remove($part);

View file

@ -38,7 +38,10 @@
<option {% if not is_granted('@parts.change_favorite') %}disabled{% endif %} value="favorite">{% trans %}part_list.action.action.favorite{% endtrans %}</option>
<option {% if not is_granted('@parts.change_favorite') %}disabled{% endif %} value="unfavorite">{% trans %}part_list.action.action.unfavorite{% endtrans %}</option>
</optgroup>
<optgroup label="{% trans %}part_list.action.action.group.needs_review{% endtrans %}">
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="set_needs_review">{% trans %}part_list.action.action.set_needs_review{% endtrans %}</option>
<option {% if not is_granted('@parts.edit') %}disabled{% endif %} value="unset_needs_review">{% trans %}part_list.action.action.unset_needs_review{% endtrans %}</option>
</optgroup>
<optgroup label="{% trans %}part_list.action.action.group.change_field{% endtrans %}">
<option {% if not is_granted('@categories.read') %}disabled{% endif %} value="change_category" data-url="{{ path('select_category') }}">{% trans %}part_list.action.action.change_category{% endtrans %}</option>
<option {% if not is_granted('@footprints.read') %}disabled{% endif %} value="change_footprint" data-url="{{ path('select_footprint') }}">{% trans %}part_list.action.action.change_footprint{% endtrans %}</option>

View file

@ -9887,5 +9887,23 @@ Element 3</target>
<target>Data</target>
</segment>
</unit>
<unit id="AAoGo_X" name="part_list.action.action.group.needs_review">
<segment>
<source>part_list.action.action.group.needs_review</source>
<target>Needs Review</target>
</segment>
</unit>
<unit id="hcvOTrH" name="part_list.action.action.set_needs_review">
<segment>
<source>part_list.action.action.set_needs_review</source>
<target>Set Needs Review Status</target>
</segment>
</unit>
<unit id="E1AQubV" name="part_list.action.action.unset_needs_review">
<segment>
<source>part_list.action.action.unset_needs_review</source>
<target>Unset Needs Review Status</target>
</segment>
</unit>
</file>
</xliff>