]> git.mxchange.org Git - friendica.git/commitdiff
Frio: Improved user defined channel page
authorMichael <heluecht@pirati.ca>
Sat, 16 Dec 2023 21:43:01 +0000 (21:43 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 16 Dec 2023 21:43:01 +0000 (21:43 +0000)
src/Module/Settings/Channels.php
view/theme/frio/templates/settings/channels.tpl [new file with mode: 0644]

index 5c638c85083bfc0700e0781bb864fa11b90158ff..2595a84372afdf6fa1087d733792551c3035a356 100644 (file)
@@ -125,9 +125,11 @@ class Channels extends BaseSettings
                        $circles[$circle['id']] = $circle['name'];
                }
 
-               $blocklistform = [];
+               $id       = 0;
+               $channels = [];
                foreach ($this->channel->selectByUid($uid) as $channel) {
-                       $blocklistform[] = [
+                       $channels[] = [
+                               'id'           => ++$id,
                                'label'        => ["label[$channel->code]", $this->t('Label'), $channel->label, '', $this->t('Required')],
                                'description'  => ["description[$channel->code]", $this->t("Description"), $channel->description],
                                'access_key'   => ["access_key[$channel->code]", $this->t("Access Key"), $channel->accessKey],
@@ -166,7 +168,7 @@ class Channels extends BaseSettings
                                'delentry'       => $this->t('Delete entry from the channel list'),
                                'confirm_delete' => $this->t('Delete entry from the channel list?'),
                        ],
-                       '$entries' => $blocklistform,
+                       '$entries' => $channels,
                        '$baseurl' => $this->baseUrl,
 
                        '$form_security_token' => self::getFormSecurityToken('settings_channels'),
diff --git a/view/theme/frio/templates/settings/channels.tpl b/view/theme/frio/templates/settings/channels.tpl
new file mode 100644 (file)
index 0000000..d4ef83f
--- /dev/null
@@ -0,0 +1,64 @@
+<div class="generic-page-wrapper">
+       <h1>{{$l10n.title}}</h1>
+       <p>{{$l10n.intro}}</p>
+       <div class="panel-group panel-group-settings" id="settings-channels" role="tablist" aria-multiselectable="true">
+               <form class="panel" action="{{$baseurl}}/settings/channels" method="post">
+                       <div class="section-subtitle-wrapper panel-heading" role="tab" id="add-settings-title">
+                               <h2>
+                                       <button class="btn-link accordion-toggle collapsed" data-toggle="collapse" data-parent="#settings-channels" href="#add-settings-content" aria-expanded="false" aria-controls="add-settings-content">
+                                               {{$l10n.addtitle}}
+                                       </button>
+                               </h2>
+                       </div>
+                       <div id="add-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="add-settings-title">
+                               <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+                               {{include file="field_input.tpl" field=$label}}
+                               {{include file="field_input.tpl" field=$description}}
+                               {{include file="field_input.tpl" field=$access_key}}
+                               {{include file="field_select.tpl" field=$circle}}
+                               {{include file="field_textarea.tpl" field=$include_tags}}
+                               {{include file="field_textarea.tpl" field=$exclude_tags}}
+                               {{include file="field_textarea.tpl" field=$text_search}}
+                               {{include file="field_checkbox.tpl" field=$image}}
+                               {{include file="field_checkbox.tpl" field=$video}}
+                               {{include file="field_checkbox.tpl" field=$audio}}
+                               <div class="submit">
+                                       <button type="submit" class="btn btn-primary" name="add_channel" value="{{$l10n.addsubmit}}">{{$l10n.addsubmit}}</button>
+                               </div>
+                       </div>
+               </form>
+
+               {{if $entries}}
+                       <form action="{{$baseurl}}/settings/channels" method="post">
+                       <input type="hidden" name="form_security_token" value="{{$form_security_token}}">
+                       {{foreach $entries as $e}}
+                               <div class="panel">
+                                       <div class="section-subtitle-wrapper panel-heading" role="tab" id="{{$e.id}}-settings-title">
+                                               <h2>
+                                                       <button class="btn-link accordion-toggle collapsed" data-toggle="collapse" data-parent="#settings-channels" href="#{{$e.id}}-settings-content" aria-expanded="false" aria-controls="{{$e.id}}-settings-content">
+                                                               {{$e.label.2}}
+                                                       </button>
+                                               </h2>
+                                       </div>
+                                       <div id="{{$e.id}}-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{$e.id}}-settings-title">
+                                               {{include file="field_input.tpl" field=$e.label}}
+                                               {{include file="field_input.tpl" field=$e.description}}
+                                               {{include file="field_input.tpl" field=$e.access_key}}
+                                               {{include file="field_select.tpl" field=$e.circle}}
+                                               {{include file="field_textarea.tpl" field=$e.include_tags}}
+                                               {{include file="field_textarea.tpl" field=$e.exclude_tags}}
+                                               {{include file="field_textarea.tpl" field=$e.text_search}}
+                                               {{include file="field_checkbox.tpl" field=$e.image}}
+                                               {{include file="field_checkbox.tpl" field=$e.video}}
+                                               {{include file="field_checkbox.tpl" field=$e.audio}}
+                                               {{include file="field_checkbox.tpl" field=$e.delete}}
+                                               <div class="submit">
+                                                       <button type="submit" class="btn btn-primary" name="edit_channel" value="{{$l10n.savechanges}}">{{$l10n.savechanges}}</button>
+                                               </div>
+                                       </div>
+                               </div>
+                       {{/foreach}}
+                       {{/if}}
+               </form>
+       </div>
+</div>