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) : ?> - - helper->smallAvatarHelperExtend->miniMultiple($task['owner_ms'], 'avatar-inline') ?> -
+ +user->userMetadataModel->exists($this->user->getid(), "boardcustomizer_compactlayout")) { + /* compact card layout */ + ?> + + + helper->sizeAvatarHelperExtend->sizeMultiple($task['owner_ms'], 'avatar-inline avatar-bdyn', $this->task->configModel->get('b_av_size','35')) ?> + + + + + 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 @@
  • - helper->smallAvatarHelperExtend->smallMultiple($task['owner_ms'], 'avatar-inline') ?> + helper->sizeAvatarHelperExtend->sizeMultiple($task['owner_ms'], 'avatar-inline', 20) ?> From 46b6f972823191c874a823c6666364eb2e019299 Mon Sep 17 00:00:00 2001 From: Jieiku <106644+Jieiku@users.noreply.github.com> Date: Wed, 22 Dec 2021 07:07:09 -0800 Subject: [PATCH 2/4] Compact Layout --- Helper/SizeAvatarHelperExtend.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Helper/SizeAvatarHelperExtend.php diff --git a/Helper/SizeAvatarHelperExtend.php b/Helper/SizeAvatarHelperExtend.php new file mode 100644 index 0000000..c850844 --- /dev/null +++ b/Helper/SizeAvatarHelperExtend.php @@ -0,0 +1,24 @@ +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, $size); + } + return $html; + } +} From fedfd89260766ffbcdff14aed82904f15d4a8f2f Mon Sep 17 00:00:00 2001 From: Jieiku <106644+Jieiku@users.noreply.github.com> Date: Wed, 22 Dec 2021 07:14:56 -0800 Subject: [PATCH 3/4] Compact Layout --- Template/board/multi.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Template/board/multi.php b/Template/board/multi.php index 38b1f81..69106df 100644 --- a/Template/board/multi.php +++ b/Template/board/multi.php @@ -5,7 +5,7 @@ ?> - helper->sizeAvatarHelperExtend->sizeMultiple($task['owner_ms'], 'avatar-inline avatar-bdyn', $this->task->configModel->get('b_av_size','35')) ?> + helper->sizeAvatarHelperExtend->sizeMultiple($task['owner_ms'], 'avatar-inline avatar-bdyn', $this->task->configModel->get('b_av_size','20')) ?> Date: Thu, 23 Dec 2021 02:37:22 -0800 Subject: [PATCH 4/4] Compact Layout --- Plugin.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugin.php b/Plugin.php index 46b26b3..ff92a56 100644 --- a/Plugin.php +++ b/Plugin.php @@ -157,10 +157,10 @@ public function initialize() $this->template->hook->attach('template:config:application', 'group_assign:config/toggle'); - if ($this->configModel->get('enable_am_group_management', '2') == 1) { + if ($this->configModel->get('enable_am_group_management', '2') == 1) { $this->applicationAccessMap->add('GroupListController', '*', Role::APP_MANAGER); $this->applicationAccessMap->add('GroupCreationController', '*', Role::APP_MANAGER); - $this->template->setTemplateOverride('header/user_dropdown', 'group_assign:header/user_dropdown'); + $this->template->setTemplateOverride('header/user_dropdown', 'group_assign:header/user_dropdown'); } @@ -194,7 +194,7 @@ public function getPluginAuthor() } public function getPluginVersion() { - return '1.7.11'; + return '1.7.12'; } public function getPluginHomepage() {