Skip to content

Commit 3fd7007

Browse files
authored
Merge pull request #65 from Jieiku/compact-layout
Compact layout
2 parents 85b57f5 + fc6d053 commit 3fd7007

File tree

5 files changed

+73
-64
lines changed

5 files changed

+73
-64
lines changed

Helper/SizeAvatarHelperExtend.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Kanboard\Plugin\Group_assign\Helper;
4+
5+
use Kanboard\Helper\AvatarHelper;
6+
use Kanboard\Core\Base;
7+
/**
8+
* Avatar Helper
9+
*
10+
* @package helper
11+
* @author Frederic Guillot
12+
*/
13+
class sizeAvatarHelperExtend extends AvatarHelper
14+
{
15+
public function sizeMultiple($owner_ms, $css = '', $size = 20) {
16+
$assignees = $this->multiselectMemberModel->getMembers($owner_ms);
17+
$html = "";
18+
foreach ($assignees as $assignee) {
19+
$user = $this->userModel->getById($assignee['user_id']);
20+
$html .= $this->render($assignee['user_id'], $user['username'], $user['name'], $user['email'], $user['avatar_path'], $css, $size);
21+
}
22+
return $html;
23+
}
24+
}

Helper/SmallAvatarHelperExtend.php

-35
This file was deleted.

Plugin.php

+28-25
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,26 @@
3131

