Skip to content

Commit bea785e

Browse files
authored
Merge pull request #78 from VSEphpbb/issue/77
Unread topic icon should link to unread posts
2 parents 4d06143 + 5268a2f commit bea785e

4 files changed

Lines changed: 32 additions & 51 deletions

File tree

controller/idea_controller.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,25 @@ public function idea($idea_id)
4747
return new \Symfony\Component\HttpFoundation\JsonResponse($result);
4848
}
4949

50-
$url = append_sid(generate_board_url() . "/viewtopic.{$this->php_ext}",
51-
array('f' => $this->config['ideas_forum_id'], 't' => $this->data['topic_id']),
52-
false
50+
$params = array(
51+
'f' => $this->config['ideas_forum_id'],
52+
't' => $this->data['topic_id']
5353
);
5454

55+
if ($unread = ($this->request->variable('view', '') === 'unread'))
56+
{
57+
$params = array_merge($params, array('view' => 'unread'));
58+
}
59+
60+
$url = append_sid(generate_board_url() . "/viewtopic.{$this->php_ext}", $params, false) . ($unread ? '#unread' : '');
61+
5562
return new RedirectResponse($url);
5663
}
5764

5865
/**
5966
* Delete action (deletes an idea via confirm dialog)
6067
*
68+
* @throws http_exception
6169
* @return void
6270
* @access public
6371
*/

styles/prosilver/template/index_list.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
<li class="row">
44
<dl class="row-item topic_{{ not idea.READ ? 'un' }}read{{ idea.LOCKED ? '_locked' }}">
55
<dt title="{{ lang(idea.READ ? 'NO_UNREAD_POSTS' : 'UNREAD_POSTS') }}">
6-
<div class="list-inner">
7-
<a href="{{ idea.LINK }}" class="forumtitle">{{ idea.TITLE }}</a><br />
8-
{{ lang('POST_BY_AUTHOR') }} <strong>{{ idea.AUTHOR }}</strong> &raquo; {{ idea.DATE }}
9-
</div>
6+
{% if not idea.READ and not S_IS_BOT %}<a href="{{ idea.LINK }}?view=unread" class="row-item-link"></a>{% endif %}
7+
<div class="list-inner">
8+
<a href="{{ idea.LINK }}" class="forumtitle">{{ idea.TITLE }}</a><br />
9+
{{ lang('POST_BY_AUTHOR') }} <strong>{{ idea.AUTHOR }}</strong> &raquo; {{ idea.DATE }}
10+
</div>
1011
</dt>
1112

1213
<dd class="topics">

styles/prosilver/template/list_body.html

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,19 @@ <h2>{{ lang('IDEAS_TITLE') }} :: {{ STATUS_NAME }}</h2>
66

77
{% include 'action_bar_top.html' %}
88

9-
{% for idea in ideas %}
10-
{% if idea.S_FIRST_ROW %}
11-
<div class="forumbg">
12-
<div class="inner">
13-
<ul class="topiclist">
14-
<li class="header">
15-
<dl class="row-item">
16-
<dt><div class="list-inner">{{ lang('IDEAS') }}</div></dt>
17-
<dd class="posts">{{ lang('RATING') }}</dd>
18-
</dl>
19-
</li>
20-
</ul>
21-
<ul class="topiclist forums">
22-
{% endif %}
23-
<li class="row">
24-
<dl class="row-item forum_{{ not idea.READ ? 'un' }}read">
25-
<dt title="Read posts">
26-
<div class="list-inner">
27-
<a href="{{ idea.LINK }}" class="forumtitle">{{ idea.TITLE }}</a><br />
28-
by <strong>{{ idea.AUTHOR }}</strong> &raquo; {{ idea.DATE }}
29-
</div>
30-
</dt>
31-
32-
<dd class="topics">
33-
<div class="minivoteup"><span>{{ idea.VOTES_UP }}</span></div>
34-
<div class="minivotedown"><span>{{ idea.VOTES_DOWN }}</span></div>
35-
</dd>
36-
</dl>
37-
</li>
38-
{% if idea.S_LAST_ROW %}
39-
</ul>
40-
</div>
41-
</div>
42-
{% endif %}
43-
{% else %}
44-
<div class="panel">
45-
<div class="inner">
46-
<strong>{{ lang('NO_IDEAS_DISPLAY') }}</strong>
47-
</div>
9+
<div class="forumbg">
10+
<div class="inner">
11+
<ul class="topiclist">
12+
<li class="header">
13+
<dl class="row-item">
14+
<dt><div class="list-inner">{{ lang('IDEAS') }}</div></dt>
15+
<dd class="posts">{{ lang('RATING') }}</dd>
16+
</dl>
17+
</li>
18+
</ul>
19+
{% include 'index_list.html' %}
4820
</div>
49-
{% endfor %}
21+
</div>
5022

5123
<form method="post" action="{{ U_LIST_ACTION }}">
5224
<fieldset class="display-options">

tests/functional/ideas_test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,22 @@ public function test_view_ideas_lists()
5656
// Access new ideas list
5757
$crawler = self::request('GET', "app.php/ideas/list?sid={$this->sid}");
5858
$this->assertContainsLang('OPEN_IDEAS', $crawler->filter('h2')->text());
59-
$this->assertCount(1, $crawler->filter('.topiclist.forums'));
59+
$this->assertNotContainsLang('NO_IDEAS_DISPLAY', $crawler->filter('.topiclist.forums')->text());
6060

6161
// Access top ideas list
6262
$crawler = self::request('GET', "app.php/ideas/list/top?sid={$this->sid}");
6363
$this->assertContainsLang('TOP_IDEAS', $crawler->filter('h2')->text());
64-
$this->assertCount(1, $crawler->filter('.topiclist.forums'));
64+
$this->assertNotContainsLang('NO_IDEAS_DISPLAY', $crawler->filter('.topiclist.forums')->text());
6565

6666
// Access all ideas list
6767
$crawler = self::request('GET', "app.php/ideas/list/date?status=-1&sid={$this->sid}");
6868
$this->assertContainsLang('ALL_IDEAS', $crawler->filter('h2')->text());
69-
$this->assertCount(1, $crawler->filter('.topiclist.forums'));
69+
$this->assertNotContainsLang('NO_IDEAS_DISPLAY', $crawler->filter('.topiclist.forums')->text());
7070

7171
// Access implemented ideas list (should be empty list)
7272
$crawler = self::request('GET', "app.php/ideas/list/date?status=3&sid={$this->sid}");
7373
$this->assertContainsLang('IMPLEMENTED', $crawler->filter('h2')->text());
74-
$this->assertCount(0, $crawler->filter('.topiclist.forums'));
74+
$this->assertContainsLang('NO_IDEAS_DISPLAY', $crawler->filter('.topiclist.forums')->text());
7575
}
7676

7777
/**

0 commit comments

Comments
 (0)