Update UX for Storage administration

This commit is contained in:
Philipp 2021-07-24 18:57:29 +02:00
parent 1e4f9f62fe
commit 4be4498b13
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
3 changed files with 34 additions and 11 deletions

View file

@ -116,6 +116,7 @@ class Storage extends BaseAdmin
'name' => $name,
'prefix' => $storage_form_prefix,
'form' => $storage_form,
'active' => $name === $current_storage_backend::getName(),
];
}
@ -125,8 +126,10 @@ class Storage extends BaseAdmin
'$title' => DI::l10n()->t('Administration'),
'$page' => DI::l10n()->t('Storage'),
'$save' => DI::l10n()->t('Save'),
'$save_set' => DI::l10n()->t('Save & Activate'),
'$clear' => DI::l10n()->t('Clear'),
'$save_activate' => DI::l10n()->t('Save & Activate'),
'$activate' => DI::l10n()->t('Activate'),
'$save_reload' => DI::l10n()->t('Save & Reload'),
'$noconfig' => DI::l10n()->t('This backend doesn\'t have custom settings'),
'$baseurl' => DI::baseUrl()->get(true),
'$form_security_token' => self::getFormSecurityToken("admin_storage"),
'$storagebackend' => $current_storage_backend,

View file

@ -9,14 +9,24 @@
<form action="{{$baseurl}}/admin/storage/{{$storage.prefix}}" method="post">
<input type='hidden' name='form_security_token' value="{{$form_security_token}}">
<h3>{{$storage.name}}</h3>
{{if $storage.form}}
{{foreach from=$storage.form item=$field}}
{{include file=$field.field field=$field}}
{{/foreach}}
{{else}}
{{$noconfig}}
{{/if}}
{{if $storage.form}}
<div class="submit"><input type="submit" name="submit_save" value="{{$save}}" /></div>
<input type="submit" name="submit_save" value="{{$save}}"/>
{{if $storage.active}}
<input type="submit" name="submit_save_set" value="{{$save_reload}}"/>
{{else}}
<input type="submit" name="submit_save_set" value="{{$save_activate}}"/>
{{/if}}
{{else}}
<br /><input type="submit" name="submit_save_set" {{if $storage.active}}disabled="disabled"{{/if}} value="{{$activate}}"/>
{{/if}}
<div class="submit"><input type="submit" name="submit_save_set" value="{{$save_set}}" /></div>
</form>
{{/foreach}}

View file

@ -22,15 +22,25 @@
</div>
<div id="admin-settings-{{$storage.prefix}}-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="admin-settings-{{$storage.prefix}}">
<div class="panel-body">
{{if $storage.form}}
{{foreach from=$storage.form item=$field}}
{{include file=$field.field field=$field}}
{{/foreach}}
{{else}}
{{$noconfig}}
{{/if}}
</div>
<div class="panel-footer">
{{if $storage.form}}
<input type="submit" name="submit_save" class="btn btn-primary" value="{{$save}}"/>
{{if $storage.active}}
<input type="submit" name="submit_save_set" class="btn btn-primary" value="{{$save_reload}}"/>
{{else}}
<input type="submit" name="submit_save_set" class="btn btn-primary" value="{{$save_activate}}"/>
{{/if}}
{{else}}
<input type="submit" name="submit_save_set" class="btn btn-primary" {{if $storage.active}}disabled="disabled"{{/if}} value="{{$activate}}"/>
{{/if}}
<input type="submit" name="submit_save_set" class="btn btn-primary" value="{{$save_set}}"/>
</div>
</div>
</div>