aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/styles/prosilver/template
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-02-03 15:51:29 +0100
committerMarc Alexander <admin@m-a-styles.de>2013-02-03 15:51:29 +0100
commita54128b3bc146fa6f46bd10c712253e568352ec8 (patch)
tree4fc69788e7d2fe4dbd29f9895b9ede3aa7009a28 /phpBB/styles/prosilver/template
parent34c564062a95b9306487fbc6bbd17c7c9c8a63c4 (diff)
downloadforums-a54128b3bc146fa6f46bd10c712253e568352ec8.tar
forums-a54128b3bc146fa6f46bd10c712253e568352ec8.tar.gz
forums-a54128b3bc146fa6f46bd10c712253e568352ec8.tar.bz2
forums-a54128b3bc146fa6f46bd10c712253e568352ec8.tar.xz
forums-a54128b3bc146fa6f46bd10c712253e568352ec8.zip
[ticket/11342] Mark active topics read when marking forums read
Marking forums read while viewing a category will also mark the active topics inside that category read. Therefore, the active topics should also be marked read. With this patch the ajax callback "mark_forums_read" will check if the active topics id ("active_topics") exists and also mark topics read if it does. As the active topics will only be displayed in categories, which can't have any other topics, this is a proper approach. PHPBB3-11342
Diffstat (limited to 'phpBB/styles/prosilver/template')
-rw-r--r--phpBB/styles/prosilver/template/ajax.js18
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html2
2 files changed, 16 insertions, 4 deletions
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 6ce3b38981..b2a27089f7 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -37,14 +37,24 @@ phpbb.addAjaxCallback('mark_forums_read', function(res) {
// Mark subforums read
$('a.subforum[class*="unread"]').removeClass('unread').addClass('read');
+ // Mark topics read if we are watching a category and showing active topics
+ if ($('#active_topics').length) {
+ phpbb.ajaxCallbacks['mark_topics_read'].call(this, res, false);
+ }
+
// Update mark forums read links
$('[data-ajax="mark_forums_read"]').attr('href', res.U_MARK_FORUMS);
phpbb.closeDarkenWrapper(3000);
});
-// This callback will mark all topic icons read
-phpbb.addAjaxCallback('mark_topics_read', function(res) {
+/**
+* This callback will mark all topic icons read
+*
+* @param update_topic_links bool Wether "Mark topics read" links should be
+* updated. Defaults to true.
+*/
+phpbb.addAjaxCallback('mark_topics_read', function(res, update_topic_links = true) {
var readTitle = res.NO_UNREAD_POSTS;
var unreadTitle = res.UNREAD_POSTS;
var iconsArray = {
@@ -85,7 +95,9 @@ phpbb.addAjaxCallback('mark_topics_read', function(res) {
$('a').has('span.icon_topic_newest').remove();
// Update mark topics read links
- $('[data-ajax="mark_topics_read"]').attr('href', res.U_MARK_TOPICS);
+ if (update_topic_links) {
+ $('[data-ajax="mark_topics_read"]').attr('href', res.U_MARK_TOPICS);
+ }
phpbb.closeDarkenWrapper(3000);
});
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index e0aef4f290..38566dece0 100644
--- a/phpBB/styles/prosilver/template/viewforum_body.html
+++ b/phpBB/styles/prosilver/template/viewforum_body.html
@@ -130,7 +130,7 @@
<ul class="topiclist">
<li class="header">
<dl class="icon">
- <dt><!-- IF S_DISPLAY_ACTIVE -->{L_ACTIVE_TOPICS}<!-- ELSEIF topicrow.S_TOPIC_TYPE_SWITCH and (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) -->{L_ANNOUNCEMENTS}<!-- ELSE -->{L_TOPICS}<!-- ENDIF --></dt>
+ <dt<!-- IF S_DISPLAY_ACTIVE --> id="active_topics"<!-- ENDIF -->><!-- IF S_DISPLAY_ACTIVE -->{L_ACTIVE_TOPICS}<!-- ELSEIF topicrow.S_TOPIC_TYPE_SWITCH and (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) -->{L_ANNOUNCEMENTS}<!-- ELSE -->{L_TOPICS}<!-- ENDIF --></dt>
<dd class="posts">{L_REPLIES}</dd>
<dd class="views">{L_VIEWS}</dd>
<dd class="lastpost"><span>{L_LAST_POST}</span></dd>