mirror of
https://github.com/friendica/friendica
synced 2025-02-05 16:58:51 +00:00
Show Create new Group link in widget even if there's no group membership to display
This commit is contained in:
parent
c426b27287
commit
354e3adc04
2 changed files with 76 additions and 77 deletions
|
@ -97,22 +97,19 @@ class GroupManager
|
|||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
public static function widget(int $uid)
|
||||
public static function widget(int $uid): string
|
||||
{
|
||||
$o = '';
|
||||
|
||||
//sort by last updated item
|
||||
$lastitem = true;
|
||||
|
||||
$contacts = self::getList($uid, $lastitem, true, true);
|
||||
$contacts = self::getList($uid, true, true, true);
|
||||
$total = count($contacts);
|
||||
$visibleGroups = 10;
|
||||
|
||||
if (DBA::isResult($contacts)) {
|
||||
$id = 0;
|
||||
|
||||
$entries = [];
|
||||
|
||||
$contacts = [];
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
$entry = [
|
||||
'url' => 'contact/' . $contact['id'] . '/conversations',
|
||||
|
@ -127,7 +124,7 @@ class GroupManager
|
|||
|
||||
$tpl = Renderer::getMarkupTemplate('widget/group_list.tpl');
|
||||
|
||||
$o .= Renderer::replaceMacros(
|
||||
return Renderer::replaceMacros(
|
||||
$tpl,
|
||||
[
|
||||
'$title' => DI::l10n()->t('Groups'),
|
||||
|
@ -138,13 +135,11 @@ class GroupManager
|
|||
'$visible_groups' => $visibleGroups,
|
||||
'$showless' => DI::l10n()->t('show less'),
|
||||
'$showmore' => DI::l10n()->t('show more'),
|
||||
'$create_new_group' => DI::l10n()->t('Create new group')]
|
||||
'$create_new_group' => DI::l10n()->t('Create new group')
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format group list as contact block
|
||||
*
|
||||
|
|
|
@ -18,17 +18,19 @@ function showHideGroupList() {
|
|||
}
|
||||
</script>
|
||||
<span id="group-list-sidebar-frame">
|
||||
<span id="group-list-sidebar-inflated" class="widget inflated fakelink" onclick="openCloseWidget('group-list-sidebar', 'group-list-sidebar-inflated');">
|
||||
<span id="group-list-sidebar-inflated" class="widget inflated fakelink" onclick="openCloseWidget('group-list-sidebar', 'group-list-sidebar-inflated');">
|
||||
<h3>{{$title}}</h3>
|
||||
</span>
|
||||
<div id="group-list-sidebar" class="widget">
|
||||
<div id="sidebar-group-header" class="sidebar-widget-header">
|
||||
</span>
|
||||
<div id="group-list-sidebar" class="widget">
|
||||
<div id="sidebar-group-header" class="sidebar-widget-header">
|
||||
<span class="fakelink" onclick="openCloseWidget('group-list-sidebar', 'group-list-sidebar-inflated');">
|
||||
<h3>{{$title}}</h3>
|
||||
</span>
|
||||
{{if $groups}}
|
||||
<a class="group-new-tool pull-right widget-action faded-icon" id="sidebar-new-group" href="{{$new_group_page}}" data-toggle="tooltip" title="{{$create_new_group}}">
|
||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div id="sidebar-group-list" class="sidebar-widget-list">
|
||||
{{* The list of available groups *}}
|
||||
|
@ -53,14 +55,16 @@ function showHideGroupList() {
|
|||
<a class="group-widget-link" id="group-widget-link-{{$group.id}}" href="{{$group.url}}">{{$group.name}}</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{foreachelse}}
|
||||
<li><a href="{{$new_group_page}}"><i class="fa fa-plus" aria-hidden="true"></i> {{$create_new_group}}</a></li>
|
||||
{{/foreach}}
|
||||
|
||||
{{if $total > $visible_groups }}
|
||||
<li onclick="showHideGroupList(); return false;" id="group-widget-collapse" class="group-widget-link fakelink tool">{{$showmore}}</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
<script>
|
||||
initWidget('group-list-sidebar', 'group-list-sidebar-inflated');
|
||||
|
|
Loading…
Add table
Reference in a new issue