Skip to content

Commit

Permalink
System: remove the unsaved changes indicator from the installer
Browse files Browse the repository at this point in the history
  • Loading branch information
SKuipers committed Nov 3, 2024
1 parent e24def5 commit 18de74e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index_tt_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
if ($tt != false) {
$output .= $tt;
} else {
echo Format::alert(__('There is no information for the date specified.'), 'error');
echo Format::alert(__('There is no information for the date specified.'), 'empty');
}
}

Expand Down
7 changes: 5 additions & 2 deletions resources/templates/components/form.twig.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{% set standardLayout = "noIntBorder" not in form.getClass and "form-small" not in form.getClass and "blank" not in form.getClass %}
{% set smallLayout = "form-small" in form.getClass %}
{% set useSections = "noIntBorder" not in form.getClass and "blank" not in form.getClass %}
{% set useSaveWarning = "noIntBorder" not in form.getClass and "disable-warnings" not in form.getClass %}

{% if quickSave and form.getAction %}
<form x-validate {{ form.getAttributeString|raw }} hx-trigger="quicksave, keydown[metaKey&&key=='s'] from:body" hx-post="{{ form.getAction }}" hx-target=".formStatusReturn" hx-select="#alerts" hx-on:htmx:before-request="" hx-swap="innerHTML show:none swap:0.5s" x-data="{'show': true, 'saving': false, 'invalid': false, 'submitting': false, 'showTimeout': false}" x-on:htmx:before-request="saving = true; show = true; clearTimeout(showTimeout);" x-on:htmx:after-swap="saving = false" x-on:htmx:after-settle="showTimeout = setTimeout(() => show = false, 5000); $dispatch('saved');" x-ref="form" @submit="$validate.submit; invalid = !$validate.isComplete($el); if (invalid) submitting = false;" @change.debounce.750ms="if (invalid) invalid = !$validate.isComplete($el); ">
Expand Down Expand Up @@ -70,7 +71,7 @@ <h2>{{ form.getTitle }}</h2>

{% if form.getRows|length > 0 %}
<section id="form" class="w-full grid grid-cols-5 xl:grid-cols-8 gap-2 sm:gap-4 font-sans text-xs text-gray-700 {{ "noIntBorder" in form.getClass ? 'border bg-blue-50 rounded p-4' }}" style="" cellspacing="0"
{% if "noIntBorder" not in form.getClass%}
{% if useSaveWarning %}
x-data="{changed: false,
checkInput(formElement) {
document.getElementById(formElement.id).addEventListener('input', (evt) => {
Expand Down Expand Up @@ -137,9 +138,11 @@ <h2>{{ form.getTitle }}</h2>
{% set class = hasClass ? class ~ ' ' ~ element.getClass : class %}
<div class="{{ class }} {{ 'flex-' not in class and section != 'submit' ? 'flex-1' }}" {{ element.getAttributeString('x-show')|raw }}>

{% if standardLayout and element.getAttribute('id') == 'Submit' %}
{% if useSaveWarning and element.getAttribute('id') == 'Submit' %}
<span x-cloak x-show="changed" class="tag message mr-4 whitespace-nowrap">{{ __('Unsaved Changes') }}</span>
{% endif %}

{% if standardLayout and element.getAttribute('id') == 'Submit' %}
<span x-cloak x-show="invalid" class="tag error mr-4 whitespace-nowrap">{{ __('Please Check Form') }}</span>
{% endif %}

Expand Down
6 changes: 4 additions & 2 deletions resources/templates/installer/install.twig.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
<link rel='stylesheet' type='text/css' href='../themes/Default/css/main.css' />
<script type="text/javascript" src="../lib/jquery/jquery.js"></script>
<script type="text/javascript" src="../lib/jquery/jquery-migrate.min.js"></script>
<script type="text/javascript" src="../lib/htmx/htmx.min.js" defer></script>
<script type="text/javascript" src="../lib/htmx/alpine.min.js" defer></script>
<script type="text/javascript" src="../lib/htmx/htmx.min.js"></script>
<script type='text/javascript' src='../resources/assets/js/core.js'></script>
<script type="text/javascript" src="../resources/assets/js/installer.js"></script>
<script type="text/javascript" src="../lib/htmx/alpine.focus.min.js" defer></script>
<script type="text/javascript" src="../lib/htmx/alpine.validate.min.js" defer></script>
<script type="text/javascript" src="../lib/htmx/alpine.min.js" defer></script>
{% endblock head %}

{% block beforePage %}
Expand Down
10 changes: 5 additions & 5 deletions src/Install/Http/InstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function viewStepOne(

$form = MultiPartForm::create('installer', $submitUrl);
$form->setTitle(__('Installation - Step {count}', ['count' => 1]));
$form->setClass('smallIntBorder w-full');
$form->setClass('smallIntBorder w-full disable-warnings');

if (!empty($directoryError)) {
$form->setDescription(Format::alert($directoryError, 'error'));
Expand Down Expand Up @@ -363,7 +363,7 @@ public function viewStepTwo(

$form = MultiPartForm::create('installer', $submitUrl);
$form->setTitle(__('Installation - Step {count}', ['count' => 2]));
$form->setClass('smallIntBorder w-full');
$form->setClass('smallIntBorder w-full disable-warnings');
$form->addPages(static::getSteps());
$form->setCurrentPage(2);

Expand Down Expand Up @@ -489,7 +489,7 @@ public function viewStepThree(
$form = MultiPartForm::create('installer', $submitUrl);
$form->setTitle(__('Installation - Step {count}', ['count' => 3]));
$form->setFactory(DatabaseFormFactory::create($installer->getConnection()));
$form->setClass('smallIntBorder w-full');
$form->setClass('smallIntBorder w-full disable-warnings');
$form->addPages(static::getSteps());
$form->setCurrentPage(3);

Expand Down Expand Up @@ -544,7 +544,7 @@ public function viewStepThree(
$setting = $installer->getSetting('absoluteURL', 'System', true);
$row = $form->addRow();
$row->addLabel($setting['name'], __($setting['nameDisplay']))->description(__($setting['description']));
$row->addURL($setting['name'])->setValue($absoluteURL)->maxLength(100)->required();
$row->addTextField($setting['name'])->setValue($absoluteURL)->maxLength(100)->required();

$setting = $installer->getSetting('absolutePath', 'System', true);
$row = $form->addRow();
Expand Down Expand Up @@ -832,7 +832,7 @@ public function viewStepFour(

$form = MultiPartForm::create('installer', "./install.php?step=4");
$form->setTitle(__('Installation - Step {count}', ['count' => $step + 1]));
$form->setClass('smallIntBorder w-full');
$form->setClass('smallIntBorder w-full disable-warnings');
$form->addPages(static::getSteps());
$form->setCurrentPage(4);

Expand Down

0 comments on commit 18de74e

Please sign in to comment.