changeset 4810:6a825018a498

template: use mako block for root.html extra sections
author Mads Kiilerich <madski@unity3d.com>
date Wed, 11 Feb 2015 02:40:28 +0100
parents ec39e73be935
children 37354e1ab283
files kallithea/templates/admin/gists/edit.html kallithea/templates/admin/gists/new.html kallithea/templates/base/root.html kallithea/templates/files/diff_2way.html kallithea/templates/files/files_add.html kallithea/templates/files/files_edit.html kallithea/templates/journal/journal.html kallithea/templates/journal/public_journal.html kallithea/templates/summary/statistics.html kallithea/templates/summary/summary.html
diffstat 10 files changed, 70 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/admin/gists/edit.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/admin/gists/edit.html	Wed Feb 11 02:40:28 2015 +0100
@@ -8,14 +8,14 @@
     %endif
 </%def>
 
-<%def name="js_extra()">
-<script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
-<script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
-<script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
-</%def>
-<%def name="css_extra()">
-<link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
-</%def>
+<%block name="js_extra">
+  <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
+  <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
+  <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
+</%block>
+<%block name="css_extra">
+  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
+</%block>
 
 <%def name="breadcrumbs_links()">
     ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
--- a/kallithea/templates/admin/gists/new.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/admin/gists/new.html	Wed Feb 11 02:40:28 2015 +0100
@@ -8,14 +8,14 @@
     %endif
 </%def>
 
-<%def name="js_extra()">
-<script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
-<script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
-<script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
-</%def>
-<%def name="css_extra()">
-<link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
-</%def>
+<%block name="js_extra">
+  <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
+  <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
+  <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
+</%block>
+<%block name="css_extra">
+  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
+</%block>
 
 <%def name="breadcrumbs_links()">
     ${_('New Gist')}
--- a/kallithea/templates/base/root.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/base/root.html	Wed Feb 11 02:40:28 2015 +0100
@@ -13,8 +13,7 @@
         <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css', ver=c.kallithea_version)}" media="screen"/>
         <link rel="stylesheet" type="text/css" href="${h.url('/css/contextbar.css', ver=c.kallithea_version)}" media="screen"/>
         <link rel="stylesheet" type="text/css" href="${h.url('/fontello/css/kallithea.css', ver=c.kallithea_version)}">
-        <%def name="css_extra()"></%def>
-        ${self.css_extra()}
+        <%block name="css_extra"/>
 
         ## JAVASCRIPT ##
         <script type="text/javascript">
@@ -70,8 +69,7 @@
         <script type="text/javascript" src="${h.url('/js/pyroutes_map.js', ver=c.kallithea_version)}"></script>
         <script type="text/javascript" src="${h.url('/js/base.js', ver=c.kallithea_version)}"></script>
         ## EXTRA FOR JS
-        <%def name="js_extra()"></%def>
-        ${self.js_extra()}
+        <%block name="js_extra"/>
         <script type="text/javascript">
             (function(window,undefined){
                 var History = window.History; // Note: We are using a capital H instead of a lower h
@@ -107,8 +105,7 @@
              });
         </script>
 
-        <%def name="head_extra()"></%def>
-        ${self.head_extra()}
+        <%block name="head_extra"/>
     </head>
     <body id="body">
       ## IE hacks
--- a/kallithea/templates/files/diff_2way.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/files/diff_2way.html	Wed Feb 11 02:40:28 2015 +0100
@@ -2,14 +2,14 @@
 
 <%inherit file="/base/base.html"/>
 
-<%def name="js_extra()">
-<script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
-<script type="text/javascript" src="${h.url('/js/mergely.js')}"></script>
-</%def>
-<%def name="css_extra()">
-<link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
-<link rel="stylesheet" type="text/css" href="${h.url('/css/mergely.css')}"/>
-</%def>
+<%block name="js_extra">
+  <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
+  <script type="text/javascript" src="${h.url('/js/mergely.js')}"></script>
+</%block>
+<%block name="css_extra">
+  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
+  <link rel="stylesheet" type="text/css" href="${h.url('/css/mergely.css')}"/>
+</%block>
 
 <%def name="title()">
     ${_('%s File side-by-side diff') % c.repo_name}
--- a/kallithea/templates/files/files_add.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/files/files_add.html	Wed Feb 11 02:40:28 2015 +0100
@@ -7,14 +7,14 @@
     %endif
 </%def>
 