3232
class Plugin extends Base
3333
{
34-
3534
public function initialize()
3635
{
37-
//Events & Changes
36+
//Events & Changes
3837
$this->template->setTemplateOverride('task/changes', 'group_assign:task/changes');
39-
38+
4039
//Notifications
4140
$this->container['userNotificationFilterModel'] = $this->container->factory(function ($c) {
4241
return new NewUserNotificationFilterModel($c);
4342
});
4443

4544
//Helpers
4645
$this->helper->register('newTaskHelper', '\Kanboard\Plugin\Group_assign\Helper\NewTaskHelper');
47-
$this->helper->register('smallAvatarHelperExtend', '\Kanboard\Plugin\Group_assign\Helper\SmallAvatarHelperExtend');
48-
49-
46+
$this->helper->register('sizeAvatarHelperExtend', '\Kanboard\Plugin\Group_assign\Helper\SizeAvatarHelperExtend');
47+
48+
5049
//Models and backward compatibility
51-
5250
$applications_version = str_replace('v', '', APP_VERSION);
5351
if (strpos(APP_VERSION, 'master') !== false && file_exists('ChangeLog')) { $applications_version = trim(file_get_contents('ChangeLog', false, null, 8, 6), ' '); }
5452
$clean_appversion = preg_replace('/\s+/', '', $applications_version);
55-
53+
5654
if (version_compare($clean_appversion, '1.2.5', '>')) {
5755
if (file_exists('plugins/MetaMagik')){
5856
$this->container['taskFinderModel'] = $this->container->factory(function ($c) {
@@ -98,44 +96,49 @@ public function initialize()
9896
return new TaskRecurrenceModel ($c);
9997
});
10098
}
101-
99+
102100
//Task - Template - details.php
103101
$this->template->hook->attach('template:task:details:third-column', 'group_assign:task/details');
104102
$this->template->hook->attach('template:task:details:third-column', 'group_assign:task/multi');
105-
103+
106104
//Forms - task_creation.php and task_modification.php
107105
$this->template->setTemplateOverride('task_creation/show', 'group_assign:task_creation/show');
108106
$this->template->setTemplateOverride('task_modification/show', 'group_assign:task_modification/show');
109-
107+
110108
//Board
111109
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/group');
112-
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/multi');
110+
111+
if ($this->configModel->get('boardcustomizer_compactlayout', '') == 'enable') {
112+
$this->template->hook->attach('template:board:private:task:before-avatar', 'group_assign:board/multi');
113+
} else {
114+
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/multi');
115+
}
113116
$groupmodel = $this->projectGroupRoleModel;
114117
$this->template->hook->attachCallable('template:app:filters-helper:after', 'group_assign:board/filter', function($array = array()) use ($groupmodel) {
115118
if(!empty($array) && $array['id'] >= 1){
116119
return ['grouplist' => array_column($groupmodel->getGroups($array['id']), 'name')];
117120
} else {
118121
return ['grouplist' => array()];
119122
}
120-
});
121-
123+
});
124+
122125
//Filter
123126
$this->container->extend('taskLexer', function($taskLexer, $c) {
124127
$taskLexer->withFilter(TaskAllAssigneeFilter::getInstance()->setDatabase($c['db'])
125128
->setCurrentUserId($c['userSession']->getId()));
126129
return $taskLexer;
127130
});
128-
131+
129132
//Actions
130133
$this->actionManager->register(new EmailGroup($this->container));
131134
$this->actionManager->register(new EmailGroupDue($this->container));
132135
$this->actionManager->register(new EmailOtherAssignees($this->container));
133136
$this->actionManager->register(new EmailOtherAssigneesDue($this->container));
134137
$this->actionManager->register(new AssignGroup($this->container));
135-
138+
136139
//Params
137140
$this->template->setTemplateOverride('action_creation/params', 'group_assign:action_creation/params');
138-
141+
139142
//CSS
140143
$this->hook->on('template:layout:css', array('template' => 'plugins/Group_assign/Assets/css/group_assign.css'));
141144

@@ -144,30 +147,30 @@ public function initialize()
144147

145148
//Calendar Events
146149
$container = $this->container;
147-
150+
148151
$this->hook->on('controller:calendar:user:events', function($user_id, $start, $end) use ($container) {
149152
$model = new GroupAssignCalendarModel($container);
150153
return $model->getUserCalendarEvents($user_id, $start, $end); // Return new events
151154
});
152-
155+
153156
//Roles
154157

155158
$this->template->hook->attach('template:config:application', 'group_assign:config/toggle');
156-
157-
if ($this->configModel->get('enable_am_group_management', '2') == 1) {
159+
160+
if ($this->configModel->get('enable_am_group_management', '2') == 1) {
158161
$this->applicationAccessMap->add('GroupListController', '*', Role::APP_MANAGER);
159162
$this->applicationAccessMap->add('GroupCreationController', '*', Role::APP_MANAGER);
160-
$this->template->setTemplateOverride('header/user_dropdown', 'group_assign:header/user_dropdown');
163+
$this->template->setTemplateOverride('header/user_dropdown', 'group_assign:header/user_dropdown');
161164
}
162165

163166

164167
}
165-
168+
166169
public function onStartup()
167170
{
168171
Translator::load($this->languageModel->getCurrentLanguage(), __DIR__.'/Locale');
169172
}
170-
173+
171174
public function getClasses()
172175
{
173176
return [
@@ -191,7 +194,7 @@ public function getPluginAuthor()
191194
}
192195
public function getPluginVersion()
193196
{
194-
return '1.7.11';
197+
return '1.7.12';
195198
}
196199
public function getPluginHomepage()
197200
{

Template/board/multi.php

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
<?php if ($task['owner_ms'] > 0 && count($this->task->multiselectMemberModel->getMembers($task['owner_ms'])) > 0) : ?>
2-
<strong class="assigned-other-label"><small><?= t('Other Assignees:') ?></small></strong>
3-
<?= $this->helper->smallAvatarHelperExtend->miniMultiple($task['owner_ms'], 'avatar-inline') ?>
4-
<br>
2+
3+
<?php if ($this->user->userMetadataModel->exists($this->user->getid(), "boardcustomizer_compactlayout")) {
4+
/* compact card layout */
5+
?>
6+
7+
<strong class="assigned-other-label"><small><?= t('Other Assignees:') ?></small></strong>
8+
<?= $this->helper->sizeAvatarHelperExtend->sizeMultiple($task['owner_ms'], 'avatar-inline avatar-bdyn', $this->task->configModel->get('b_av_size','20')) ?>
9+
10+
<?php
11+
} else {
12+
?>
13+
14+
<strong class="assigned-other-label"><small><?= t('Other Assignees:') ?></small></strong>
15+
<?= $this->helper->sizeAvatarHelperExtend->sizeMultiple($task['owner_ms'], 'avatar-inline avatar-bdyn', 13) ?>
16+
<br>
17+
18+
<?php
19+
}
20+
?>
21+
522
<?php endif ?>

Template/task/multi.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
<li>
33
<strong><?= t('Other Assignees:') ?></strong>
44
</li>
5-
<?= $this->helper->smallAvatarHelperExtend->smallMultiple($task['owner_ms'], 'avatar-inline') ?>
5+
<?= $this->helper->sizeAvatarHelperExtend->sizeMultiple($task['owner_ms'], 'avatar-inline', 20) ?>
66
<?php endif ?>

0 commit comments

Comments
 (0)