Create new page_tabs template

- Replace explicit tabs in profile contacts page with new template
This commit is contained in:
Hypolite Petovan 2020-08-06 10:34:11 -04:00
parent f5ea07c731
commit 383ddb10ed
8 changed files with 57 additions and 49 deletions

View file

@ -53,8 +53,6 @@ class Common extends BaseProfile
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
$o = self::getTabsHTML($a, 'contacts', false, $nickname);
if (!empty($a->profile['hide-friends'])) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
}
@ -65,6 +63,10 @@ class Common extends BaseProfile
$a->redirect('profile/' . $nickname . '/contacts');
};
$o = self::getTabsHTML($a, 'contacts', false, $nickname);
$tabs = self::getContactFilterTabs('profile/' . $nickname, 'common', $displayCommonTab);
$sourceId = Contact::getIdForURL(Profile::getMyURL());
$targetId = Contact::getPublicIdByUserId($a->profile['uid']);
@ -92,15 +94,8 @@ class Common extends BaseProfile
$o .= Renderer::replaceMacros($tpl, [
'$title' => $title,
'$desc' => $desc,
'$nickname' => $nickname,
'$type' => 'common',
'$displayCommonTab' => $displayCommonTab,
'$tabs' => $tabs,
'$all_label' => DI::l10n()->t('All contacts'),
'$followers_label' => DI::l10n()->t('Followers'),
'$following_label' => DI::l10n()->t('Following'),
'$mutuals_label' => DI::l10n()->t('Mutual friends'),
'$common_label' => DI::l10n()->t('Common'),
'$noresult_label' => DI::l10n()->t('No common contacts.'),
'$contacts' => $contacts,

View file

@ -61,6 +61,8 @@ class Contacts extends Module\BaseProfile
$o = self::getTabsHTML($a, 'contacts', $is_owner, $nickname);
$tabs = self::getContactFilterTabs('profile/' . $nickname, $type, Session::isAuthenticated() && $a->profile['uid'] != local_user());
$condition = [
'uid' => $a->profile['uid'],
'blocked' => false,
@ -113,15 +115,8 @@ class Contacts extends Module\BaseProfile
$o .= Renderer::replaceMacros($tpl, [
'$title' => $title,
'$desc' => $desc,
'$nickname' => $nickname,
'$type' => $type,
'$displayCommonTab' => Session::isAuthenticated() && $a->profile['uid'] != local_user(),
'$tabs' => $tabs,
'$all_label' => DI::l10n()->t('All contacts'),
'$followers_label' => DI::l10n()->t('Followers'),
'$following_label' => DI::l10n()->t('Following'),
'$mutuals_label' => DI::l10n()->t('Mutual friends'),
'$common_label' => DI::l10n()->t('Common'),
'$noresult_label' => DI::l10n()->t('No contacts.'),
'$contacts' => $contacts,