-<%def name="js_extra()">
-<script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
-<script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
-<script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
-</%def>
-<%def name="css_extra()">
-<link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
-</%def>
+<%block name="js_extra">
+  <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
+  <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
+  <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
+</%block>
+<%block name="css_extra">
+  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
+</%block>
 
 <%block name="header_menu">
     ${self.menu('repositories')}
--- a/kallithea/templates/files/files_edit.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/files/files_edit.html	Wed Feb 11 02:40:28 2015 +0100
@@ -7,14 +7,14 @@
     %endif
 </%def>
 
-<%def name="js_extra()">
-<script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
-<script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
-<script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
-</%def>
-<%def name="css_extra()">
-<link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
-</%def>
+<%block name="js_extra">
+  <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
+  <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
+  <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
+</%block>
+<%block name="css_extra">
+  <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
+</%block>
 
 <%block name="header_menu">
     ${self.menu('repositories')}
--- a/kallithea/templates/journal/journal.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/journal/journal.html	Wed Feb 11 02:40:28 2015 +0100
@@ -20,12 +20,12 @@
 <%block name="header_menu">
     ${self.menu('journal')}
 </%block>
-<%def name="head_extra()">
-<link href="${h.url('journal_atom', api_key=c.authuser.api_key)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
-<link href="${h.url('journal_rss', api_key=c.authuser.api_key)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
-</%def>
+<%block name="head_extra">
+  <link href="${h.url('journal_atom', api_key=c.authuser.api_key)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
+  <link href="${h.url('journal_rss', api_key=c.authuser.api_key)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
+</%block>
+
 <%def name="main()">
-
     <div class="box box-left">
         <!-- box / title -->
         <div class="title">
--- a/kallithea/templates/journal/public_journal.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/journal/public_journal.html	Wed Feb 11 02:40:28 2015 +0100
@@ -12,10 +12,10 @@
 <%block name="header_menu">
     ${self.menu('journal')}
 </%block>
-<%def name="head_extra()">
-<link href="${h.url('public_journal_atom')}" rel="alternate" title="${_('ATOM public journal feed')}" type="application/atom+xml" />
-<link href="${h.url('public_journal_rss')}" rel="alternate" title="${_('RSS public journal feed')}" type="application/rss+xml" />
-</%def>
+<%block name="head_extra">
+  <link href="${h.url('public_journal_atom')}" rel="alternate" title="${_('ATOM public journal feed')}" type="application/atom+xml" />
+  <link href="${h.url('public_journal_rss')}" rel="alternate" title="${_('RSS public journal feed')}" type="application/rss+xml" />
+</%block>
 <%def name="main()">
 
 <div class="box">
--- a/kallithea/templates/summary/statistics.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/summary/statistics.html	Wed Feb 11 02:40:28 2015 +0100
@@ -15,10 +15,10 @@
     ${self.menu('repositories')}
 </%block>
 
-<%def name="head_extra()">
-<link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
-<link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
-</%def>
+<%block name="head_extra">
+  <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
+  <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
+</%block>
 
 <%def name="main()">
 ${self.repo_context_bar('summary')}
--- a/kallithea/templates/summary/summary.html	Wed Feb 11 02:40:28 2015 +0100
+++ b/kallithea/templates/summary/summary.html	Wed Feb 11 02:40:28 2015 +0100
@@ -38,25 +38,24 @@
     ${self.menu('repositories')}
 </%block>
 
-<%def name="head_extra()">
-<link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
-<link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
-
-<script>
-redirect_hash_branch = function(){
+<%block name="head_extra">
+  <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
+  <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
+  
+  <script>
+  redirect_hash_branch = function(){
     var branch = window.location.hash.replace(/^#(.*)/, '$1');
     if (branch){
-        window.location = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}"
-            .replace('__BRANCH__',branch);
+      window.location = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}"
+        .replace('__BRANCH__',branch);
     }
-}
-redirect_hash_branch();
-window.onhashchange = function() {
+  }
+  redirect_hash_branch();
+  window.onhashchange = function() {
     redirect_hash_branch();
-};
-</script>
-
-</%def>
+  };
+  </script>
+</%block>
 
 <%def name="main()">
 ${self.repo_context_bar('summary')}