From 957fd95b8483211825207b5159690d8230a4c6dd Mon Sep 17 00:00:00 2001
From: Jieiku <106644+Jieiku@users.noreply.github.com>
Date: Wed, 22 Dec 2021 07:02:57 -0800
Subject: [PATCH 1/4] Compact Layout
---
Helper/SmallAvatarHelperExtend.php | 35 ----------------------
Plugin.php | 47 ++++++++++++++++--------------
Template/board/multi.php | 23 +++++++++++++--
Template/task/multi.php | 2 +-
4 files changed, 46 insertions(+), 61 deletions(-)
delete mode 100644 Helper/SmallAvatarHelperExtend.php
diff --git a/Helper/SmallAvatarHelperExtend.php b/Helper/SmallAvatarHelperExtend.php
deleted file mode 100644
index 1ee35c9..0000000
--- a/Helper/SmallAvatarHelperExtend.php
+++ /dev/null
@@ -1,35 +0,0 @@
-multiselectMemberModel->getMembers($owner_ms);
- $html = "";
- foreach ($assignees as $assignee) {
- $user = $this->userModel->getById($assignee['user_id']);
- $html .= $this->render($assignee['user_id'], $user['username'], $user['name'], $user['email'], $user['avatar_path'], $css, 20);
- }
- return $html;
- }
-
- public function miniMultiple($owner_ms, $css = '') {
- $assignees = $this->multiselectMemberModel->getMembers($owner_ms);
- $html = "";
- foreach ($assignees as $assignee) {
- $user = $this->userModel->getById($assignee['user_id']);
- $html .= $this->render($assignee['user_id'], $user['username'], $user['name'], $user['email'], $user['avatar_path'], $css, 13);
- }
- return $html;
- }
- }
diff --git a/Plugin.php b/Plugin.php
index b579806..46b26b3 100644
--- a/Plugin.php
+++ b/Plugin.php
@@ -31,12 +31,11 @@
class Plugin extends Base
{
-
public function initialize()
{
- //Events & Changes
+ //Events & Changes
$this->template->setTemplateOverride('task/changes', 'group_assign:task/changes');
-
+
//Notifications
$this->container['userNotificationFilterModel'] = $this->container->factory(function ($c) {
return new NewUserNotificationFilterModel($c);
@@ -44,15 +43,14 @@ public function initialize()
//Helpers
$this->helper->register('newTaskHelper', '\Kanboard\Plugin\Group_assign\Helper\NewTaskHelper');
- $this->helper->register('smallAvatarHelperExtend', '\Kanboard\Plugin\Group_assign\Helper\SmallAvatarHelperExtend');
-
-
+ $this->helper->register('sizeAvatarHelperExtend', '\Kanboard\Plugin\Group_assign\Helper\SizeAvatarHelperExtend');
+
+
//Models and backward compatibility
-
$applications_version = str_replace('v', '', APP_VERSION);
if (strpos(APP_VERSION, 'master') !== false && file_exists('ChangeLog')) { $applications_version = trim(file_get_contents('ChangeLog', false, null, 8, 6), ' '); }
$clean_appversion = preg_replace('/\s+/', '', $applications_version);
-
+
if (version_compare($clean_appversion, '1.2.5', '>')) {
if (file_exists('plugins/MetaMagik')){
$this->container['taskFinderModel'] = $this->container->factory(function ($c) {
@@ -98,18 +96,23 @@ public function initialize()
return new TaskRecurrenceModel ($c);
});
}
-
+
//Task - Template - details.php
$this->template->hook->attach('template:task:details:third-column', 'group_assign:task/details');
$this->template->hook->attach('template:task:details:third-column', 'group_assign:task/multi');
-
+
//Forms - task_creation.php and task_modification.php
$this->template->setTemplateOverride('task_creation/show', 'group_assign:task_creation/show');
$this->template->setTemplateOverride('task_modification/show', 'group_assign:task_modification/show');
-
+
//Board
$this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/group');
- $this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/multi');
+
+ if ($this->configModel->get('boardcustomizer_compactlayout', '') == 'enable') {
+ $this->template->hook->attach('template:board:private:task:before-avatar', 'group_assign:board/multi');
+ } else {
+ $this->template->hook->attach('template:board:private:task:before-title', 'group_assign:board/multi');
+ }
$groupmodel = $this->projectGroupRoleModel;
$this->template->hook->attachCallable('template:app:filters-helper:after', 'group_assign:board/filter', function($array = array()) use ($groupmodel) {
if(!empty($array) && $array['id'] >= 1){
@@ -117,25 +120,25 @@ public function initialize()
} else {
return ['grouplist' => array()];
}
- });
-
+ });
+
//Filter
$this->container->extend('taskLexer', function($taskLexer, $c) {
$taskLexer->withFilter(TaskAllAssigneeFilter::getInstance()->setDatabase($c['db'])
->setCurrentUserId($c['userSession']->getId()));
return $taskLexer;
});
-
+
//Actions
$this->actionManager->register(new EmailGroup($this->container));
$this->actionManager->register(new EmailGroupDue($this->container));
$this->actionManager->register(new EmailOtherAssignees($this->container));
$this->actionManager->register(new EmailOtherAssigneesDue($this->container));
$this->actionManager->register(new AssignGroup($this->container));
-
+
//Params
$this->template->setTemplateOverride('action_creation/params', 'group_assign:action_creation/params');
-
+
//CSS
$this->hook->on('template:layout:css', array('template' => 'plugins/Group_assign/Assets/css/group_assign.css'));
@@ -144,16 +147,16 @@ public function initialize()
//Calendar Events
$container = $this->container;
-
+
$this->hook->on('controller:calendar:user:events', function($user_id, $start, $end) use ($container) {
$model = new GroupAssignCalendarModel($container);
return $model->getUserCalendarEvents($user_id, $start, $end); // Return new events
});
-
+
//Roles
$this->template->hook->attach('template:config:application', 'group_assign:config/toggle');
-
+
if ($this->configModel->get('enable_am_group_management', '2') == 1) {
$this->applicationAccessMap->add('GroupListController', '*', Role::APP_MANAGER);
$this->applicationAccessMap->add('GroupCreationController', '*', Role::APP_MANAGER);
@@ -162,12 +165,12 @@ public function initialize()
}
-
+
public function onStartup()
{
Translator::load($this->languageModel->getCurrentLanguage(), __DIR__.'/Locale');
}
-
+
public function getClasses()
{
return [
diff --git a/Template/board/multi.php b/Template/board/multi.php
index 46084b5..38b1f81 100644
--- a/Template/board/multi.php
+++ b/Template/board/multi.php
@@ -1,5 +1,22 @@
0 && count($this->task->multiselectMemberModel->getMembers($task['owner_ms'])) > 0) : ?>
-= t('Other Assignees:') ?>
- = $this->helper->smallAvatarHelperExtend->miniMultiple($task['owner_ms'], 'avatar-inline') ?>
-
+
+user->userMetadataModel->exists($this->user->getid(), "boardcustomizer_compactlayout")) {
+ /* compact card layout */
+ ?>
+
+ = t('Other Assignees:') ?>
+ = $this->helper->sizeAvatarHelperExtend->sizeMultiple($task['owner_ms'], 'avatar-inline avatar-bdyn', $this->task->configModel->get('b_av_size','35')) ?>
+
+
+
+ = t('Other Assignees:') ?>
+ = $this->helper->sizeAvatarHelperExtend->sizeMultiple($task['owner_ms'], 'avatar-inline avatar-bdyn', 13) ?>
+
+
+
+
diff --git a/Template/task/multi.php b/Template/task/multi.php
index 5c1fcfb..e9e9855 100644
--- a/Template/task/multi.php
+++ b/Template/task/multi.php
@@ -2,5 +2,5 @@