]> git.mxchange.org Git - friendica.git/commitdiff
Move self key to $profile tamplate variable in hovercard.tpl template
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 3 Oct 2023 01:34:49 +0000 (21:34 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 3 Oct 2023 01:34:49 +0000 (21:34 -0400)
- Simplify network and mention menu items by checking for group in Model\Contact::photoMenu

src/Model/Contact.php
src/Module/Contact/Hovercard.php
view/templates/hovercard.tpl

index 48f201e8c24b723f752de7252a891a7d9ef322a2..3e547fcaffcd9c6e2fb60440fcf2ab5d3c83859d 100644 (file)
@@ -1199,14 +1199,22 @@ class Contact
                }
 
                if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
+                       $mention_label = DI::l10n()->t('Post to group');
                        $mention_url = 'compose/0?body=!' . $contact['addr'];
                } else {
+                       $mention_label = DI::l10n()->t('Mention');
                        $mention_url = 'compose/0?body=@' . $contact['addr'];
                }
 
                $contact_url = 'contact/' . $contact['id'];
-               $posts_link = 'contact/' . $contact['id'] . '/conversations';
-               $group_link = 'network/group/' . $contact['id'];
+
+               if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
+                       $network_label = DI::l10n()->t('View group');
+                       $network_url = 'network/group/' . $contact['id'];
+               } else {
+                       $network_label = DI::l10n()->t('Network Posts');
+                       $network_url = 'contact/' . $contact['id'] . '/conversations';
+               }
 
                $follow_link   = '';
                $unfollow_link = '';
@@ -1227,26 +1235,23 @@ class Contact
                if (empty($contact['uid'])) {
                        $menu = [
                                'profile'  => [DI::l10n()->t('View Profile'), $profile_link, true],
-                               'network'  => [DI::l10n()->t('Network Posts'), $posts_link, false],
+                               'network'  => [$network_label, $network_url, false],
                                'edit'     => [DI::l10n()->t('View Contact'), $contact_url, false],
                                'follow'   => [DI::l10n()->t('Connect/Follow'), $follow_link, true],
                                'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true],
-                               'mention'  => [DI::l10n()->t('Mention'), DI::l10n()->t('Post to group'), $mention_url, false],
-                               'group'    => [DI::l10n()->t('View group'), $group_link, $contact['forum'], true],
+                               'mention'  => [$mention_label, $mention_url, false],
                        ];
                } else {
                        $menu = [
                                'status'   => [DI::l10n()->t('View Status'), $status_link, true],
                                'profile'  => [DI::l10n()->t('View Profile'), $profile_link, true],
                                'photos'   => [DI::l10n()->t('View Photos'), $photos_link, true],
-                               'network'  => [DI::l10n()->t('Network Posts'), $posts_link, false],
+                               'network'  => [$network_label, $network_url, false],
                                'edit'     => [DI::l10n()->t('View Contact'), $contact_url, false],
                                'pm'       => [DI::l10n()->t('Send PM'), $pm_url, false],
                                'follow'   => [DI::l10n()->t('Connect/Follow'), $follow_link, true],
                                'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true],
-                               'mention'  => [DI::l10n()->t('Mention'), DI::l10n()->t('Post to group'), $mention_url, false],
-                               'group'    => [DI::l10n()->t('View group'), $group_link, $contact['forum'], true],
-                               'self'     => [$contact['self'] ?? false, true],
+                               'mention'  => [$mention_label, $mention_url, false],
                        ];
 
                        if (!empty($contact['pending'])) {
index 9f2fb67bdbabec6917cc0e248d884e384800c740..1ca91d056f32b487890f0723885b1692fe8d809e 100644 (file)
@@ -112,6 +112,7 @@ class Hovercard extends BaseModule
                                'bd'           => $contact['bd'] <= DBA::NULL_DATE ? '' : $contact['bd'],
                                'account_type' => Contact::getAccountType($contact['contact-type']),
                                'actions'      => $actions,
+                               'self'         => $contact['self'],
                        ],
                ]);
 
index a7814e5660fc8a54352fbacf6eae68ff25708545..70a341035d5b1bbd1aa20a7831c3d15c6299cddc 100644 (file)
                                {{* here are the different actions like private message, delete and so on *}}
                                {{* @todo we have two different photo menus one for contacts and one for items at the network stream. We currently use the contact photo menu, so the items options are missing We need to move them *}}
                                <div class="hover-card-actions-social">
-                                       {{if $profile.actions.pm}}<a class="btn btn-labeled btn-primary btn-sm add-to-modal" href="{{$profile.actions.pm.1}}" aria-label="{{$profile.actions.pm.0}}"><i class="fa fa-envelope" aria-hidden="true" title="{{$profile.actions.pm.0}}"></i><span class="sr-only">{{$profile.actions.pm.0}}</span></a>{{/if}}
+                               {{if $profile.actions.pm}}
+                                       <a class="btn btn-labeled btn-primary btn-sm add-to-modal" href="{{$profile.actions.pm.1}}" title="{{$profile.actions.pm.0}}">
+                                               <i class="fa fa-envelope" aria-hidden="true"></i>
+                                               <span class="sr-only">{{$profile.actions.pm.0}}</span>
+                                       </a>
+                               {{/if}}
 
-                                       {{if $profile.addr && !$profile.actions.self.0}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.mention.2}}" aria-label="{{if $profile.actions.group.2==1}}{{$profile.actions.mention.1}}{{else}}{{$profile.actions.mention.0}}{{/if}}" title="{{if $profile.actions.group.2==1}}{{$profile.actions.mention.1}}{{else}}{{$profile.actions.mention.0}}{{/if}}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>{{/if}}
+                               {{if $profile.addr && !$profile.self}}
+                                       <a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.mention.1}}" title="{{$profile.actions.mention.0}}">
+                                               <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
+                                               <span class="sr-only">{{$profile.actions.mention.0}}</span>
+                                       </a>
+                               {{/if}}
 
                                </div>
                                <div class="hover-card-actions-connection">
-                                       {{if $profile.actions.group.2==1}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.group.1}}" aria-label="{{$profile.actions.group.0}}" title="{{$profile.actions.group.0}}"><i class="fa fa-group" aria-hidden="true"></i></a>{{/if}}
                                        {{if $profile.actions.network}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.network.1}}" aria-label="{{$profile.actions.network.0}}" title="{{$profile.actions.network.0}}"><i class="fa fa-cloud" aria-hidden="true"></i></a>{{/if}}
                                        {{if $profile.actions.edit}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.edit.1}}" aria-label="{{$profile.actions.edit.0}}" title="{{$profile.actions.edit.0}}"><i class="fa fa-user" aria-hidden="true"></i></a>{{/if}}
                                        {{if $profile.actions.follow}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.follow.1}}" aria-label="{{$profile.actions.follow.0}}" title="{{$profile.actions.follow.0}}"><i class="fa fa-user-plus" aria-hidden="true"></i></a>{{/if}}