Skip to content

Commit

Permalink
feat: add blacklistedAssetVolumes to the plugin settings editable i…
Browse files Browse the repository at this point in the history
…n the CP
  • Loading branch information
nstCactus committed Dec 7, 2021
1 parent 0062608 commit 68792c5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ Type: _string[]_
An array of entry type handles. Entries of those types won't be indexed.


### Only in the configuration file

#### `blacklistedAssetVolumes`
Type: _string[]_

An array of asset volume handles. Assets in those volumes won't be indexed.


### Only in the configuration file

#### `contentExtractorCallback`
Type: _callable_

Expand Down
42 changes: 40 additions & 2 deletions src/templates/cp/settings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@

<hr>

<h2>{{ 'Blacklisted entries types'|t('elasticsearch') }}</h2>
<h2>{{ 'Blacklisted entry types'|t('elasticsearch') }}</h2>
<p class="warning with-icon">{{ macros.configWarning('blacklistedEntryTypes') }}</p>
<p class="light">{{ 'Never index:'|t('elasticsearch') }}</p>
<div class="field">
<table id="sites" class="shadow-box editable">
<table id="entryTypes" class="shadow-box editable">
<thead>
<tr>
<th scope="col" class="thin">{{ 'Type'|t('elasticsearch') }}</th>
Expand Down Expand Up @@ -155,6 +156,43 @@
</table>
</div>

<hr>

<h2>{{ 'Blacklisted asset volumes'|t('elasticsearch') }}</h2>
{% if 'blacklistedAssetVolumes' in overrides %}
<p class="warning with-icon">{{ macros.configWarning('blacklistedAssetVolumes') }}</p>
{% endif %}

<p class="light">{{ 'Never index:'|t('elasticsearch') }}</p>
<div class="field">
<table id="volumes" class="shadow-box editable">
<thead>
<tr>
<th scope="col" class="thin">{{ 'Handle'|t('elasticsearch') }}</th>
<th scope="col">{{ 'Name'|t('elasticsearch') }}</th>
<th scope="col" class="thin"></th>
</tr>
</thead>
<tbody>
{% for volume in craft.app.volumes.getAllVolumes() %}
<tr data-id="default">
<th><code>{{ volume.handle }}</code></th>
<td>{{ volume.name }}</td>
<td>
{{ forms.lightswitch({
name: "blacklistedAssetVolumes[]",
value: volume.handle,
on: volume.handle in settings['blacklistedAssetVolumes'],
small: true,
disabled: 'blacklistedAssetVolumes' in overrides,
}) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>


{% include 'elasticsearch/components/elastic-branding' %}
</div>
5 changes: 4 additions & 1 deletion src/translations/fr/elasticsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@
'HTML tags used to wrap the search term in order to highlight it in the search results' => 'Balises HTML insérées autour des termes recherchés afin de les mettre en avant dans les résultats de recherche',
'Before' => 'Avant',
'After' => 'Après',
'Blacklisted entries types' => 'Types d\'entrées exclues',
'Blacklisted entry types' => 'Types d\'entrées exclus',
'Blacklisted asset volumes' => 'Volumes de ressources exclus',
'Never index:' => 'Ne pas indexer :',
'Entry Type' => 'Type d\'entrée',
'Handle' => 'Handle',
'Name' => 'Nom',
'Elasticsearch indices naming' => 'Nommage des indices Elasticsearch',
'Only lowercase letters are allowed.' => 'Ne doit être composé que de lettres minuscules',
'This is being overridden by the {setting} config setting in your {file} config file.' => 'Ce paramètre est surchargé par la propriété {setting} du fichier de configuration {file}.',
Expand Down

0 comments on commit 68792c5

Please sign in to comment.