Refactor features pages

- Create frio template for admin features page
- Fix header hierarchy
This commit is contained in:
Hypolite Petovan 2020-04-01 18:27:14 -04:00
parent fd89572606
commit 6bb210ff7a
6 changed files with 68 additions and 44 deletions

View File

@ -64,15 +64,14 @@ class Features extends BaseAdmin
{
parent::content($parameters);
$arr = [];
$features = Feature::get(false);
$features = [];
foreach ($features as $fname => $fdata) {
$arr[$fname] = [];
$arr[$fname][0] = $fdata[0];
foreach (Feature::get(false) as $fname => $fdata) {
$features[$fname] = [];
$features[$fname][0] = $fdata[0];
foreach (array_slice($fdata, 1) as $f) {
$set = DI::config()->get('feature', $f[0], $f[3]);
$arr[$fname][1][] = [
$features[$fname][1][] = [
['feature_' . $f[0], $f[1], $set, $f[2]],
['featurelock_' . $f[0], DI::l10n()->t('Lock feature %s', $f[1]), $f[4], '']
];
@ -82,9 +81,10 @@ class Features extends BaseAdmin
$tpl = Renderer::getMarkupTemplate('admin/features.tpl');
$o = Renderer::replaceMacros($tpl, [
'$form_security_token' => parent::getFormSecurityToken("admin_manage_features"),
'$title' => DI::l10n()->t('Manage Additional Features'),
'$features' => $arr,
'$submit' => DI::l10n()->t('Save Settings'),
'$baseurl' => DI::baseUrl()->get(true),
'$title' => DI::l10n()->t('Manage Additional Features'),
'$features' => $features,
'$submit' => DI::l10n()->t('Save Settings'),
]);
return $o;

View File

@ -1,12 +1,11 @@
<div id="adminpage">
<h1>{{$title}}</h1>
<form action="admin/features" method="post" autocomplete="off">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<form action="{{$baseurl}}/admin/features" method="post" autocomplete="off">
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
{{foreach $features as $g => $f}}
<h3 class="settings-heading"><a href="javascript:;">{{$f.0}}</a></h3>
<h2 class="settings-heading"><a href="javascript:;">{{$f.0}}</a></h2>
<div class="settings-content-block">
{{foreach $f.1 as $fcat}}

View File

@ -1,22 +1,18 @@
<h1>{{$title}}</h1>
<form action="settings/features" method="post" autocomplete="off">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
{{foreach $features as $f}}
<h3 class="settings-heading"><a href="javascript:;">{{$f.0}}</a></h3>
<div class="settings-content-block">
{{foreach $f.1 as $fcat}}
{{include file="field_checkbox.tpl" field=$fcat}}
{{/foreach}}
<div class="settings-submit-wrapper" >
<input type="submit" name="submit" class="settings-features-submit" value="{{$submit}}" />
</div>
</div>
{{/foreach}}
{{foreach $features as $f}}
<h2 class="settings-heading"><a href="javascript:;">{{$f.0}}</a></h2>
<div class="settings-content-block">
{{foreach $f.1 as $fcat}}
{{include file="field_checkbox.tpl" field=$fcat}}
{{/foreach}}
<div class="settings-submit-wrapper">
<input type="submit" name="submit" class="settings-features-submit" value="{{$submit}}"/>
</div>
</div>
{{/foreach}}
</form>

View File

@ -2875,7 +2875,7 @@ details.profile-jot-net[open] summary:before {
/* Emulates Bootstrap display */
.settings-block {
margin: 0 -15px 5px;
margin: 0 0 5px;
color: #333;
background-color: rgba(255,255,255,0.95);
border-radius: 4px;

View File

@ -0,0 +1,34 @@
<div class="generic-page-wrapper">
<h1>{{$title}}</h1>
<form action="{{$baseurl}}/admin/features" method="post" autocomplete="off">
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
{{* We organize the settings in collapsable panel-groups *}}
<div class="panel-group panel-group-settings" id="settings" role="tablist" aria-multiselectable="true">
{{foreach $features as $g => $f}}
<div class="panel">
<div class="section-subtitle-wrapper panel-heading" role="tab" id="{{$g}}-settings-title">
<h2>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#settings" href="#{{$g}}-settings-content" aria-expanded="true" aria-controls="{{$g}}-settings-content">
{{$f.0}}
</a>
</h2>
</div>
<div id="{{$g}}-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{$g}}-settings-title">
<div class="panel-body">
{{foreach $f.1 as $fcat}}
<div class="settings-block">
{{include file="field_checkbox.tpl" field=$fcat.0}}
{{include file="field_checkbox.tpl" field=$fcat.1}}
</div>
{{/foreach}}
</div>
<div class="panel-footer">
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>
</div>
</div>
</div>
{{/foreach}}
</div>
</form>
</div>

View File

@ -1,31 +1,26 @@
<div class="generic-page-wrapper">
{{* include the title template for the settings title *}}
{{include file="section_title.tpl" title=$title }}
<h1>{{$title}}</h1>
<form action="settings/features" method="post" autocomplete="off">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
{{* We organize the settings in collapsable panel-groups *}}
<div class="panel-group panel-group-settings" id="settings" role="tablist" aria-multiselectable="true">
{{foreach $features as $g => $f}}
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="{{$g}}-settings-title">
<h4>
<div class="section-subtitle-wrapper panel-heading" role="tab" id="{{$g}}-settings-title">
<h2>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#settings" href="#{{$g}}-settings-content" aria-expanded="true" aria-controls="{{$g}}-settings-content">
{{$f.0}}
</a>
</h4>
</h2>
</div>
<div id="{{$g}}-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{$g}}-settings-title">
<div class="section-content-tools-wrapper">
<div class="panel-body">
{{foreach $f.1 as $fcat}}
{{include file="field_checkbox.tpl" field=$fcat}}
{{/foreach}}
<div class="form-group pull-right settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>
</div>
<div class="clear"></div>
</div>
<div class="panel-footer">
<button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>
</div>
</div>
</div>