From 5a48002575fd8d9ba4e788bef05964d8ee845972 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 26 Sep 2020 11:05:18 +0000 Subject: [PATCH 1/3] Account selector for the community page --- src/Module/Conversation/Community.php | 15 +++++++++++++++ view/templates/widget/community_accounts.tpl | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 view/templates/widget/community_accounts.tpl diff --git a/src/Module/Conversation/Community.php b/src/Module/Conversation/Community.php index c86bf9176..a23f60350 100644 --- a/src/Module/Conversation/Community.php +++ b/src/Module/Conversation/Community.php @@ -113,6 +113,21 @@ class Community extends BaseModule $o .= $pager->renderMinimal(count($items)); + DI::page()['aside'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/community_accounts.tpl'), [ + '$content' => self::$content, + '$title' => DI::l10n()->t('Accounts'), + '$all' => DI::l10n()->t('All Accounts'), + '$all_selected' => ($parameters['accounttype'] == '') ? 'selected' : '', + '$person' => DI::l10n()->t('Personal Accounts'), + '$person_selected' => ($parameters['accounttype'] == 'person') ? 'selected' : '', + '$organisation' => DI::l10n()->t('Organisation Accounts'), + '$organisation_selected' => ($parameters['accounttype'] == 'organisation') ? 'selected' : '', + '$news' => DI::l10n()->t('News Accounts'), + '$news_selected' => ($parameters['accounttype'] == 'news') ? 'selected' : '', + '$community' => DI::l10n()->t('Communities'), + '$community_selected' => ($parameters['accounttype'] == 'community') ? 'selected' : '', + ]); + if (Feature::isEnabled(local_user(), 'trending_tags')) { DI::page()['aside'] .= TrendingTags::getHTML(self::$content); } diff --git a/view/templates/widget/community_accounts.tpl b/view/templates/widget/community_accounts.tpl new file mode 100644 index 000000000..adc036106 --- /dev/null +++ b/view/templates/widget/community_accounts.tpl @@ -0,0 +1,11 @@ + From f936d937300da0fc531ce85f85b26881f91d4b17 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 26 Sep 2020 12:13:30 +0000 Subject: [PATCH 2/3] Moved "selected" check into the template --- src/Module/Conversation/Community.php | 20 ++++++++------------ view/templates/widget/community_accounts.tpl | 10 +++++----- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/Module/Conversation/Community.php b/src/Module/Conversation/Community.php index a23f60350..a79a33c44 100644 --- a/src/Module/Conversation/Community.php +++ b/src/Module/Conversation/Community.php @@ -114,18 +114,14 @@ class Community extends BaseModule $o .= $pager->renderMinimal(count($items)); DI::page()['aside'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/community_accounts.tpl'), [ - '$content' => self::$content, - '$title' => DI::l10n()->t('Accounts'), - '$all' => DI::l10n()->t('All Accounts'), - '$all_selected' => ($parameters['accounttype'] == '') ? 'selected' : '', - '$person' => DI::l10n()->t('Personal Accounts'), - '$person_selected' => ($parameters['accounttype'] == 'person') ? 'selected' : '', - '$organisation' => DI::l10n()->t('Organisation Accounts'), - '$organisation_selected' => ($parameters['accounttype'] == 'organisation') ? 'selected' : '', - '$news' => DI::l10n()->t('News Accounts'), - '$news_selected' => ($parameters['accounttype'] == 'news') ? 'selected' : '', - '$community' => DI::l10n()->t('Communities'), - '$community_selected' => ($parameters['accounttype'] == 'community') ? 'selected' : '', + '$title' => DI::l10n()->t('Accounts'), + '$content' => self::$content, + '$accounttype' => $parameters['accounttype'], + '$all' => DI::l10n()->t('All Accounts'), + '$person' => DI::l10n()->t('Personal Accounts'), + '$organisation' => DI::l10n()->t('Organisation Accounts'), + '$news' => DI::l10n()->t('News Accounts'), + '$community' => DI::l10n()->t('Communities'), ]); if (Feature::isEnabled(local_user(), 'trending_tags')) { diff --git a/view/templates/widget/community_accounts.tpl b/view/templates/widget/community_accounts.tpl index adc036106..884cbe4e1 100644 --- a/view/templates/widget/community_accounts.tpl +++ b/view/templates/widget/community_accounts.tpl @@ -2,10 +2,10 @@

{{$title}}

From 4504d3c32d716d31c125936e1023febf36473b89 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 26 Sep 2020 12:21:32 +0000 Subject: [PATCH 3/3] Using the equal sign --- view/templates/widget/community_accounts.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/view/templates/widget/community_accounts.tpl b/view/templates/widget/community_accounts.tpl index 884cbe4e1..704493765 100644 --- a/view/templates/widget/community_accounts.tpl +++ b/view/templates/widget/community_accounts.tpl @@ -3,9 +3,9 @@