Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Updated view of issue
Browse files Browse the repository at this point in the history
  • Loading branch information
githubjeka committed Jun 14, 2017
1 parent b275137 commit 8ac3e91
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 114 deletions.
4 changes: 2 additions & 2 deletions controllers/IssueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function actionMarkAdopted($id)
$assignee->viewed_at = date('Y-m-d H:i');
$assignee->save();

return $this->renderAjaxContent($assignee->issue->getWallOut());
\Yii::$app->response->setStatusCode(204, 'No Content');
}

public function actionMarkDone($id)
Expand All @@ -177,7 +177,7 @@ public function actionMarkDone($id)
$assignee->finished_at = date('Y-m-d H:i');
$assignee->save();

return $this->renderAjaxContent($assignee->issue->getWallOut());
\Yii::$app->response->setStatusCode(204, 'No Content');
}

protected function findAssignee($id)
Expand Down
270 changes: 166 additions & 104 deletions views/issue/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,59 +17,161 @@
$formatter = Yii::$app->formatter;
?>

<h4><?= Html::encode($issue->title) ?></h4>

<div class="issue" id="issue_<?php echo $issue->id; ?>">

<p data-ui-markdown data-ui-show-more>
<?= humhub\widgets\RichText::widget(['text' => $issue->description, 'record' => $issue]) ?>
</p>
<div class="row">
<div class="col-md-8">

<div class="panel">
<div class="panel-body">
<div class="row-fluid bg-info">
<h4><?= Html::encode($issue->title) ?></h4>

<div class="col-xs-4">
<?= Yii::t('TrackerIssuesModule.views', 'From this time recommended begin to start work') ?><br>
<?= $formatter->asDatetime($issue->started_at, 'HH:mm, eee d MMMM y ') ?>
</div>
<p data-ui-markdown data-ui-show-more>
<?= humhub\widgets\RichText::widget(['text' => $issue->description, 'record' => $issue]) ?>
</p>

<div class="col-xs-4">
<?= DeadlineIssueWidget::widget(['deadline' => $issue->deadline]) ?><br>
<?= StatusIssueWidget::widget(['status' => $issue->status]) ?>
</div>
</div>

<div class="col-md-4">
<div class="panel panel-info">
<div class="panel-body">
<div data-toggle="tooltip" title="<?= Yii::t('TrackerIssuesModule.views', 'Visibility') ?>">
<span class="label label-default"><i class="fa fa-dot-circle-o fa-fw"
aria-hidden="true"></i></span>
<?= \tracker\widgets\VisibilityIssueWidget::widget(['visibilityContent' => $issue->content->visibility]); ?>
</div>

<div data-toggle="tooltip" title="<?= Yii::t('TrackerIssuesModule.views', 'Status') ?>">
<span class="label label-default"><i class="fa fa-flag fa-fw" aria-hidden="true"></i></span>
<?= StatusIssueWidget::widget(['status' => $issue->status]) ?>
</div>


<div data-toggle="tooltip" title="<?= Yii::t('TrackerIssuesModule.views', 'Priority') ?>">
<span class="label label-default"><i class="fa fa-exclamation fa-fw"
aria-hidden="true"></i></span>
<?= \tracker\widgets\PriorityIssueWidget::widget(['priority' => $issue->priority]) ?>
</div>

<hr>

<div data-toggle="tooltip" title="<?= Yii::t('TrackerIssuesModule.views',
'From this time recommended begin to start work') ?>">
<span class="label label-default"><i class="fa fa-calendar-o fa-fw"
aria-hidden="true"></i></span>
<span class="label label-default">
<?= $formatter->asDatetime($issue->started_at, 'HH:mm, eee d MMMM y ') ?>
</span>
</div>

<div data-toggle="tooltip" title="<?= Yii::t('TrackerIssuesModule.views',
'Deadline') ?>">
<span class="label label-default"><i class="fa fa-clock-o fa-fw" aria-hidden="true"></i></span>
<?= DeadlineIssueWidget::widget(['deadline' => $issue->deadline, 'short' => true]) ?>
</div>

<div class="col-xs-4">
<?php if ($issue->finished_at) : ?>
<?= Yii::t('TrackerIssuesModule.views', 'Finished at') ?><br>
<?= $formatter->asDatetime($issue->finished_at, 'HH:mm, eee d MMMM y ') ?>
<div data-toggle="tooltip" title="<?= Yii::t('TrackerIssuesModule.views',
'Finished at') ?>">
<span class="label label-default"><i class="fa fa-calendar-check-o fa-fw"
aria-hidden="true"></i></span>
<span class="label label-default">
<?= $formatter->asDatetime($issue->finished_at, 'HH:mm, eee d MMMM y ') ?>
</span>
</div>
<?php endif; ?>

