Browse Source
Move to a two columns design for blogs and communities public pages
Move to a two columns design for blogs and communities public pages
Refactor and unify some views between the public and private widgetspull/992/head
19 changed files with 378 additions and 223 deletions
-
2CHANGELOG.md
-
3app/views/blog.tpl
-
3app/views/node.tpl
-
3app/widgets/Blog/blog.tpl
-
8app/widgets/CommunityAffiliations/CommunityAffiliations.php
-
37app/widgets/CommunityAffiliations/_communityaffiliations.tpl
-
38app/widgets/CommunityAffiliations/_communityaffiliations_subscriptions_list.tpl
-
19app/widgets/CommunityData/CommunityData.php
-
50app/widgets/CommunityData/_communitydata.tpl
-
49app/widgets/CommunityData/_communitydata_card.tpl
-
37app/widgets/CommunityDataPublic/CommunityDataPublic.php
-
12app/widgets/CommunityDataPublic/communitydatapublic.tpl
-
18app/widgets/ContactData/ContactData.php
-
139app/widgets/ContactData/_contactdata.tpl
-
86app/widgets/ContactData/_contactdata_card.tpl
-
48app/widgets/ContactData/_contactdata_subscriptions.tpl
-
5app/widgets/ContactData/contactdata.css
-
34app/widgets/ContactDataPublic/ContactDataPublic.php
-
10app/widgets/ContactDataPublic/contactdatapublic.tpl
@ -0,0 +1,38 @@ |
|||
<ul class="list card active thin"> |
|||
<li class="subheader"> |
|||
<div> |
|||
<p>{$c->__('communityaffiliation.subscriptions')}</p> |
|||
</div> |
|||
</li> |
|||
{loop="$subscriptions"} |
|||
<a href="{$c->route('contact', $value->jid)}"> |
|||
<li title="{$value->jid}"> |
|||
<span class="control icon gray"> |
|||
<i class="material-icons">chevron_right</i> |
|||
</span> |
|||
{if="$value->contact"} |
|||
{$url = $value->contact->getPhoto('m')} |
|||
{if="$url"} |
|||
<span class="primary icon bubble small" |
|||
style="background-image: url({$url});"> |
|||
</span> |
|||
{else} |
|||
<span class="primary icon bubble small color {$value->jid|stringToColor}"> |
|||
{$value->contact->truename|firstLetterCapitalize:true} |
|||
</span> |
|||
{/if} |
|||
<div> |
|||
<p class="normal">{$value->contact->truename}</p> |
|||
</div> |
|||
{else} |
|||
<span class="primary icon bubble small color {$value->jid|stringToColor}"> |
|||
{$value->jid|firstLetterCapitalize:true} |
|||
</span> |
|||
<div> |
|||
<p class="normal">{$value->jid}</p> |
|||
</div> |
|||
{/if} |
|||
</li> |
|||
</a> |
|||
{/loop} |
|||
</ul> |
@ -0,0 +1,49 @@ |
|||
{$url = $info->getPhoto('l')} |
|||
{if="$url"} |
|||
<ul class="list"> |
|||
<li class="block large"> |
|||
<div> |
|||
<p class="center"> |
|||
<img class="avatar" src="{$url}"/> |
|||
</p> |
|||
</div> |
|||
</li> |
|||
</ul> |
|||
{/if} |
|||
|
|||
<ul class="list block middle flex"> |
|||
<li class="block large"> |
|||
<div> |
|||
<p class="normal center line" title="{$info->name}"> |
|||
{if="$info->name"} |
|||
{$info->name} |
|||
{else} |
|||
{$info->node} |
|||
{/if} |
|||
</p> |
|||
{if="$info->description != null && trim($info->description) != ''"} |
|||
<p class="center" title="{$info->description}">{$info->description}</p> |
|||
{/if} |
|||
{if="$info->created"} |
|||
<p class="center"> |
|||
{$info->created|strtotime|prepareDate:true,true} |
|||
</p> |
|||
{/if} |
|||
<p class="center"> |
|||
<i class="material-icons">receipt</i> {$c->__('communitydata.num', $num)} |
|||
· |
|||
<i class="material-icons">people</i> {$c->__('communitydata.sub', $info->occupants)} |
|||
</p> |
|||
{if="$info->pubsubpublishmodel == 'publishers'"} |
|||
<p class="center"> |
|||
<i class="material-icons">assignment_ind</i> {$c->__('communitydata.publishmodel_publishers')} |
|||
</p> |
|||
{/if} |
|||
{if="$info->pubsubpublishmodel == 'subscribers'"} |
|||
<p class="center"> |
|||
<i class="material-icons">assignment_turned_in</i> {$c->__('communitydata.publishmodel_subscribers')} |
|||
</p> |
|||
{/if} |
|||
</div> |
|||
</li> |
|||
</ul> |
@ -0,0 +1,37 @@ |
|||
<?php |
|||
|
|||
use Movim\Widget\Base; |
|||
|
|||
include_once WIDGETS_PATH.'CommunityData/CommunityData.php'; |
|||
include_once WIDGETS_PATH.'CommunityAffiliations/CommunityAffiliations.php'; |
|||
|
|||
class CommunityDataPublic extends Base |
|||
{ |
|||
public function prepareCard($info) |
|||
{ |
|||
return (new CommunityData)->prepareCard($info); |
|||
} |
|||
|
|||
public function prepareSubscriptions($subscriptions) |
|||
{ |
|||
return (new CommunityAffiliations)->prepareSubscriptionsList($subscriptions); |
|||
} |
|||
|
|||
public function display() |
|||
{ |
|||
$server = $this->get('s'); |
|||
$node = $this->get('n'); |
|||
|
|||
$info = \App\Info::where('server', $server) |
|||
->where('node', $node) |
|||
->first(); |
|||
|
|||
$subscriptions = \App\Subscription::where('server', $server) |
|||
->where('node', $node) |
|||
->where('public', true) |
|||
->get(); |
|||
|
|||
$this->view->assign('subscriptions', $subscriptions); |
|||
$this->view->assign('info', $info); |
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
<ul id="community_data_public" class="list card"> |
|||
<br /> |
|||
{autoescape="off"} |
|||
{$c->prepareCard($info)} |
|||
{/autoescape} |
|||
|
|||
{if="$subscriptions->isNotEmpty()"} |
|||
{autoescape="off"} |
|||
{$c->prepareSubscriptions($subscriptions)} |
|||
{/autoescape} |
|||
{/if} |
|||
</ul> |
@ -0,0 +1,86 @@ |
|||
{$url = $contact->getPhoto('l')} |
|||
{if="$url"} |
|||
<ul class="list middle"> |
|||
<li> |
|||
<div> |
|||
<p class="center"> |
|||
<img class="avatar" src="{$url}"> |
|||
</p> |
|||
</div> |
|||
</li> |
|||
</ul> |
|||
{/if} |
|||
|
|||
<div class="block"> |
|||
<ul class="list middle"> |
|||
<li> |
|||
<div> |
|||
<p class="normal center "> |
|||
{$contact->truename} |
|||
{if="isset($roster) && isset($roster->presence)"} |
|||
<span class="second">{$roster->presence->presencetext}</span> |
|||
{/if} |
|||
</p> |
|||
|
|||
{if="$roster && $roster->presence && $roster->presence->seen"} |
|||
<p class="center"> |
|||
<span class="second"> |
|||
{$c->__('last.title')} {$roster->presence->seen|strtotime|prepareDate:true,true} |
|||
</span> |
|||
</p> |
|||
{/if} |
|||
{if="$contact->email"} |
|||
<p class="center"><a href="mailto:{$contact->email}">{$contact->email}</a></p> |
|||
{/if} |
|||
{if="$contact->description != null && trim($contact->description) != ''"} |
|||
<p class="center all" title="{$contact->description}"> |
|||
{autoescape="off"} |
|||
{$contact->description|nl2br|addEmojis} |
|||
{/autoescape} |
|||
</p> |
|||
{/if} |
|||
</div> |
|||
</li> |
|||
<!--<li> |
|||
<span class="primary icon gray"> |
|||
<i class="material-icons">accounts</i> |
|||
</span> |
|||
<p class="normal">{$c->__('communitydata.sub', 0)}</p> |
|||
</li>--> |
|||
</ul> |
|||
|
|||
{if="$contact->url != null"} |
|||
<ul class="list thin"> |
|||
<li> |
|||
<span class="primary icon gray"><i class="material-icons">link</i></span> |
|||
<div> |
|||
<p class="normal line"> |
|||
{if="filter_var($contact->url, FILTER_VALIDATE_URL)"} |
|||
<a href="{$contact->url}" target="_blank">{$contact->url}</a> |
|||
{else} |
|||
{$contact->url} |
|||
{/if} |
|||
</p> |
|||
</div> |
|||
</li> |
|||
</ul> |
|||
{/if} |
|||
|
|||
{if="$contact->adrlocality != null || $contact->adrcountry != null"} |
|||
<ul class="list middle"> |
|||
<li> |
|||
<span class="primary icon gray"><i class="material-icons">location_city</i></span> |
|||
<div> |
|||
{if="$contact->adrlocality != null"} |
|||
<p class="normal">{$contact->adrlocality}</p> |
|||
{/if} |
|||
{if="$contact->adrcountry != null"} |
|||
<p {if="$contact->adrlocality == null"}class="normal"{/if}> |
|||
{$contact->adrcountry} |
|||
</p> |
|||
{/if} |
|||
</div> |
|||
</li> |
|||
</ul> |
|||
{/if} |
|||
</div> |
@ -0,0 +1,48 @@ |
|||
{if="count($subscriptions) > 0"} |
|||
<ul class="list active large"> |
|||
<li class="subheader large"> |
|||
<div> |
|||
<p> |
|||
<span class="info">{$subscriptions|count}</span> |
|||
{$c->__('page.communities')} |
|||
</p> |
|||
</div> |
|||
</li> |
|||
{loop="$subscriptions"} |
|||
<a href="{$c->route('community', [$value->server, $value->node])}"> |
|||
<li title="{$value->server} - {$value->node}"> |
|||
{if="$value->info"} |
|||
{$url = $value->info->getPhoto('m')} |
|||
{/if} |
|||
|
|||
{if="$url"} |
|||
<span class="primary icon bubble"> |
|||
<img src="{$url}"/> |
|||
</span> |
|||
{else} |
|||
<span class="primary icon bubble color {$value->node|stringToColor}"> |
|||
{$value->node|firstLetterCapitalize} |
|||
</span> |
|||
{/if} |
|||
<span class="control icon gray"> |
|||
<i class="material-icons">chevron_right</i> |
|||
</span> |
|||
<div> |
|||
<p class="line normal"> |
|||
{if="$value->info && $value->info->name"} |
|||
{$value->info->name} |
|||
{elseif="$value->name"} |
|||
{$value->name} |
|||
{else} |
|||
{$value->node} |
|||
{/if} |
|||
</p> |
|||
{if="$value->info && $value->info->description"} |
|||
<p class="line">{$value->info->description|strip_tags}</p> |
|||
{/if} |
|||
</div> |
|||
</li> |
|||
</a> |
|||
{/loop} |
|||
</ul> |
|||
{/if} |
@ -1,5 +0,0 @@ |
|||
.contact_data ul.list:first-child li:first-child img.avatar { |
|||
height: 25rem; |
|||
margin-left: 5rem; |
|||
display: inline-block; |
|||
} |
@ -0,0 +1,34 @@ |
|||
<?php |
|||
|
|||
use Movim\Widget\Base; |
|||
|
|||
include_once WIDGETS_PATH.'ContactData/ContactData.php'; |
|||
|
|||
class ContactDataPublic extends Base |
|||
{ |
|||
public function prepareCard($contact) |
|||
{ |
|||
return (new ContactData)->prepareCard($contact); |
|||
} |
|||
|
|||
public function prepareSubscriptions($subscriptions) |
|||
{ |
|||
return (new ContactData)->prepareSubscriptions($subscriptions); |
|||
} |
|||
|
|||
public function display() |
|||
{ |
|||
$jid = $this->get('f'); |
|||
|
|||
$user = \App\User::where('nickname', $jid)->first(); |
|||
if ($user) { |
|||
$jid = $user->id; |
|||
} |
|||
|
|||
$this->view->assign('contact', App\Contact::firstOrNew(['id' => $jid])); |
|||
$this->view->assign('subscriptions', \App\Subscription::where('jid', $jid) |
|||
->where('public', true) |
|||
->get()); |
|||
$this->view->assign('jid', $jid); |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
<ul id="contact_public_data" class="contact_data list card"> |
|||
<br /> |
|||
{autoescape="off"} |
|||
{$c->prepareCard($contact)} |
|||
{/autoescape} |
|||
|
|||
{autoescape="off"} |
|||
{$c->prepareSubscriptions($subscriptions)} |
|||
{/autoescape} |
|||
</ul> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue