summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-03-19 18:04:22 -0400
committerFrederic Guillot <fred@kanboard.net>2016-03-19 18:04:22 -0400
commit1ad57c74732e4463cfa5051e975c54f4e65d7e09 (patch)
tree80870017404b15da538353bd5dd52d76b8482ca2 /app
parent42376aec4ad78ad880d3e42219ccec07bf09339a (diff)
Add buttons in project overview sections
Diffstat (limited to 'app')
-rw-r--r--app/Controller/ProjectEdit.php2
-rw-r--r--app/Helper/UrlHelper.php35
-rw-r--r--app/Template/project_edit/dates.php10
-rw-r--r--app/Template/project_edit/description.php10
-rw-r--r--app/Template/project_edit/general.php10
-rw-r--r--app/Template/project_edit/task_priority.php10
-rw-r--r--app/Template/project_overview/attachments.php7
-rw-r--r--app/Template/project_overview/description.php5
8 files changed, 56 insertions, 33 deletions
diff --git a/app/Controller/ProjectEdit.php b/app/Controller/ProjectEdit.php
index f4a3a7cb..94be0206 100644
--- a/app/Controller/ProjectEdit.php
+++ b/app/Controller/ProjectEdit.php
@@ -67,7 +67,7 @@ class ProjectEdit extends Base
if ($valid) {
if ($this->project->update($values)) {
$this->flash->success(t('Project updated successfully.'));
- $this->response->redirect($this->helper->url->to('ProjectEdit', $redirect, array('project_id' => $project['id'])));
+ $this->response->redirect($this->helper->url->to('ProjectEdit', $redirect, array('project_id' => $project['id'])), true);
} else {
$this->flash->failure(t('Unable to update this project.'));
}
diff --git a/app/Helper/UrlHelper.php b/app/Helper/UrlHelper.php
index cad9fdef..095c4af4 100644
--- a/app/Helper/UrlHelper.php
+++ b/app/Helper/UrlHelper.php
@@ -29,18 +29,37 @@ class UrlHelper extends Base
}
/**
- * HTML Link tag
+ * Button Link Element
*
* @access public
- * @param string $label Link label
+ * @param string $icon Font-Awesome icon
+ * @param string $label Link label
* @param string $controller Controller name
- * @param string $action Action name
- * @param array $params Url parameters
- * @param boolean $csrf Add a CSRF token
- * @param string $class CSS class attribute
+ * @param string $action Action name
+ * @param array $params Url parameters
+ * @param string $class CSS class attribute
+ * @return string
+ */
+ public function button($icon, $label, $controller, $action, array $params = array(), $class = '')
+ {
+ $icon = '<i class="fa '.$icon.' fa-fw"></i> ';
+ $class = 'btn '.$class;
+ return $this->link($icon.$label, $controller, $action, $params, false, $class);
+ }
+
+ /**
+ * Link element
+ *
+ * @access public
+ * @param string $label Link label
+ * @param string $controller Controller name
+ * @param string $action Action name
+ * @param array $params Url parameters
+ * @param boolean $csrf Add a CSRF token
+ * @param string $class CSS class attribute
* @param string $title
- * @param boolean $new_tab Open the link in a new tab
- * @param string $anchor Link Anchor
+ * @param boolean $new_tab Open the link in a new tab
+ * @param string $anchor Link Anchor
* @return string
*/
public function link($label, $controller, $action, array $params = array(), $csrf = false, $class = '', $title = '', $new_tab = false, $anchor = '')
diff --git a/app/Template/project_edit/dates.php b/app/Template/project_edit/dates.php
index 83651592..f77b7260 100644
--- a/app/Template/project_edit/dates.php
+++ b/app/Template/project_edit/dates.php
@@ -1,13 +1,13 @@
<div class="page-header">
<h2><?= t('Edit project') ?></h2>
<ul>
- <li ><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id'])) ?></li>
- <li class="active"><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id'])) ?></li>
- <li><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id'])) ?></li>
- <li><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id'])) ?></li>
+ <li ><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li class="active"><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
</ul>
</div>
-<form method="post" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'dates')) ?>" autocomplete="off">
+<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'dates')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('name', $values) ?>
diff --git a/app/Template/project_edit/description.php b/app/Template/project_edit/description.php
index 6bfe8b8d..666d53e8 100644
--- a/app/Template/project_edit/description.php
+++ b/app/Template/project_edit/description.php
@@ -1,13 +1,13 @@
<div class="page-header">
<h2><?= t('Edit project') ?></h2>
<ul>
- <li><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id'])) ?></li>
- <li><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id'])) ?></li>
- <li class="active"><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id'])) ?></li>
- <li><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id'])) ?></li>
+ <li><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li class="active"><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
</ul>
</div>
-<form method="post" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'description')) ?>" autocomplete="off">
+<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'description')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('name', $values) ?>
diff --git a/app/Template/project_edit/general.php b/app/Template/project_edit/general.php
index 5e6d32b4..6c3fa68d 100644
--- a/app/Template/project_edit/general.php
+++ b/app/Template/project_edit/general.php
@@ -1,13 +1,13 @@
<div class="page-header">
<h2><?= t('Edit project') ?></h2>
<ul>
- <li class="active"><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id'])) ?></li>
- <li><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id'])) ?></li>
- <li><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id'])) ?></li>
- <li><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id'])) ?></li>
+ <li class="active"><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
</ul>
</div>
-<form method="post" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'edit')) ?>" autocomplete="off">
+<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'edit')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>
diff --git a/app/Template/project_edit/task_priority.php b/app/Template/project_edit/task_priority.php
index faf49f5d..56c25753 100644
--- a/app/Template/project_edit/task_priority.php
+++ b/app/Template/project_edit/task_priority.php
@@ -1,13 +1,13 @@
<div class="page-header">
<h2><?= t('Edit project') ?></h2>
<ul>
- <li ><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id'])) ?></li>
- <li><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id'])) ?></li>
- <li><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id'])) ?></li>
- <li class="active"><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id'])) ?></li>
+ <li ><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
+ <li class="active"><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
</ul>
</div>
-<form method="post" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'priority')) ?>" autocomplete="off">
+<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'priority')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('name', $values) ?>
diff --git a/app/Template/project_overview/attachments.php b/app/Template/project_overview/attachments.php
index eb0c5be7..eaabfd5f 100644
--- a/app/Template/project_overview/attachments.php
+++ b/app/Template/project_overview/attachments.php
@@ -4,10 +4,9 @@
</div>
<div class="accordion-content">
<?php if ($this->user->hasProjectAccess('ProjectFile', 'create', $project['id'])): ?>
- <p style="margin-bottom: 15px;">
- <i class="fa fa-plus fa-fw"></i>
- <?= $this->url->link(t('Upload a file'), 'ProjectFile', 'create', array('project_id' => $project['id']), false, 'popover') ?>
- </p>
+ <div class="buttons-header">
+ <?= $this->url->button('fa-plus', t('Upload a file'), 'ProjectFile', 'create', array('project_id' => $project['id']), 'popover') ?>
+ </div>
<?php endif ?>
<?= $this->render('project_overview/images', array('project' => $project, 'images' => $images)) ?>
diff --git a/app/Template/project_overview/description.php b/app/Template/project_overview/description.php
index c89cb710..9895aede 100644
--- a/app/Template/project_overview/description.php
+++ b/app/Template/project_overview/description.php
@@ -3,6 +3,11 @@
<h3><a href="#" class="fa accordion-toggle"></a> <?= t('Description') ?></h3>
</div>
<div class="accordion-content">
+ <?php if ($this->user->hasProjectAccess('ProjectEdit', 'description', $project['id'])): ?>
+ <div class="buttons-header">
+ <?= $this->url->button('fa-edit', t('Edit Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), 'popover') ?>
+ </div>
+ <?php endif ?>
<article class="markdown">
<?= $this->text->markdown($project['description']) ?>
</article>