Permalink
Browse files

Alter leaderboard tabs to work well with new jQuery UI Tabs design ch…

…anges


Closes #248
  • Loading branch information...
1 parent 473c8fe commit 31297fc2ba844113efe83b19120903b6d937dd9c @kshepard kshepard committed Nov 23, 2011
Showing with 34 additions and 7 deletions.
  1. +15 −2 django/publicmapping/redistricting/templates/viewplan.html
  2. +19 −5 django/publicmapping/static/js/ui.js
@@ -690,13 +690,26 @@ <h3> Select the plan statistics you'd like included in a comprehensive report on
<div class="shadow_top"></div>
<div class="toolbar ui-widget-header" id="leaderboard_tabs">
<ul id="leaderboard_nav">
- <li id="tab_topranked"><a href="#leaderboard_topranked">{% trans "Top Ranked Users' Plans" %}</a><li>
+ <li id="tab_topranked"><a href="#leaderboard_topranked_surrogate">{% trans "Top Ranked Users' Plans" %}</a><li>
{% if is_registered %}
- <li id="tab_myranked"><a href="#leaderboard_myranked">{% trans "My Ranked Plans" %}</a></li>
+ <li id="tab_myranked"><a href="#leaderboard_myranked_surrogate">{% trans "My Ranked Plans" %}</a></li>
{% endif %}
</ul>
<div id="updateLeaderboardsContainer"></div>
<div id="downloadLeaderboardsContainer"></div>
+
+ {% comment %}
+
+ These two 'surrogate' divs are needed due to changes in the jQuery UI Tab control
+ that make it so the tab content divs are required to be within the parent tab control.
+ Without a complete stylistic redesign, the simplest workaround is to intercept tab
+ change events to these fake containers to hide/show the real containers (below).
+
+ {% endcomment %}
+ <div id="leaderboard_topranked_surrogate"></div>
+ {% if is_registered %}
+ <div id="leaderboard_myranked_surrogate"></div>
+ {% endif %}
</div>
<div class="tab_content">
@@ -288,14 +288,28 @@ $(function() {
}
}
});
- $('#leaderboard_tabs').tabs();
+
+ // leaderboard tabs construction
+ $('#leaderboard_tabs').tabs({
+ // implement surrogate behavior as a workaround to new jQuery UI Tab design changes.
+ select: function(e, ui) {
+ if (ui.index == 0) {
+ // Top ranked plans
+ $('#leaderboard_myranked').hide();
+ $('#leaderboard_topranked').show();
+ } else {
+ // My ranked plans
+ $('#leaderboard_topranked').hide();
+ $('#leaderboard_myranked').show();
+ }
+ }
+ });
+ // start myranked container as hidden
+ $('#leaderboard_myranked').hide();
+
$('#map_menu').tabs();
-
-
$('#toolsets').tabs();
-
-
// jQuery Tools tooltips
loadTooltips();

0 comments on commit 31297fc

Please sign in to comment.