Clean Space Chooser view

This commit is contained in:
Carlos Ferreira 2018-03-11 12:23:41 +01:00 committed by GitHub
parent 5a8277ef95
commit 16756f5655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,12 +1,15 @@
<?php
/* @var $this \humhub\components\WebView */
/* @var $currentSpace \humhub\modules\space\models\Space */
use humhub\modules\space\assets\SpaceChooserAsset;
use humhub\modules\space\widgets\SpaceChooserItem;
use humhub\modules\space\widgets\Image;
use yii\helpers\Url;
use yii\helpers\Html;
use humhub\modules\space\widgets\SpaceChooserItem;
\humhub\modules\space\assets\SpaceChooserAsset::register($this);
SpaceChooserAsset::register($this);
$noSpaceView = '<div class="no-space"><i class="fa fa-dot-circle-o"></i><br>' . Yii::t('SpaceModule.widgets_views_spaceChooser', 'My spaces') . '<b class="caret"></b></div>';
@ -25,13 +28,13 @@ $this->registerJsConfig('space.chooser', [
<a href="#" id="space-menu" class="dropdown-toggle" data-toggle="dropdown">
<!-- start: Show space image and name if chosen -->
<?php if ($currentSpace) : ?>
<?=
\humhub\modules\space\widgets\Image::widget([
<?= Image::widget([
'space' => $currentSpace,
'width' => 32,
'htmlOptions' => [
'class' => 'current-space-image',
]]);
]
]);
?>
<b class="caret"></b>
<?php endif; ?>
@ -40,8 +43,8 @@ $this->registerJsConfig('space.chooser', [
<?= $noSpaceView ?>
<?php endif; ?>
<!-- end: Show space image and name if chosen -->
</a>
<ul class="dropdown-menu" id="space-menu-dropdown">
<li>
<form action="" class="dropdown-controls">
@ -51,7 +54,7 @@ $this->registerJsConfig('space.chooser', [
title="<?= Yii::t('SpaceModule.widgets_views_spaceChooser', 'Search for spaces'); ?>">
<span id="space-directory-link" class="input-group-addon" >
<a href="<?= Url::to(['/directory/directory/spaces']); ?>">
<i class="fa fa-book"></i>
<i class="fa fa-book"></i>
</a>
</span>
<div class="search-reset" id="space-search-reset"><i class="fa fa-times-circle"></i></div>
@ -62,11 +65,20 @@ $this->registerJsConfig('space.chooser', [
<li class="divider"></li>
<li>
<ul class="media-list notLoaded" id="space-menu-spaces">
<?php foreach ($memberships as $membership): ?>
<?= SpaceChooserItem::widget(['space' => $membership->space, 'updateCount' => $membership->countNewItems(), 'isMember' => true]); ?>
<?php foreach ($memberships as $membership) : ?>
<?= SpaceChooserItem::widget([
'space' => $membership->space,
'updateCount' => $membership->countNewItems(),
'isMember' => true
]);
?>
<?php endforeach; ?>
<?php foreach ($followSpaces as $followSpace): ?>
<?= SpaceChooserItem::widget(['space' => $followSpace, 'isFollowing' => true]); ?>
<?php foreach ($followSpaces as $followSpace) : ?>
<?= SpaceChooserItem::widget([
'space' => $followSpace,
'isFollowing' => true
]);
?>
<?php endforeach; ?>
</ul>
</li>
@ -74,7 +86,7 @@ $this->registerJsConfig('space.chooser', [
<ul id="space-menu-remote-search" class="media-list notLoaded"></ul>
</li>
<?php if ($canCreateSpace): ?>
<?php if ($canCreateSpace) : ?>
<li>
<div class="dropdown-footer">
<a href="#" class="btn btn-info col-md-12" data-action-click="ui.modal.load" data-action-url="<?= Url::to(['/space/create/create']) ?>">