]> git.mxchange.org Git - friendica.git/commitdiff
Refactor features pages
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 1 Apr 2020 22:27:14 +0000 (18:27 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 1 Apr 2020 23:06:10 +0000 (19:06 -0400)
- Create frio template for admin features page
- Fix header hierarchy

src/Module/Admin/Features.php
view/templates/admin/features.tpl
view/templates/settings/features.tpl
view/theme/frio/css/style.css
view/theme/frio/templates/admin/features.tpl [new file with mode: 0644]
view/theme/frio/templates/settings/features.tpl

index 46c0a1384e780cde53b573df6c3b523f3a5b1c41..a97bc0e7bb453b3090b875184d73f34092544168 100644 (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;
index b1c8bad8fc8cd25b2835c83187cf672fda28b61c..46a7abea2614357be2df5bbe8431a6d99063ec0c 100644 (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}}
index c69670b48d94ff0a2ed3ae30e6fc147c5123ac78..e96daea2bd4c2f15fdeb0b7c4a28966c9f314824 100644 (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>
-
index d0a4c39e481233c89c2e07edc5aae0b9435e3698..f5d9a1971e4d261361f266ef0081dc2cde6004aa 100644 (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;
diff --git a/view/theme/frio/templates/admin/features.tpl b/view/theme/frio/templates/admin/features.tpl
new file mode 100644 (file)
index 0000000..13db0a3
--- /dev/null
@@ -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>
index 1db5fd966906d1b3b056b3a9ee0b73d497465476..61fecf57f74c332058f0f5d999bae30fe2bbbd07 100644 (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>