1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* @var $this \humhub\components\WebView */ |
4
|
|
|
/* @var $currentSpace \humhub\modules\space\models\Space */ |
5
|
|
|
|
6
|
|
|
use yii\helpers\Url; |
7
|
|
|
use yii\helpers\Html; |
8
|
|
|
use humhub\modules\space\widgets\SpaceChooserItem; |
9
|
|
|
|
10
|
|
|
\humhub\modules\space\assets\SpaceChooserAsset::register($this); |
11
|
|
|
$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>'; |
12
|
|
|
$this->registerJsConfig('space.chooser', [ |
13
|
|
|
'noSpace' => $noSpaceView, |
14
|
|
|
'remoteSearchUrl' => Url::to(['/space/browse/search-json']), |
15
|
|
|
'text' => [ |
16
|
|
|
'info.remoteAtLeastInput' => Yii::t('SpaceModule.widgets_views_spaceChooser', 'To search for other spaces, type at least {count} characters.', ['count' => 2]), |
17
|
|
|
'info.emptyOwnResult' => Yii::t('SpaceModule.widgets_views_spaceChooser', 'No member or following spaces found.'), |
18
|
|
|
'info.emptyResult' => Yii::t('SpaceModule.widgets_views_spaceChooser', 'No result found for the given filter.'), |
19
|
|
|
], |
20
|
|
|
]); |
21
|
|
|
?> |
22
|
|
|
|
23
|
|
|
<li class="dropdown"> |
24
|
|
|
<a href="#" id="space-menu" class="dropdown-toggle" data-toggle="dropdown"> |
25
|
|
|
<!-- start: Show space image and name if chosen --> |
26
|
|
|
<?php if ($currentSpace) { ?> |
27
|
|
|
<?= |
28
|
|
|
\humhub\modules\space\widgets\Image::widget([ |
29
|
|
|
'space' => $currentSpace, |
30
|
|
|
'width' => 32, |
31
|
|
|
'htmlOptions' => [ |
32
|
|
|
'class' => 'current-space-image', |
33
|
|
|
]]); |
34
|
|
|
?> |
35
|
|
|
<b class="caret"></b> |
36
|
|
|
<?php } ?> |
37
|
|
|
|
38
|
|
|
<?php if (!$currentSpace) : ?> |
39
|
|
|
<?= $noSpaceView ?> |
40
|
|
|
<?php endif; ?> |
41
|
|
|
<!-- end: Show space image and name if chosen --> |
42
|
|
|
|
43
|
|
|
</a> |
44
|
|
|
<ul class="dropdown-menu" id="space-menu-dropdown"> |
45
|
|
|
<li> |
46
|
|
|
<form action="" class="dropdown-controls"> |
47
|
|
|
<div class="input-group"> |
48
|
|
|
<input type="text" id="space-menu-search" class="form-control" autocomplete="off" placeholder="<?= Yii::t('SpaceModule.widgets_views_spaceChooser', 'Search'); ?>"> |
49
|
|
|
<span id="space-directory-link" class="input-group-addon" > |
50
|
|
|
<a href="<?= Url::to(['/directory/directory/spaces']); ?>"> |
51
|
|
|
<i class="fa fa-book"></i> |
52
|
|
|
</a> |
53
|
|
|
</span> |
54
|
|
|
<div class="search-reset" id="space-search-reset"><i class="fa fa-times-circle"></i></div> |
55
|
|
|
</div> |
56
|
|
|
</form> |
57
|
|
|
</li> |
58
|
|
|
|
59
|
|
|
<li class="divider"></li> |
60
|
|
|
<li> |
61
|
|
|
<ul class="media-list notLoaded" id="space-menu-spaces"> |
62
|
|
|
<?php foreach ($memberships as $membership): ?> |
63
|
|
|
<?= SpaceChooserItem::widget(['space' => $membership->space, 'updateCount' => $membership->countNewItems(), 'isMember' => true]); ?> |
64
|
|
|
<?php endforeach; ?> |
65
|
|
|
<?php foreach ($followSpaces as $followSpace): ?> |
66
|
|
|
<?= SpaceChooserItem::widget(['space' => $followSpace, 'isFollowing' => true]); ?> |
67
|
|
|
<?php endforeach; ?> |
68
|
|
|
</ul> |
69
|
|
|
</li> |
70
|
|
|
<li class="remoteSearch"> |
71
|
|
|
<ul id="space-menu-remote-search" class="media-list notLoaded"></ul> |
72
|
|
|
</li> |
73
|
|
|
</li> |
74
|
|
|
|
75
|
|
|
<?php if ($canCreateSpace): ?> |
76
|
|
|
<li> |
77
|
|
|
<div class="dropdown-footer"> |
78
|
|
|
<a href="#" class="btn btn-info col-md-12" data-action-click="ui.modal.load" data-action-url="<?= Url::to(['/space/create/create']) ?>"> |
79
|
|
|
<?= Yii::t('SpaceModule.widgets_views_spaceChooser', 'Create new space') ?> |
80
|
|
|
</a> |
81
|
|
|
</div> |
82
|
|
|
</li> |
83
|
|
|
<?php endif; ?> |
84
|
|
|
</ul> |
85
|
|
|
</li> |
86
|
|
|
|
87
|
|
|
<script type="text/javascript"> +<?php if ($canCreateSpace): ?> |
88
|
|
|
+ <li> |
89
|
|
|
// set niceScroll to SpaceChooser menu |
90
|
|
|
$("#space-menu-spaces").niceScroll({ |
91
|
|
|
cursorwidth: "7", |
92
|
|
|
cursorborder: "", |
93
|
|
|
cursorcolor: "#555", |
94
|
|
|
cursoropacitymax: "0.2", |
95
|
|
|
railpadding: {top: 0, right: 3, left: 0, bottom: 0} |
96
|
|
|
}); |
97
|
|
|
jQuery('.badge-space').fadeIn('slow'); |
98
|
|
|
</script> |
99
|
|
|
|
|
|
|
|