mirror of
https://github.com/friendica/friendica
synced 2025-01-30 18:19:47 +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 \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
* @throws \ImagickException
|
* @throws \ImagickException
|
||||||
*/
|
*/
|
||||||
public static function widget(int $uid)
|
public static function widget(int $uid): string
|
||||||
{
|
{
|
||||||
$o = '';
|
|
||||||
|
|
||||||
//sort by last updated item
|
//sort by last updated item
|
||||||
$lastitem = true;
|
$contacts = self::getList($uid, true, true, true);
|
||||||
|
|
||||||
$contacts = self::getList($uid, $lastitem, true, true);
|
|
||||||
$total = count($contacts);
|
$total = count($contacts);
|
||||||
$visibleGroups = 10;
|
$visibleGroups = 10;
|
||||||
|
|
||||||
if (DBA::isResult($contacts)) {
|
|
||||||
$id = 0;
|
$id = 0;
|
||||||
|
|
||||||
$entries = [];
|
$entries = [];
|
||||||
|
|
||||||
|
$contacts = [];
|
||||||
|
|
||||||
foreach ($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
$entry = [
|
$entry = [
|
||||||
'url' => 'contact/' . $contact['id'] . '/conversations',
|
'url' => 'contact/' . $contact['id'] . '/conversations',
|
||||||
|
@ -127,7 +124,7 @@ class GroupManager
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('widget/group_list.tpl');
|
$tpl = Renderer::getMarkupTemplate('widget/group_list.tpl');
|
||||||
|
|
||||||
$o .= Renderer::replaceMacros(
|
return Renderer::replaceMacros(
|
||||||
$tpl,
|
$tpl,
|
||||||
[
|
[
|
||||||
'$title' => DI::l10n()->t('Groups'),
|
'$title' => DI::l10n()->t('Groups'),
|
||||||
|
@ -138,13 +135,11 @@ class GroupManager
|
||||||
'$visible_groups' => $visibleGroups,
|
'$visible_groups' => $visibleGroups,
|
||||||
'$showless' => DI::l10n()->t('show less'),
|
'$showless' => DI::l10n()->t('show less'),
|
||||||
'$showmore' => DI::l10n()->t('show more'),
|
'$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
|
* Format group list as contact block
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,17 +18,19 @@ function showHideGroupList() {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<span id="group-list-sidebar-frame">
|
<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>
|
<h3>{{$title}}</h3>
|
||||||
</span>
|
</span>
|
||||||
<div id="group-list-sidebar" class="widget">
|
<div id="group-list-sidebar" class="widget">
|
||||||
<div id="sidebar-group-header" class="sidebar-widget-header">
|
<div id="sidebar-group-header" class="sidebar-widget-header">
|
||||||
<span class="fakelink" onclick="openCloseWidget('group-list-sidebar', 'group-list-sidebar-inflated');">
|
<span class="fakelink" onclick="openCloseWidget('group-list-sidebar', 'group-list-sidebar-inflated');">
|
||||||
<h3>{{$title}}</h3>
|
<h3>{{$title}}</h3>
|
||||||
</span>
|
</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}}">
|
<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>
|
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div id="sidebar-group-list" class="sidebar-widget-list">
|
<div id="sidebar-group-list" class="sidebar-widget-list">
|
||||||
{{* The list of available groups *}}
|
{{* 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>
|
<a class="group-widget-link" id="group-widget-link-{{$group.id}}" href="{{$group.url}}">{{$group.name}}</a>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{foreachelse}}
|
||||||
|
<li><a href="{{$new_group_page}}"><i class="fa fa-plus" aria-hidden="true"></i> {{$create_new_group}}</a></li>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
{{if $total > $visible_groups }}
|
{{if $total > $visible_groups }}
|
||||||
<li onclick="showHideGroupList(); return false;" id="group-widget-collapse" class="group-widget-link fakelink tool">{{$showmore}}</li>
|
<li onclick="showHideGroupList(); return false;" id="group-widget-collapse" class="group-widget-link fakelink tool">{{$showmore}}</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
<script>
|
<script>
|
||||||
initWidget('group-list-sidebar', 'group-list-sidebar-inflated');
|
initWidget('group-list-sidebar', 'group-list-sidebar-inflated');
|
||||||
|
|
Loading…
Add table
Reference in a new issue