<?php if (count($issue->personalTags) > 0) : ?>
<hr>
<div data-toggle="tooltip" title="<?= Yii::t('TrackerIssuesModule.views', 'Tags') ?>">
<span class="label label-default"><i class="fa fa-tags fa-fw" aria-hidden="true"></i></span>
<?= \tracker\widgets\TagsWidget::widget([
'tagsModels' => $issue->personalTags,
'asLink' => true,
]) ?>
</div>

<?php endif; ?>

</div>
</div>
</div>
</div>

<?php
/** @var Issue $parent */
$parent = $issue->getParent()->readable()->one();
$parentNotReadable = $issue->getParent()->one();
?>
<?php if ($parent !== null) : ?>
<div class="panel panel-warning">
<div class="panel-heading">
<strong><?= Yii::t('TrackerIssuesModule.views', 'This issue is subtask for the issue') ?></strong>
<h1 class="panel-title">
<?= Html::a(Html::encode($parent->title), $parent->content->getUrl()) ?>
</h1>
</div>
<div class="panel-body">
<p data-ui-markdown data-ui-show-more>
<?= humhub\widgets\RichText::widget([
'text' => $parent->description,
'record' => $parent,
]) ?>
</p>

</div>
</div>
<?php elseif($parentNotReadable !== null) : ?>
<div class="panel panel-warning">
<div class="panel-heading">
<strong><?= Yii::t('TrackerIssuesModule.views', 'This issue is subtask for the issue') ?></strong>
<h1 class="panel-title"><?= Html::encode($parentNotReadable->title) ?></h1>
</div>
<div class="panel-body">
<p data-ui-markdown data-ui-show-more>
<?= humhub\widgets\RichText::widget([
'text' => $parentNotReadable->description,
'record' => $parentNotReadable,
]) ?>
</p>

</div>
</div>
<?php endif ?>

<?php if (count($issue->assignees) > 0) : ?>
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<th><?= Yii::t('TrackerIssuesModule.views', 'Assignee') ?></th>
<th><?= Yii::t('TrackerIssuesModule.views', 'Assigned at') ?></th>
<th><?= Yii::t('TrackerIssuesModule.views', 'Adopted at') ?></th>
<th><?= Yii::t('TrackerIssuesModule.views', 'Finished at') ?></th>
<th></th>
<th>
<i class="fa fa-users" aria-hidden="true"></i>
<?= Yii::t('TrackerIssuesModule.views', 'Assignee') ?>
</th>
<th>
<i class="fa fa-calendar-o" aria-hidden="true"></i>
<?= Yii::t('TrackerIssuesModule.views', 'Assigned at') ?>
</th>
<th>
<i class="fa fa-calendar-plus-o" aria-hidden="true"></i>
<?= Yii::t('TrackerIssuesModule.views', 'Adopted at') ?>
</th>
<th>
<i class="fa fa-calendar-check-o" aria-hidden="true"></i>
<?= Yii::t('TrackerIssuesModule.views', 'Finished at') ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($issue->assignees as $assigner) : ?>
<tr>
<td>
<img src="<?= $assigner->user->getProfileImage()->getUrl(); ?>"
class="img-rounded tt img_margin"
height="24" width="24" alt="24x24" data-src="holder.js/24x24"
style="width: 24px; height: 24px;">
</td>
<td>
<a href="<?= $assigner->user->getUrl(); ?>">
<img src="<?= $assigner->user->getProfileImage()->getUrl(); ?>"
class="img-rounded tt img_margin"
height="24" width="24" alt="24x24" data-src="holder.js/24x24"
style="width: 24px; height: 24px;">
<br>
<small><?= Html::encode($assigner->user->displayName); ?></small>
</a>
</td>
Expand All @@ -80,97 +182,57 @@ class="img-rounded tt img_margin"
<?php if ($assigner->view_mark) : ?>
<?= $formatter->asDatetime($assigner->viewed_at, 'HH:mm, eee. d MMM yyyy') ?>
<?php else: ?>
<strong>-</strong>
<?php if ($assigner->user_id == Yii::$app->user->id) : ?>
<?= \humhub\widgets\AjaxButton::widget([
'label' => Yii::t('TrackerIssuesModule.views', 'Adopted'),
'ajaxOptions' => [
'type' => 'POST',
'success' => new yii\web\JsExpression('function(){humhub.modules.client.reload();}'),
'url' => $issue->content->container->createUrl(
'/' . \tracker\Module::getIdentifier() . '/issue/mark-adopted',
['id' => $assigner->id,]
),
],
'htmlOptions' => [
'class' => 'btn btn-primary btn-xs btn-block',
],
]);
?>
<?php endif; ?>
<?php endif; ?>
</td>
<td>
<?php if ($assigner->finish_mark) : ?>
<?= $formatter->asDatetime($assigner->finished_at, 'HH:mm, eee. d MMM yyyy') ?>
<?php else: ?>
<strong>-</strong>
<?php if ($assigner->user_id == Yii::$app->user->id) : ?>
<?php if ($assigner->view_mark && !$assigner->finish_mark): ?>
<?= \humhub\widgets\AjaxButton::widget([
'label' => Yii::t('TrackerIssuesModule.views', 'Done'),
'ajaxOptions' => [
'type' => 'POST',
'success' => new yii\web\JsExpression('function(){humhub.modules.client.reload();}'),
'url' => $issue->content->container->createUrl(
'/' . \tracker\Module::getIdentifier() . '/issue/mark-done',
['id' => $assigner->id,]
),
],
'htmlOptions' => [
'class' => 'btn btn-primary btn-xs btn-block',
],
]);
?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

<?php foreach ($issue->getAssignees()->all() as $assigner) : ?>
<?php if ($assigner->user_id == Yii::$app->user->id) : ?>
<?php if (!$assigner->view_mark) : ?>
<?= \humhub\widgets\AjaxButton::widget([
'label' => Yii::t('TrackerIssuesModule.views', 'Adopted'),
'ajaxOptions' => [
'type' => 'POST',
'success' => new yii\web\JsExpression(
'function(html){ $(\'div[data-content-key="' . $issue->content->id .
'"]\').html(html); }'),
'url' => $issue->content->container->createUrl(
'/' . \tracker\Module::getIdentifier() . '/issue/mark-adopted',
['id' => $assigner->id,]
),
],
'htmlOptions' => [
'class' => 'btn btn-primary btn-block',
],
]);
?>
<?php elseif ((!$assigner->finish_mark)): ?>
<?= \humhub\widgets\AjaxButton::widget([
'label' => Yii::t('TrackerIssuesModule.views', 'Done'),
'ajaxOptions' => [
'type' => 'POST',
'success' => new yii\web\JsExpression(
'function(html){ $(\'div[data-content-key="' . $issue->content->id .
'"]\').html(html); }'),
'url' => $issue->content->container->createUrl(
'/' . \tracker\Module::getIdentifier() . '/issue/mark-done',
['id' => $assigner->id,]
),
],
'htmlOptions' => [
'class' => 'btn btn-primary btn-block',
],
]);
?>
<?php endif; ?>
<?php break; ?>
<?php endif; ?>
<?php endforeach; ?>
<br>
<?php endif; ?>

<?php if (count($issue->personalTags) > 0) : ?>
<strong><?= Yii::t('TrackerIssuesModule.views', 'Tags') ?>:</strong>
<?= \tracker\widgets\TagsWidget::widget(['tagsModels' => $issue->personalTags, 'asLink' => true]) ?>
<hr>
<?php endif; ?>

<?php
/** @var Issue $parent */
$parent = $issue->getParent()->readable()->one();
?>
<?php if ($parent !== null) : ?>
<div class="panel panel-warning">
<div class="panel-heading">
<strong><?= Yii::t('TrackerIssuesModule.views', 'This issue is subtask for the issue') ?></strong>
<h1 class="panel-title">
<?= Html::a(Html::encode($parent->title), $parent->content->getUrl()) ?>
</h1>
</div>
<div class="panel-body">
<p data-ui-markdown data-ui-show-more>
<?= humhub\widgets\RichText::widget([
'text' => $parent->description,
'record' => $parent,
]) ?>
</p>

</div>
</div>
<?php endif ?>

<?php
$dataProvider = new \yii\data\ActiveDataProvider(['query' => $issue->getSubtasks()->readable()]);
if ($dataProvider->getTotalCount() > 0) : ?>
Expand Down
8 changes: 0 additions & 8 deletions widgets/views/wallEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,6 @@

<hr>

<p>
<span class="label label-info"><?= $object->getContentName(); ?></span>
<?= \tracker\widgets\PriorityIssueWidget::widget(['priority' => $object->priority]) ?>
<?= \tracker\widgets\VisibilityIssueWidget::widget(['visibilityContent' => $object->content->visibility]); ?>
</p>

<hr/>

<div class="content" id="wall_content_<?= $object->getUniqueId(); ?>">
<?= $content; ?>
</div>
Expand Down

0 comments on commit 8ac3e91

Please sign in to comment.