Skip to content

Commit

Permalink
Merge pull request #760 from gerundt/nav-filter-wrapper
Browse files Browse the repository at this point in the history
Allow to collapse/expand filter list
  • Loading branch information
SSilence committed May 2, 2016
2 parents 83fe5b1 + 0873875 commit f66195c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
16 changes: 16 additions & 0 deletions public/css/style.css
Expand Up @@ -87,7 +87,23 @@ body * {
#nav-mark:hover {
color:#000000;
}

#nav-filter-wrapper {
overflow:hidden;
}

.nav-filter-collapsed {
cursor:pointer;
padding-left: 20px;
background: url(images/nav-collapsed.png) center left no-repeat;
}

.nav-filter-expanded {
cursor:pointer;
padding-left: 20px;
background: url(images/nav-expanded.png) center left no-repeat;
}

#nav-filter-title {
margin-top:20px;
}
Expand Down
11 changes: 11 additions & 0 deletions public/js/selfoss-events-navigation.js
Expand Up @@ -51,6 +51,17 @@ selfoss.events.navigation = function() {
$('#nav-mobile-settings').click();
});

// hide/show filters
$('#nav-filter-title').unbind('click').click(function () {
$('#nav-filter').slideToggle( "slow", function() {
selfoss.events.resize();
});
$('#nav-filter-title').toggleClass("nav-filter-collapsed nav-filter-expanded");
$('#nav-filter-title').attr('aria-expanded', function (i, attr) {
return attr == 'true' ? 'false' : 'true';
});
});

// tag
$('#nav-tags > li').unbind('click').click(function () {
$('#nav-tags > li').removeClass('active');
Expand Down
4 changes: 3 additions & 1 deletion templates/home.phtml
Expand Up @@ -96,12 +96,14 @@
<button id="nav-mark"><?PHP echo \F3::get('lang_markread')?></button>

<?PHP $active = (\F3::get('homepage')) ? \F3::get('homepage') : 'newest' ?>
<h2 id="nav-filter-title"><?PHP echo \F3::get('lang_filter') ?></h2>
<div id="nav-filter-wrapper">
<h2 id="nav-filter-title" class="nav-filter-expanded" tabindex="0" aria-haspopup="true" aria-expanded="true"><?PHP echo \F3::get('lang_filter') ?></h2>
<ul id="nav-filter">
<li id="nav-filter-newest" class="nav-filter-newest<?PHP if($active=='newest') : ?> active<?PHP endif; ?>" role="link" tabindex="0"><?PHP echo \F3::get('lang_newest')?> <span><?PHP echo $this->statsAll; ?></span></li>
<li id="nav-filter-unread" class="nav-filter-unread<?PHP if($active=='unread') : ?> active<?PHP endif; ?>" role="link" tabindex="0"><?PHP echo \F3::get('lang_unread')?> <span class="unread-count<?PHP echo $this->statsUnread>0 ? ' unread' : ''; ?>"><?PHP echo $this->statsUnread; ?></span></li>
<li id="nav-filter-starred" class="nav-filter-starred<?PHP if($active=='starred') : ?> active<?PHP endif; ?>" role="link" tabindex="0"><?PHP echo \F3::get('lang_starred') ?> <span><?PHP echo $this->statsStarred; ?></span></li>
</ul>
</div>

<hr>

Expand Down

0 comments on commit f66195c

Please sign in to comment.