Merge lp:~benoit.pierre/sloecode/yui3-menus-stopflash into lp:sloecode

Proposed by Benoit Pierre
Status: Merged
Merge reported by: Thomi Richards
Merged at revision: not available
Proposed branch: lp:~benoit.pierre/sloecode/yui3-menus-stopflash
Merge into: lp:sloecode
Diff against target: 57 lines (+15/-2)
3 files modified
sloecode/public/css/style.css (+3/-0)
sloecode/public/js/base-menu.js (+10/-0)
sloecode/templates/macros/nav.html (+2/-2)
To merge this branch: bzr merge lp:~benoit.pierre/sloecode/yui3-menus-stopflash
Reviewer Review Type Date Requested Status
sloecode Pending
Review via email: mp+80631@code.launchpad.net

Description of the change

Fix intermediate bad renderings for navigation bar menus during page load:
- menus briefly appear as rendered without javascript
- sub-menus briefly appear (project list, admin sub-menu)

Especially apparent in Chromium.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sloecode/public/css/style.css'
2--- sloecode/public/css/style.css 2011-09-04 07:37:07 +0000
3+++ sloecode/public/css/style.css 2011-10-27 22:42:23 +0000
4@@ -255,6 +255,9 @@
5 display: block;
6 }
7
8+/* Make sure sub-menus are initially hidden: */
9+.yui3-js-enabled .stopflash { visibility: hidden; }
10+
11 /* Force logout link to align to right of menu bar: */
12 .yui3-menubuttonnav li.forceright
13 {
14
15=== modified file 'sloecode/public/js/base-menu.js'
16--- sloecode/public/js/base-menu.js 2011-04-08 23:20:59 +0000
17+++ sloecode/public/js/base-menu.js 2011-10-27 22:42:23 +0000
18@@ -1,3 +1,5 @@
19+// Explicitly load CSS stylesheet to avoid (late) dynamic loading.
20+document.write('<link rel="stylesheet" type="text/css" href="/yui/3.3.0/build/node-menunav/assets/skins/sam/node-menunav.css">')
21 // Setup and render the main menu
22 YUI().use("node-menunav", function(Y) {
23 Y.on("contentready", function() {
24@@ -5,3 +7,11 @@
25 this.plug(Y.Plugin.NodeMenuNav);
26 }, "#main_menubar");
27 });
28+
29+YUI().use('event', function (Y) {
30+ Y.on("domready", function () {
31+ YUI().use('node', function(Y) {
32+ Y.all('.stopflash').setStyle('visibility', 'visible');
33+ });
34+ });
35+});
36
37=== modified file 'sloecode/templates/macros/nav.html'
38--- sloecode/templates/macros/nav.html 2011-10-24 20:31:09 +0000
39+++ sloecode/templates/macros/nav.html 2011-10-27 22:42:23 +0000
40@@ -38,7 +38,7 @@
41 <em>Projects</em>
42 </a>
43
44- <div id="proj_list" class="yui3-menu">
45+ <div id="proj_list" class="yui3-menu stopflash">
46 <div class="yui3-menu-content">
47 <ul>
48 {# List of projects that this user is in #}
49@@ -63,7 +63,7 @@
50 <em>Admin</em>
51 </a>
52
53- <div id="menu_admin" class="yui3-menu">
54+ <div id="menu_admin" class="yui3-menu stopflash">
55 <div class="yui3-menu-content">
56 <ul>
57 {% if h.has_site_role(h.USER_ADMIN) %}

Subscribers

People subscribed via source and target branches