Skip to content

Commit

Permalink
Add page titles on unread feedback page
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohutai committed Feb 20, 2018
1 parent 0108bff commit 6182bf7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,14 @@ public function unreadGet(Application $app, Request $request)
{
$status = FeedbackStatus::UNREAD;

$stmt = $app['db']->prepare("SELECT * FROM `bolt_is_useful_feedback` WHERE `status` = :status");
$sql = "SELECT `bolt_is_useful_feedback`.*,";
$sql .= " `bolt_is_useful`.`contenttype`,";
$sql .= " `bolt_is_useful`.`contentid`";
$sql .= " FROM `bolt_is_useful_feedback`";
$sql .= " LEFT JOIN `bolt_is_useful` ON `bolt_is_useful_feedback`.`is_useful_id` = `bolt_is_useful`.`id`";
$sql .= " WHERE `status` = :status";

$stmt = $app['db']->prepare($sql);
$stmt->bindParam('status', $status);
$stmt->execute();
$feedback = $stmt->fetchAll();
Expand Down
2 changes: 1 addition & 1 deletion src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ protected function registerAssets()
->setLate(true)
->setZone(Zone::BACKEND)
;

return $assets;
}

Expand Down
2 changes: 1 addition & 1 deletion templates/backend/_navigation.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</li>
<li class="{{ unreadActiveClass }}">
<a class="" href="{{ path('is_useful.unread') }}"><i class="fa fa-inbox"></i>
{% if total_unread is not empty %}
{% if total_unread > 0 %}
View unread feedback <span class="label label-danger">{{ total_unread }}</span>
{% else %}
No unread feedback
Expand Down
7 changes: 7 additions & 0 deletions templates/backend/unread.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{% if feedback is not empty %}
<table data-table>
<thead>
<th>Page</th>
<th>IP</th>
<th>Date</th>
<th>Message</th>
Expand All @@ -25,6 +26,12 @@
{% set statusReadLink = path('is_useful.feedback.status', { id: item.id, status: 'read' }) %}
{% set statusDoneLink = path('is_useful.feedback.status', { id: item.id, status: 'done' }) %}
<tr>
{% setcontent record = "#{item.contenttype}/#{item.contentid}" %}
<td class="is-useful">
<a href="{{ path('is_useful.view', { id: item.is_useful_id }) }}" title="View detailed feedback for this page">
{{ record.title }}
</a>
</td>
<td class="is-useful-ip">{{ ip }}</td>
<td class="is-useful-datetime">{{ datetime }}</td>
<td class="is-useful-message">
Expand Down

0 comments on commit 6182bf7

Please sign in to comment.