From 1ad57c74732e4463cfa5051e975c54f4e65d7e09 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 19 Mar 2016 18:04:22 -0400 Subject: Add buttons in project overview sections --- app/Controller/ProjectEdit.php | 2 +- app/Helper/UrlHelper.php | 35 +++++++++++++++++++++------ app/Template/project_edit/dates.php | 10 ++++---- app/Template/project_edit/description.php | 10 ++++---- app/Template/project_edit/general.php | 10 ++++---- app/Template/project_edit/task_priority.php | 10 ++++---- app/Template/project_overview/attachments.php | 7 +++--- app/Template/project_overview/description.php | 5 ++++ 8 files changed, 56 insertions(+), 33 deletions(-) (limited to 'app') 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 = ' '; + $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 @@ -
+ form->csrf() ?> form->hidden('id', $values) ?> 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 @@ - + form->csrf() ?> form->hidden('id', $values) ?> 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 @@ - + form->csrf() ?> 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 @@ - + form->csrf() ?> form->hidden('id', $values) ?> 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 @@
user->hasProjectAccess('ProjectFile', 'create', $project['id'])): ?> -

- - url->link(t('Upload a file'), 'ProjectFile', 'create', array('project_id' => $project['id']), false, 'popover') ?> -

+
+ url->button('fa-plus', t('Upload a file'), 'ProjectFile', 'create', array('project_id' => $project['id']), 'popover') ?> +
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 @@

+ user->hasProjectAccess('ProjectEdit', 'description', $project['id'])): ?> +
+ url->button('fa-edit', t('Edit Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), 'popover') ?> +
+
text->markdown($project['description']) ?>
-- cgit v1.2.3