Skip to content

Commit

Permalink
small fix for field builder options shown depending on type
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasCARPi committed Jul 26, 2023
1 parent 21cd556 commit 3bd8211
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/classes/App.php
Expand Up @@ -44,7 +44,7 @@ class App
use UploadTrait;
use TwigTrait;

public const INSTALLED_VERSION = '4.8.0-beta';
public const INSTALLED_VERSION = '4.8.0';

public const WHATSNEWLINK = 'https://www.deltablot.com/posts/release-480/';

Expand Down
43 changes: 22 additions & 21 deletions src/templates/field-builder-modal.html
Expand Up @@ -59,27 +59,6 @@ <h5 class='modal-title' id='fieldBuilderLabel'><i class='fas fa-fw fa-trowel'></
<div id='newFieldContentDiv_classic'>
<label for='newFieldValueInput'>{{ 'Default value'|trans }}</label>
<input type='text' autocomplete='off' placeholder='{{ 'Enter a default value'|trans }}' id='newFieldValueInput' class='form-control'>
<div class='separator'></div>
<!-- Blank value on duplicate switch -->
<div>
<div class='d-inline-flex flex-row'>
<div class='d-inline mr-1' for='blankValueOnDuplicateSwitch'><p>{{ 'Blank value on duplicate'|trans }}</p></div>
<label class='switch'>
<input type='checkbox' autocomplete='off' id='blankValueOnDuplicateSwitch'>
<span class='slider'></span>
</label>
</div>
</div>
<div>
{# required switch #}
<div class='d-inline-flex flex-row'>
<div class='d-inline mr-1' for='requiredSwitch'><p>{{ 'Required'|trans }}</p></div>
<label class='switch'>
<input type='checkbox' autocomplete='off' id='requiredSwitch'>
<span class='slider'></span>
</label>
</div>
</div>
</div>

<!-- SELECT, RADIO -->
Expand Down Expand Up @@ -119,6 +98,28 @@ <h5 class='modal-title' id='fieldBuilderLabel'><i class='fas fa-fw fa-trowel'></
</select>
</div>

<div class='separator'></div>
{# Blank value on duplicate switch #}
<div>
<div class='d-inline-flex flex-row'>
<div class='d-inline mr-1' for='blankValueOnDuplicateSwitch'><p>{{ 'Blank value on duplicate'|trans }}</p></div>
<label class='switch'>
<input type='checkbox' autocomplete='off' id='blankValueOnDuplicateSwitch'>
<span class='slider'></span>
</label>
</div>
</div>
{# required switch #}
<div>
<div class='d-inline-flex flex-row'>
<div class='d-inline mr-1' for='requiredSwitch'><p>{{ 'Required'|trans }}</p></div>
<label class='switch'>
<input type='checkbox' autocomplete='off' id='requiredSwitch'>
<span class='slider'></span>
</label>
</div>
</div>

</div>
<div class='modal-footer'>
<button type='button' class='btn btn-secondary' data-dismiss='modal'>{{ 'Close'|trans }}</button>
Expand Down
4 changes: 3 additions & 1 deletion src/ts/metadata.ts
Expand Up @@ -50,7 +50,7 @@ document.addEventListener('DOMContentLoaded', () => {
}

function toggleContentDiv(key: string) {
const keys = ['classic', 'selectradio', 'checkbox', 'number'];
const keys = ['classic', 'select', 'selectradio', 'checkbox', 'number'];
document.getElementById('newFieldContentDiv_' + key).toggleAttribute('hidden', false);
// remove the shown one from the list and hide all others
keys.filter(k => k !== key).forEach(k => {
Expand All @@ -76,6 +76,8 @@ document.addEventListener('DOMContentLoaded', () => {
case ExtraFieldInputType.Select:
document.getElementById('newFieldContentDiv_select').removeAttribute('hidden');
toggleContentDiv('selectradio');
// special case for the select block to allow multiple values
document.getElementById('newFieldContentDiv_select').toggleAttribute('hidden', false);
break;
case ExtraFieldInputType.Radio:
toggleContentDiv('selectradio');
Expand Down

0 comments on commit 3bd8211

Please sign in to comment.