diff templates/base.html @ 349:fb3ce83c1a48

download: use sources.js instead of jinja static templates See http://mercurial.selenic.com/wiki/BinaryReleasePlan 1. [hg-website] update the main page (templates/base.html and static/js/download.js) to use sources.js as a dynamic binary release information source instead of using a jinja template maintained as part of the web site. templates/data no longer required; removed. 2. [hg-website-content] update the /downloads page use the sources.js information also. This changes some of the detection and package naming, naturally, but that likely must be addressed in latest.dat files or in the protocol for creating sources.js.
author David Champion <dgc@uchicago.edu>
date Sat, 20 Nov 2010 19:53:07 -0600
parents 871e9821b5b9
children bb27170e2218
line wrap: on
line diff
--- a/templates/base.html	Sat Nov 20 19:56:37 2010 -0600
+++ b/templates/base.html	Sat Nov 20 19:53:07 2010 -0600
@@ -1,5 +1,3 @@
-{% from 'data' import downloads %}
-
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
 <html>
@@ -8,16 +6,12 @@
         <link href="/css/styles.css" type="text/css" rel="stylesheet">
         <script type="text/javascript" src="/js/typeface.js"></script>
         <script type="text/javascript" src="/js/optimer_regular.typeface.js"></script>
+        <script type="text/javascript" src="/js/common.js"></script>
+        <script type="text/javascript" src="/sources.js"></script>
         <script type="text/javascript" src="/js/download.js"></script>
-        <script type="text/javascript" src="/js/common.js"></script>
-        <script language="javascript" type="text/javascript">
-        {% set download = downloads[downloads['current']] %}
-         var dl = new Download();
-         dl.register_download('Windows', "{{ download['Windows']}}");
-         dl.register_download('Mac OS X 10.6', "{{ download['Mac OS X 10.6']}}");
-         dl.register_download('Mac OS X 10.5', "{{ download['Mac OS X 10.5']}}");
-         dl.register_download('UNIX', "{{ download['Source code']}}");
-         dl.register_download('Linux', "{{ download['Source code']}}");
+        <script language="javascript">
+          Downloader.init(sources);
+          var dl = Downloader.select();
         </script>
         <link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico">
 
@@ -58,10 +52,10 @@
                     </div>
                     <div class="col">
                         {% block sidebar %}
-                        <a class="download typeface-js" href="/downloads" onClick="javascript:return dl.os_link();">
+                        <a class="download typeface-js" href="/downloads" onClick="return dl.download();">
                                     <strong>Download now</strong>
-                                    Mercurial <em>{{ downloads['current'] }}</em>
-                                    <span><script language="javascript">dl.os_detection();</script></span>
+                                    Mercurial <em><script language="Javascript">dl.write('version');</script></em>
+                                    <span><script language="javascript">dl.write('desc');</script></span>
                         </a>
                         <dl>
                             <dt>Another OS?<br><em>Get Mercurial for:</em></dt>