Add buttons in project overview sections
This commit is contained in:
parent
42376aec4a
commit
1ad57c7473
|
|
@ -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.'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = '')
|
||||
|
|
|
|||
|
|
@ -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) ?>
|
||||
|
|
|
|||
|
|
@ -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) ?>
|
||||
|
|
|
|||
|
|
@ -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) ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -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) ?>
|
||||
|
|
|
|||
|
|
@ -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)) ?>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,12 +1,8 @@
|
|||
/* alerts */
|
||||
#main .alert,
|
||||
.page .alert {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.alert {
|
||||
padding: 8px 35px 8px 14px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
color: #c09853;
|
||||
background-color: #fcf8e3;
|
||||
border: 1px solid #fbeed5;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/* buttons */
|
||||
.btn {
|
||||
font-size: 1.1em;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
display: inline-block;
|
||||
color: #333;
|
||||
border: 1px solid #ccc;
|
||||
background: #efefef;
|
||||
padding: 5px;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
font-size: 0.9em;
|
||||
cursor: pointer;
|
||||
background: #f5f5f5;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 2px;
|
||||
padding: 3px 10px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
a.btn {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.btn-small {
|
||||
padding: 2px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
.btn:hover {
|
||||
border: 1px solid #bbb;
|
||||
color: #000;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.btn-red {
|
||||
|
|
@ -31,30 +30,32 @@ a.btn {
|
|||
color: #fff;
|
||||
}
|
||||
|
||||
a.btn-red:hover,
|
||||
.btn-red:hover,
|
||||
.btn-red:focus {
|
||||
color: #fff;
|
||||
background: #c53727;
|
||||
}
|
||||
|
||||
a.btn-blue,
|
||||
.btn-blue {
|
||||
border-color: #3079ed;
|
||||
background: #4d90fe;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
a.btn-blue:hover,
|
||||
.btn-blue:hover,
|
||||
a.btn-blue:focus,
|
||||
.btn-blue:focus {
|
||||
border-color: #2f5bb7;
|
||||
background: #357ae8;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-blue:disabled {
|
||||
.btn:disabled {
|
||||
color: #ccc;
|
||||
border: 1px solid #ccc;
|
||||
background: #f7f7f7;
|
||||
}
|
||||
|
||||
.buttons-header {
|
||||
font-size: 0.9em;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -14,8 +14,6 @@ Popover.prototype.open = function(link) {
|
|||
|
||||
$.get(link, function(content) {
|
||||
$("body").prepend('<div id="popover-container"><div id="popover-content">' + content + '</div></div>');
|
||||
self.app.refresh();
|
||||
self.router.dispatch(this.app);
|
||||
self.afterOpen();
|
||||
});
|
||||
};
|
||||
|
|
@ -58,6 +56,9 @@ Popover.prototype.afterOpen = function() {
|
|||
var self = this;
|
||||
var popoverForm = $("#popover-content .popover-form");
|
||||
|
||||
self.app.refresh();
|
||||
self.router.dispatch(this.app);
|
||||
|
||||
// Submit forms with Ajax request
|
||||
if (popoverForm) {
|
||||
popoverForm.on("submit", function(e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue