diff --git a/app/Http/Controllers/Projects/IssueController.php b/app/Http/Controllers/Projects/IssueController.php index 1a0c603..a18938a 100644 --- a/app/Http/Controllers/Projects/IssueController.php +++ b/app/Http/Controllers/Projects/IssueController.php @@ -50,12 +50,13 @@ class IssueController extends Controller public function show(Project $project, Issue $issue) { + $comments = $issue->comments; $priorities = Priority::toArray(); $statuses = IssueStatus::toArray(); $users = User::pluck('name', 'id'); return view('projects.issues.show', compact( - 'project', 'issue', 'users', 'statuses', 'priorities' + 'project', 'issue', 'users', 'statuses', 'priorities', 'comments' )); } diff --git a/resources/views/projects/issues/partials/comment-section.blade.php b/resources/views/projects/issues/partials/comment-section.blade.php new file mode 100644 index 0000000..d19d66a --- /dev/null +++ b/resources/views/projects/issues/partials/comment-section.blade.php @@ -0,0 +1,9 @@ +@foreach($comments as $comment) +
+ + {{ $comment->time_display }} + {{ $comment->creator->name }} + + {!! nl2br($comment->body) !!} +
+@endforeach diff --git a/resources/views/projects/issues/show.blade.php b/resources/views/projects/issues/show.blade.php index 42ccb12..b069268 100755 --- a/resources/views/projects/issues/show.blade.php +++ b/resources/views/projects/issues/show.blade.php @@ -32,6 +32,8 @@ {{ link_to_route('projects.issues.index', __('issue.back_to_index'), [$project], ['class' => 'btn btn-default pull-right']) }} + + @include('projects.issues.partials.comment-section')
{{ Form::model($issue, ['route' => ['issues.options.update', $issue], 'method' => 'patch']) }} diff --git a/tests/Feature/Projects/IssueCommentsTest.php b/tests/Feature/Projects/IssueCommentsTest.php new file mode 100644 index 0000000..22b0890 --- /dev/null +++ b/tests/Feature/Projects/IssueCommentsTest.php @@ -0,0 +1,29 @@ +adminUserSigningIn(); + $issue = factory(Issue::class)->create(); + $comment = factory(Comment::class)->create([ + 'commentable_type' => 'issues', + 'commentable_id' => $issue->id, + 'body' => 'This is issue comment.', + ]); + + $this->visitRoute('projects.issues.show', [$issue->project, $issue]); + + $this->seeText('This is issue comment.'); + } +}