[Qa-jenkins-scm] [jenkins.debian.net] 01/10: reproducible debian: show the "show all" button when summary tag supported

Holger Levsen holger at layer-acht.org
Thu Jul 28 18:14:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 1b4dc1b3191e3623a0eeb7cacef80be1ab71d0a2
Author: Valerie R Young <spectranaut at riseup.net>
Date:   Mon Jul 25 18:06:00 2016 -0400

    reproducible debian: show the "show all" button when summary tag supported
    
    The "summary" tag is presentally not supported in firefox... but will be with
    the release of firefox version 48 in August 2016! In the meantime, this
    commit hides the "see all package sets in suite/arch" button on the package
    set pages used to expand all the summary tags for firefox.
    
    Once Firefox 48 is released, this commit should be reverted.
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_common.py                |  3 ++-
 bin/reproducible_html_pkg_sets.py         |  2 +-
 bin/templates/basic_page.mustache         | 17 ++++++++++-------
 bin/templates/pkgset_navigation.mustache  |  2 +-
 userContent/reproducible/static/pkgset.js |  9 +++++++++
 userContent/reproducible/static/style.css |  4 ++++
 6 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index dd67f46..92813e0 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -310,7 +310,7 @@ def create_main_navigation(suite=defaultsuite, arch=defaultarch,
 
 def write_html_page(title, body, destfile, no_header=False, style_note=False,
                     noendpage=False, refresh_every=None, displayed_page=None,
-                    left_nav_html=None):
+                    left_nav_html=None, include_pkgset_js=None):
     meta_refresh_html = '<meta http-equiv="refresh" content="%d"></meta>' % \
         refresh_every if refresh_every is not None else ''
     if style_note:
@@ -325,6 +325,7 @@ def write_html_page(title, body, destfile, no_header=False, style_note=False,
         'main_header': title if not no_header else "",
         'main_html': body,
         'style_dot_css_sha1sum': REPRODUCIBLE_STYLE_SHA1,
+        'include_pkgset_js': include_pkgset_js,
     }
     html = renderer.render(basic_page_template, context)
 
diff --git a/bin/reproducible_html_pkg_sets.py b/bin/reproducible_html_pkg_sets.py
index c38370a..4050627 100755
--- a/bin/reproducible_html_pkg_sets.py
+++ b/bin/reproducible_html_pkg_sets.py
@@ -262,7 +262,7 @@ def create_pkgset_page_and_graphs(suite, arch, stats, pkgset_name):
     log.info("Creating meta pkgset page for %s in %s/%s.",
               pkgset_name, suite, arch)
     write_html_page(title=title, body=html_body, destfile=destfile,
-                    left_nav_html=left_nav_html)
+                    left_nav_html=left_nav_html, include_pkgset_js=True)
 
 
 def create_pkgset_graph(png_file, suite, arch, pkgset_name):
diff --git a/bin/templates/basic_page.mustache b/bin/templates/basic_page.mustache
index c84f95b..f5fe038 100644
--- a/bin/templates/basic_page.mustache
+++ b/bin/templates/basic_page.mustache
@@ -5,18 +5,21 @@
     <meta name="viewport" content="width=device-width" />
     {{{meta_refresh}}}
     <link href="/static/style.css?v={{style_dot_css_sha1sum}}" type="text/css" rel="stylesheet" />
+    {{#include_pkgset_js}}
+    <script type="text/JavaScript" src="/static/pkgset.js"></script>
+    {{/include_pkgset_js}}
     <title>{{page_title}}</title>
   </head>
   <body class="wrapper">
-	{{#navigation_html}}
-	<header class="head">
+    {{#navigation_html}}
+    <header class="head">
       {{{navigation_html}}}
-	</header>
-	{{/navigation_html}}
+    </header>
+    {{/navigation_html}}
     {{#navigation_html}}<div class="mainbody">{{/navigation_html}}
-	  {{#main_header}}
-	  <h2>{{main_header}}</h2>
-	  {{/main_header}}
+      {{#main_header}}
+      <h2>{{main_header}}</h2>
+      {{/main_header}}
       {{{main_html}}}
     {{#navigation_html}}</div>{{/navigation_html}}
   </body>
diff --git a/bin/templates/pkgset_navigation.mustache b/bin/templates/pkgset_navigation.mustache
index d975940..98bfd5c 100644
--- a/bin/templates/pkgset_navigation.mustache
+++ b/bin/templates/pkgset_navigation.mustache
@@ -1,6 +1,6 @@
 <ul>
   {{#pkgset_page}}
-  <li>
+  <li id="expand-all-pkgsets">
     <a href="/debian/{{suite}}/{{arch}}/index_pkg_sets.html"
        title="To switch suite and arch, see top left">
       All tracked package sets for <b>{{suite}}/{{arch}}</b>
diff --git a/userContent/reproducible/static/pkgset.js b/userContent/reproducible/static/pkgset.js
new file mode 100644
index 0000000..530679a
--- /dev/null
+++ b/userContent/reproducible/static/pkgset.js
@@ -0,0 +1,9 @@
+window.onload = function () {
+	var userAgent = navigator.userAgent.toLowerCase();
+	var version = /firefox\/(\d+)/.exec(userAgent);
+	if (!version || (version.length === 2 && version[1] > 48)) {
+		// Reveal the "expand-all-pkgset" button when not in firefox (where
+		// summary tags are not supported)
+		document.getElementById("expand-all-pkgsets").style.display='inline';
+	}
+}
diff --git a/userContent/reproducible/static/style.css b/userContent/reproducible/static/style.css
index bdc0e75..5ffd490 100644
--- a/userContent/reproducible/static/style.css
+++ b/userContent/reproducible/static/style.css
@@ -181,6 +181,10 @@ ul li {
 	font-weight: bold;
 }
 
+#expand-all-pkgsets {
+	display: none;
+}
+
 h1 {
 	font-size : 250%;
 	padding: 0;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list