Skip to content

Commit

Permalink
Feat(Timeline): add 'blacklist' / 'whitelist' for doc
Browse files Browse the repository at this point in the history
  • Loading branch information
stonebuzz authored Nov 21, 2024
1 parent 19b6c92 commit 4103dc5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@
</button>
</form>
{% endif %}
{% if entry_i['_can_edit'] %}
{% set blacklisted_class = entry_i['is_blacklisted'] ? 'red' : '' %}
{% set blacklisted_title = entry_i['is_blacklisted'] ? _x('button', 'Remove from import exclusion list') : _x('button', 'Add to import exclusion list') %}
{% set blacklisted_value = entry_i['is_blacklisted'] ? 0 : 1 %}
<form class="d-inline" method="post" action="{{ 'Document'|itemtype_form_path }}">
<input type="hidden" name="id" value="{{ document['item']['id'] }}">
<input type="hidden" name="is_blacklisted" value="{{ blacklisted_value }}">
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}" />
<button type="submit" class="btn btn-sm btn-ghost-secondary" name="update"
title="{{ blacklisted_title }}"
data-bs-toggle="tooltip" data-bs-placement="top">
<i class="ti ti-ban {{ blacklisted_class }}"></i>
</button>
</form>
{% endif %}
</div>
</div>
</div>
Expand Down
16 changes: 16 additions & 0 deletions templates/components/itilobject/timeline/sub_documents.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@
</button>
</form>
{% endif %}

{% if document['item']['_can_edit'] %}
{% set blacklisted_class = document['item']['is_blacklisted'] ? 'red' : '' %}
{% set blacklisted_title = document['item']['is_blacklisted'] ? _x('button', 'Remove from import exclusion list') : _x('button', 'Add to import exclusion list') %}
{% set blacklisted_value = document['item']['is_blacklisted'] ? 0 : 1 %}
<form class="d-inline" method="post" action="{{ 'Document'|itemtype_form_path }}">
<input type="hidden" name="id" value="{{ document['item']['id'] }}">
<input type="hidden" name="is_blacklisted" value="{{ blacklisted_value }}">
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}" />
<button type="submit" class="btn btn-sm btn-ghost-secondary" name="update"
title="{{ blacklisted_title }}"
data-bs-toggle="tooltip" data-bs-placement="top">
<i class="ti ti-ban {{ blacklisted_class }}"></i>
</button>
</form>
{% endif %}
</div>
</div>
{% endset %}
Expand Down

0 comments on commit 4103dc5

Please sign in to comment.