[ticket/16237] fix ajax subscribe icons

PHPBB3-16237
This commit is contained in:
hanakin 2020-05-02 17:46:58 -10:00
parent dc4fe2d4b7
commit 8f4b546958
7 changed files with 61 additions and 35 deletions

View file

@ -1052,11 +1052,11 @@ phpbb.addAjaxCallback('alt_text', function() {
* and changes the link itself.
*/
phpbb.addAjaxCallback('toggle_link', function() {
var $anchor,
updateAll = $(this).data('update-all') ,
toggleText,
toggleUrl,
toggleClass;
let $anchor;
let updateAll = $(this).data('update-all');
let toggleText;
let toggleUrl;
let toggleIcon;
if (updateAll !== undefined && updateAll.length) {
$anchor = $(updateAll);
@ -1067,21 +1067,19 @@ phpbb.addAjaxCallback('toggle_link', function() {
$anchor.each(function() {
var $this = $(this);
// Toggle link text
toggleText = $.trim($this.attr('data-toggle-text'));
$this.attr('data-toggle-text', $.trim($this.children('span').text()));
$this.attr('title', toggleText);
$this.children('span').last().text(toggleText);
// Toggle link url
toggleUrl = $this.attr('data-toggle-url');
$this.attr('data-toggle-url', $this.attr('href'));
$this.attr('href', toggleUrl);
// Toggle class of link parent
toggleClass = $this.attr('data-toggle-class');
$this.attr('data-toggle-class', $this.children().attr('class'));
$this.children('.icon').attr('class', toggleClass);
// Toggle link text
toggleText = $this.attr('data-toggle-text');
$this.attr('data-toggle-text', $this.children('span').text());
$this.attr('title', $.trim(toggleText));
$this.children('span').text(toggleText);
// Toggle Icon
$this.children().first().toggleClass('is-active').next().toggleClass('is-active')
});
});

View file

@ -103,7 +103,6 @@
<!-- ELSEIF forumrow.U_UNAPPROVED_POSTS -->
<a href="{forumrow.U_UNAPPROVED_POSTS}" title="{L_POSTS_UNAPPROVED_FORUM}">
{{ Icon('iconify', 'mdi:alert-decagram', '', true, 'c-unapproved-icon') }}<span class="sr-only">{L_TOPICS_UNAPPROVED}</span>
<span class="sr-only">{L_POSTS_UNAPPROVED_FORUM}</span>
</a>
<!-- ENDIF -->
<!-- IF forumrow.LAST_POST_TIME -->
@ -116,7 +115,6 @@
<!-- IF not S_IS_BOT -->
<a href="{forumrow.U_LAST_POST}" title="{L_VIEW_LATEST_POST}">
{{ Icon('iconify', 'fa:external-link-square', '', true, 'c-last-post-icon') }}<span class="sr-only">{L_TOPICS_UNAPPROVED}</span>
<span class="sr-only">{L_VIEW_LATEST_POST}</span>
</a>
<!-- ENDIF -->
<br /><time datetime="{forumrow.LAST_POST_TIME_RFC3339}">{forumrow.LAST_POST_TIME}</time>

View file

@ -24,11 +24,15 @@
</li>
<!-- IF U_WATCH_FORUM_LINK and not S_IS_BOT -->
<li data-last-responsive="true">
<a class="c-subscribe-action{% if not S_WATCHING_FORUM %} is-active {% endif %}" href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-swap="subscribe" data-swap-url="{U_WATCH_FORUM_TOGGLE}">
{{ Icon('iconify', 'mdi:checkbox-blank-outline', '', true, 'c-subscibe-icon') }}<span>{S_WATCH_FORUM_TITLE}</span>
</a>
<a class="c-subscribe-action{% if S_WATCHING_FORUM %} is-active {% endif %}" href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-swap="subscribe" data-swap-url="{U_WATCH_FORUM_TOGGLE}">
{{ Icon('iconify', 'mdi:checkbox-marked', '', true, 'c-subscibe-icon') }}<span>{S_WATCH_FORUM_TITLE}</span>
<a href="{U_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="toggle_link" data-toggle-text="{S_WATCH_FORUM_TOGGLE}" data-toggle-url="{U_WATCH_FORUM_TOGGLE}">
{% if S_WATCHING_FORUM %}
{{ Icon('iconify', 'mdi:checkbox-blank-outline', '', true, 'c-subscribe-icon') }}
{{ Icon('iconify', 'mdi:checkbox-marked', '', true, 'c-subscribe-icon is-active') }}
{% else %}
{{ Icon('iconify', 'mdi:checkbox-blank-outline', '', true, 'c-subscribe-icon is-active') }}
{{ Icon('iconify', 'mdi:checkbox-marked', '', true, 'c-subscribe-icon') }}
{% endif %}
<span>{S_WATCH_FORUM_TITLE}</span>
</a>
</li>
<!-- ENDIF -->

View file

@ -10,11 +10,15 @@
<!-- EVENT viewtopic_topic_tools_before -->
<!-- IF U_WATCH_TOPIC -->
<li>
<a class="c-subscribe-action{% if not S_WATCHING_TOPIC %} is-active {% endif %}" href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}" data-ajax="swap_subscribe" data-swap="subscribe" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}" data-update-all=".c-cubscribe-action">
{{ Icon('iconify', 'mdi:checkbox-blank-outline', '', true, 'c-subscibe-icon') }}<span>{S_WATCH_TOPIC_TITLE}</span>
</a>
<a class="c-subscribe-action{% if S_WATCHING_TOPIC %} is-active {% endif %}" href="{U_WATCH_TOPIC}" title="{S_WATCH_TOPIC_TITLE}" data-ajax="swap_subscribe" data-swap="subscribe" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}" data-update-all=".c-cubscribe-action">
{{ Icon('iconify', 'mdi:checkbox-marked', '', true, 'c-subscibe-icon') }}<span>{S_WATCH_TOPIC_TITLE}</span>
<a href="{U_WATCH_TOPIC}" class="watch-topic-link" title="{S_WATCH_TOPIC_TITLE}" data-ajax="toggle_link" data-toggle-text="{S_WATCH_TOPIC_TOGGLE}" data-toggle-url="{U_WATCH_TOPIC_TOGGLE}" data-update-all=".watch-topic-link">
{% if S_WATCHING_TOPIC %}
{{ Icon('iconify', 'mdi:checkbox-blank-outline', '', true, 'c-subscribe-icon') }}
{{ Icon('iconify', 'mdi:checkbox-marked', '', true, 'c-subscribe-icon is-active') }}
{% else %}
{{ Icon('iconify', 'mdi:checkbox-blank-outline', '', true, 'c-subscribe-icon is-active') }}
{{ Icon('iconify', 'mdi:checkbox-marked', '', true, 'c-subscribe-icon') }}
{% endif %}
<span>{S_WATCH_TOPIC_TITLE}</span>
</a>
</li>
<!-- ENDIF -->

View file

@ -280,6 +280,17 @@ a.rightside {
margin-left: 7px;
}
ul.linklist li a:hover,
ul.linklist li a:focus,
ul.linklist li a:active {
text-decoration: none;
}
ul.linklist li a:hover span,
ul.linklist li a:focus span {
text-decoration: underline;
}
ul.navlinks {
border-top: 1px solid transparent;
}
@ -496,6 +507,17 @@ a.header-avatar img {
padding: 5px;
}
.dropdown-contents a:hover,
.dropdown-contents a:active,
.dropdown-contents a:focus {
text-decoration: none;
}
.dropdown-contents a:hover span,
.dropdown-contents a:focus span {
text-decoration: underline;
}
.jumpbox {
margin: 5px 0;
}

View file

@ -120,3 +120,11 @@ blockquote cite:before,
.c-button-icon {
margin-top: 0;
}
.c-subscribe-icon {
display: none !important;
}
.c-subscribe-icon.is-active {
display: inline !important;
}

View file

@ -204,11 +204,3 @@ a.feed-icon-forum {
a.anchor {
display: block;
}
.c-subscribe-action {
display: none !important;
}
.c-subscribe-action.is-active {
display: inline-block !important;
}