diff --git a/Controller/ProjectCoverimageController.php b/Controller/ProjectCoverimageController.php
new file mode 100644
index 0000000..fcb7519
--- /dev/null
+++ b/Controller/ProjectCoverimageController.php
@@ -0,0 +1,37 @@
+getProject();
+ $file = $this->getFile();
+
+ $this->projectCoverimageModel->setCoverimage($project['id'], $file['id']);
+
+ $this->flash->success(t('Coverimage set.'));
+
+ $this->response->redirect($this->helper->url->to('ProjectViewController', 'show', array('project_id' => $project['id'])), true);
+ }
+
+ public function remove() {
+ $project = $this->getProject();
+ $file = $this->getFile();
+
+ $this->projectCoverimageModel->removeCoverimage($project['id']);
+
+ $this->flash->success(t('Coverimage removed.'));
+
+ $this->response->redirect($this->helper->url->to('ProjectViewController', 'show', array('project_id' => $project['id'])), true);
+ }
+
+}
diff --git a/Model/ProjectCoverimageModel.php b/Model/ProjectCoverimageModel.php
new file mode 100644
index 0000000..9a29435
--- /dev/null
+++ b/Model/ProjectCoverimageModel.php
@@ -0,0 +1,27 @@
+projectMetadataModel->save($project_id, array('prjcoverimage' => $image_id));
+ }
+
+ public function removeCoverimage($project_id) {
+
+ $this->projectMetadataModel->remove($project_id, 'prjcoverimage');
+ }
+
+ public function getCoverimage($project_id) {
+
+ $id = $this->projectMetadataModel->get($project_id, 'prjcoverimage');
+ if (!$id)
+ return(null);
+ return $this->getById($id);
+ }
+
+}
diff --git a/Plugin.php b/Plugin.php
index a756168..61b5dcf 100644
--- a/Plugin.php
+++ b/Plugin.php
@@ -10,6 +10,9 @@ class Plugin extends Base {
public function initialize() {
//Task Details
$this->template->setTemplateOverride('task_file/images', 'coverimage:task_file/images');
+ $this->template->setTemplateOverride('project_overview/images', 'coverimage:project_overview/images');
+ $this->template->setTemplateOverride('dashboard/overview', 'coverimage:dashboard/overview');
+ $this->template->setTemplateOverride('project_list/project_title', 'coverimage:project_list/project_title');
//Board
$this->hook->on('template:layout:css', array('template' => 'plugins/Coverimage/assets/css/board.css'));
@@ -25,6 +28,7 @@ public function getClasses() {
return array(
'Plugin\Coverimage\Model' => array(
'CoverimageModel',
+ 'ProjectCoverimageModel',
)
);
}
diff --git a/README.md b/README.md
index bdc9d6a..39110a3 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,19 @@
Kanboard Plugin Coverimage
==========================
-This plugin adds a coverimage function to the board.
+This plugin adds a coverimage function to tasks on the board, and allows you to set a project image to use as a logo for projects.
+## For Tasks

+## For Projects
+
+
+
+
+
+
+
Plugin for https://github.com/fguillot/kanboard
Author
diff --git a/Template/dashboard/overview.php b/Template/dashboard/overview.php
new file mode 100644
index 0000000..c3e0d87
--- /dev/null
+++ b/Template/dashboard/overview.php
@@ -0,0 +1,106 @@
+
+
+isEmpty()): ?>
+
+ = $this->render('project_list/header', array('paginator' => $project_paginator)) ?>
+ getCollection() as $project): ?>
+
+
+ task->projectCoverimageModel->getCoverimage($project['id']);
+ if(isset($file)){
+ ?>
+
+
+
+
+ user->hasProjectAccess('ProjectViewController', 'show', $project['id'])): ?>
+ = $this->render('project/dropdown', array('project' => $project)) ?>
+
+
= '#'.$project['id'] ?>
+
+
+
+ = $this->url->link($this->text->e($project['name']), 'BoardViewController', 'show', array('project_id' => $project['id'])) ?>
+
+
+
+
+
+
+
+
+ = $column['nb_open_tasks'] ?>
+ = $this->text->e($column['title']) ?>
+
+
+
+
+
+
+ = $project_paginator ?>
+
+
+
+ = t('There is nothing assigned to you.') ?>
+
+
+ isEmpty()): ?>
+
+
+
+ = $this->render('task_list/header', array(
+ 'paginator' => $result['paginator'],
+ )) ?>
+
+ getCollection() as $task): ?>
+
+ = $this->render('task_list/task_title', array(
+ 'task' => $task,
+ 'redirect' => 'dashboard',
+ )) ?>
+
+ = $this->render('task_list/task_details', array(
+ 'task' => $task,
+ )) ?>
+
+ = $this->render('task_list/task_avatars', array(
+ 'task' => $task,
+ )) ?>
+
+ = $this->render('task_list/task_icons', array(
+ 'task' => $task,
+ )) ?>
+
+ = $this->render('task_list/task_subtasks', array(
+ 'task' => $task,
+ 'user_id' => $user['id'],
+ )) ?>
+
+ = $this->hook->render('template:dashboard:task:footer', array('task' => $task)) ?>
+
+
+
+
+ = $result['paginator'] ?>
+
+
+
+
+= $this->hook->render('template:dashboard:show', array('user' => $user)) ?>
diff --git a/Template/project_list/project_title.php b/Template/project_list/project_title.php
new file mode 100644
index 0000000..a565b4a
--- /dev/null
+++ b/Template/project_list/project_title.php
@@ -0,0 +1,21 @@
+
+ task->projectCoverimageModel->getCoverimage($project['id']);
+ if(isset($file)){
+ ?>
+
+
+
+
+ user->hasProjectAccess('ProjectViewController', 'show', $project['id'])): ?>
+ = $this->render('project/dropdown', array('project' => $project)) ?>
+
+
= '#'.$project['id'] ?>
+
+
+
+ = $this->url->link($this->text->e($project['name']), 'BoardViewController', 'show', array('project_id' => $project['id'])) ?>
+
+
diff --git a/Template/project_overview/images.php b/Template/project_overview/images.php
new file mode 100644
index 0000000..c3f5f5d
--- /dev/null
+++ b/Template/project_overview/images.php
@@ -0,0 +1,59 @@
+
+
+
+
+ = $this->app->component('image-slideshow', array(
+ 'images' => $images,
+ 'image' => $file,
+ 'regex' => 'FILE_ID',
+ 'url' => array(
+ 'image' => $this->url->to('FileViewerController', 'image', array('file_id' => 'FILE_ID', 'project_id' => $project['id'])),
+ 'thumbnail' => $this->url->to('FileViewerController', 'thumbnail', array('file_id' => 'FILE_ID', 'project_id' => $project['id'])),
+ 'download' => $this->url->to('FileViewerController', 'download', array('file_id' => 'FILE_ID', 'project_id' => $project['id'])),
+ )
+ )) ?>
+ task->projectCoverimageModel->getCoverimage($project['id']);
+ ?>
+
+
+
+
+
+
+ -
+ = $this->url->icon('external-link', t('View file'), 'FileViewerController', 'image', array('project_id' => $project['id'], 'file_id' => $file['id']), false, '', '', true) ?>
+
+ -
+ = $this->url->icon('download', t('Download'), 'FileViewerController', 'download', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?>
+
+ user->hasProjectAccess('ProjectFileController', 'remove', $project['id'])): ?>
+ -
+ = $this->modal->confirm('trash-o', t('Remove'), 'ProjectFileController', 'confirm', array('project_id' => $project['id'], 'file_id' => $file['id'])) ?>
+
+
+ -
+
+
+ = $this->url->link(t('set as coverimage'), 'ProjectCoverimageController', 'set', array('plugin' => 'coverimage', 'project_id' => $project['id'], 'file_id' => $file['id'])) ?>
+
+ = $this->url->link(t('remove coverimage'), 'ProjectCoverimageController', 'remove', array('plugin' => 'coverimage', 'project_id' => $project['id'], 'file_id' => $file['id'])) ?>
+
+
+
+
+
+
+ = $this->app->tooltipMarkdown(t('Uploaded: %s', $this->dt->datetime($file['date']))."\n\n".t('Size: %s', $this->text->bytes($file['size']))) ?>
+
+ = t('Uploaded by %s', $file['user_name'] ?: $file['username']) ?>
+
+ = t('Uploaded: %s', $this->dt->datetime($file['date'])) ?>
+
+
+
+
+
+
+
+