forumlist: fix id conflict and js show-more

This commit is contained in:
rabuzarus 2015-11-17 20:57:12 +01:00
parent cec5afe2c9
commit a07a0fd1d7
2 changed files with 6 additions and 6 deletions

View File

@ -74,7 +74,7 @@ function widget_forumlist($a) {
$contacts = get_forumlist($a->user['uid'],true,$lastitem, true); $contacts = get_forumlist($a->user['uid'],true,$lastitem, true);
$total = count($contacts); $total = count($contacts);
$visible_forums = 10; $visible_forums = 1;
if(count($contacts)) { if(count($contacts)) {

View File

@ -1,13 +1,13 @@
<script> <script>
function showHideForumlist() { function showHideForumlist() {
if( $('#forum-widget-entry-extended').is(':visible')) { if( $("div[id^='forum-widget-entry-extended-']").is(':visible')) {
$('#forum-widget-entry-extended').hide(); $("div[id^='forum-widget-entry-extended-']").hide();
$('#forum-widget-collapse').html(window.showMore); $('#forum-widget-collapse').html(window.showMore);
} }
else { else {
$('#forum-widget-entry-extended').show(); $("div[id^='forum-widget-entry-extended-']").show();
$('#forum-widget-collapse').html(window.showFewer); $('#forum-widget-collapse').html(window.showFewer);
} }
} }
@ -18,7 +18,7 @@ function showHideForumlist() {
{{foreach $forums as $forum}} {{foreach $forums as $forum}}
{{if $forum.id <= $visible_forums}} {{if $forum.id <= $visible_forums}}
<div class="forum-widget-entry" id="forum-widget-entry" role="menuitem"> <div class="forum-widget-entry" id="forum-widget-entry-{{$forum.id}}" role="menuitem">
<a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank"> <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
<img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" /> <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
</a> </a>
@ -27,7 +27,7 @@ function showHideForumlist() {
{{/if}} {{/if}}
{{if $forum.id > $visible_forums}} {{if $forum.id > $visible_forums}}
<div class="forum-widget-entry" id="forum-widget-entry-extended" role="menuitem" style="display: none;"> <div class="forum-widget-entry" id="forum-widget-entry-extended-{{$forum.id}}" role="menuitem" style="display: none;">
<a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank"> <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
<img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" /> <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
</a> </a>