mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:00:16 +00:00
Move self key to $profile tamplate variable in hovercard.tpl template
- Simplify network and mention menu items by checking for group in Model\Contact::photoMenu
This commit is contained in:
parent
05f2cf9202
commit
cf5beafec0
3 changed files with 27 additions and 12 deletions
|
@ -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'])) {
|
||||
|
|
|
@ -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'],
|
||||
],
|
||||
]);
|
||||
|
||||
|
|
|
@ -21,13 +21,22 @@
|
|||
{{* 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}}
|
||||
|
|
Loading…
Reference in a new issue