From 6bb210ff7a016674d9428af959207451214170d8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 1 Apr 2020 18:27:14 -0400 Subject: [PATCH] Refactor features pages - Create frio template for admin features page - Fix header hierarchy --- src/Module/Admin/Features.php | 18 +++++----- view/templates/admin/features.tpl | 7 ++-- view/templates/settings/features.tpl | 28 +++++++-------- view/theme/frio/css/style.css | 2 +- view/theme/frio/templates/admin/features.tpl | 34 +++++++++++++++++++ .../frio/templates/settings/features.tpl | 23 +++++-------- 6 files changed, 68 insertions(+), 44 deletions(-) create mode 100644 view/theme/frio/templates/admin/features.tpl diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php index 46c0a1384e..a97bc0e7bb 100644 --- a/src/Module/Admin/Features.php +++ b/src/Module/Admin/Features.php @@ -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; diff --git a/view/templates/admin/features.tpl b/view/templates/admin/features.tpl index b1c8bad8fc..46a7abea26 100644 --- a/view/templates/admin/features.tpl +++ b/view/templates/admin/features.tpl @@ -1,12 +1,11 @@ -

{{$title}}

-
- + + {{foreach $features as $g => $f}} -

{{$f.0}}

+

{{$f.0}}

{{foreach $f.1 as $fcat}} diff --git a/view/templates/settings/features.tpl b/view/templates/settings/features.tpl index c69670b48d..e96daea2bd 100644 --- a/view/templates/settings/features.tpl +++ b/view/templates/settings/features.tpl @@ -1,22 +1,18 @@ -

{{$title}}

- - + -{{foreach $features as $f}} -

{{$f.0}}

-
- -{{foreach $f.1 as $fcat}} - {{include file="field_checkbox.tpl" field=$fcat}} -{{/foreach}} -
- -
-
-{{/foreach}} + {{foreach $features as $f}} +

{{$f.0}}

+
+ {{foreach $f.1 as $fcat}} + {{include file="field_checkbox.tpl" field=$fcat}} + {{/foreach}} +
+ +
+
+ {{/foreach}} - diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index d0a4c39e48..f5d9a1971e 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -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; diff --git a/view/theme/frio/templates/admin/features.tpl b/view/theme/frio/templates/admin/features.tpl new file mode 100644 index 0000000000..13db0a300c --- /dev/null +++ b/view/theme/frio/templates/admin/features.tpl @@ -0,0 +1,34 @@ +
+

{{$title}}

+
+ + {{* We organize the settings in collapsable panel-groups *}} +
+ {{foreach $features as $g => $f}} +
+ +
+
+ {{foreach $f.1 as $fcat}} +
+ {{include file="field_checkbox.tpl" field=$fcat.0}} + {{include file="field_checkbox.tpl" field=$fcat.1}} +
+ {{/foreach}} +
+ +
+
+ {{/foreach}} +
+ +
+
diff --git a/view/theme/frio/templates/settings/features.tpl b/view/theme/frio/templates/settings/features.tpl index 1db5fd9669..61fecf57f7 100644 --- a/view/theme/frio/templates/settings/features.tpl +++ b/view/theme/frio/templates/settings/features.tpl @@ -1,31 +1,26 @@
- {{* include the title template for the settings title *}} - {{include file="section_title.tpl" title=$title }} - - +

{{$title}}

- + {{* We organize the settings in collapsable panel-groups *}}
{{foreach $features as $g => $f}}
-
-
+
{{foreach $f.1 as $fcat}} {{include file="field_checkbox.tpl" field=$fcat}} {{/foreach}} - -
- -
-
+
+