Permalink
Browse files

memory of active tab

  • Loading branch information...
1 parent 9ff39db commit cf615c671f9e84db79012bc8f86a6375a3517577 @ngokevin committed Feb 28, 2014
Showing with 20 additions and 18 deletions.
  1. +19 −17 hearth/media/js/navbar.js
  2. +1 −1 hearth/templates/_macros/act_tray.html
@@ -12,22 +12,6 @@ define('navbar', ['jquery', 'jquery.hammer', 'log', 'navigation', 'nunjucks', 's
nunjucks.env.render('nav.html', {z: z}));
});
- // Desktop account settings.
- function initActTray() {
- $('.act-tray:not(.mobile)').on('mouseover', function() {
- $(this).addClass('active');
- }).on('mouseout', function() {
- $(this).removeClass('active');
- }).on('click', '.account-links a', function() {
- $('.account-links, .settings, .act-tray').removeClass('active');
- });
- }
- initActTray();
- z.page.on('loaded', function() {
- $('.account-links, .settings').removeClass('active');
- });
- z.body.on('reloaded_chrome', initActTray);
-
// Navbar settings + Marketplace buttons.
function initNavbarButtons() {
var $mktNavGroup = $('.nav-mkt , .act-tray.mobile');
@@ -43,9 +27,11 @@ define('navbar', ['jquery', 'jquery.hammer', 'log', 'navigation', 'nunjucks', 's
}
// Toggle between Settings page and Marketplace pages.
- $('.act-tray.mobile').on('click', function() {
+ $('.act-tray.mobile').on('click', function(e) {
// Activate Settings page navbar.
+ e.preventDefault();
toggleNavbar($settingsNavGroup, $mktNavGroup);
+ z.page.trigger('navigate', $settingsNavGroup.find('li.active a').attr('href'));
});
$('.mkt-tray, .site').on('click', function() {
// Activate Marketplace pages navbar.
@@ -109,4 +95,20 @@ define('navbar', ['jquery', 'jquery.hammer', 'log', 'navigation', 'nunjucks', 's
.find('li').removeClass('active')
.eq(tabPos).addClass('active');
});
+
+ // Desktop.
+ function initActTray() {
+ $('.act-tray:not(.mobile)').on('mouseover', function() {
+ $(this).addClass('active');
+ }).on('mouseout', function() {
+ $(this).removeClass('active');
+ }).on('click', '.account-links a', function() {
+ $('.account-links, .settings, .act-tray').removeClass('active');
+ });
+ }
+ initActTray();
+ z.page.on('loaded', function() {
+ $('.account-links, .settings').removeClass('active');
+ });
+ z.body.on('reloaded_chrome', initActTray);
});
@@ -1,6 +1,6 @@
{% macro act_tray(mobile, is_settings) %}
<div class="act-tray{% if mobile %} mobile{% endif%}{% if not is_settings %} active{% endif %}">
- <a href="{{ url('settings') }}" class="header-button icon settings" title="{{ _('Settings') }}"></a>
+ <a{% if not mobile %} href="{{ url('settings') }}"{% endif %} class="header-button icon settings" title="{{ _('Settings') }}"></a>
<div class="account-links only-logged-in">
<ul>
<li>

0 comments on commit cf615c6

Please sign in to comment.