From: Quentin Smith <quentin@mit.edu> Date: Sun, 9 Aug 2009 22:45:24 +0000 (-0400) Subject: skeleton and helloworld Mako templates X-Git-Tag: 0.1.0^2~69 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/cda42d0259dad581350a802aaccb6a0c4f6bc5fd skeleton and helloworld Mako templates svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2666 --- diff --git a/code/templates/helloworld.mako b/code/templates/helloworld.mako new file mode 100644 index 0000000..22111a1 --- /dev/null +++ b/code/templates/helloworld.mako @@ -0,0 +1,7 @@ +<%inherit file="skeleton.mako" /> + +Hello world! + +<%def name="title()"> +helloworld +</%def> diff --git a/code/templates/skeleton.tmpl b/code/templates/skeleton.mako similarity index 61% rename from code/templates/skeleton.tmpl rename to code/templates/skeleton.mako index e71348c..0fd67e3 100644 --- a/code/templates/skeleton.tmpl +++ b/code/templates/skeleton.mako @@ -1,12 +1,9 @@ -#from functions import functions -#extends functions - -#def full_body +<%page expression_filter="h"/> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> -<head><title>$title — XVM</title> +<head><title>${self.title()} — XVM</title> <link href="static/favicon.ico" type="image/x-icon" rel="shortcut icon"> <link rel="stylesheet" href="static/style.css" type="text/css" /> <link rel="stylesheet" href="static/layout.css" type="text/css" media="screen" /> @@ -30,51 +27,56 @@ function helppopup(name){ </script> </head> <body id="body" -#if hasattr($self, 'pageclass'): - class="$pageclass" -#end if +% if hasattr(self.attr, 'pageclass'): + class="${self.attr.pageclass}" +% endif > -#if False +% if False: <div> <p>We are in the process of modifying the service. Things likely will not work.</p> </div> -#end if +% endif +% if error_text is not UNDEFINED: <div id="err"> -#if $varExists('error_text') -<p>STDERR:</p><pre>$error_text</pre> -#end if +<p>STDERR:</p><pre>${error_text}</pre> </div> +% endif -#if not $varExists('simple') or not $simple -<p class="loggedin">Welcome, <span class="name">$user</span>.</p> +% if not simple: +% if user: +<p class="loggedin">Welcome, <span class="name">${user}</span>.</p> +% endif <ul class="navigation"> <li><a href="list">List</a></li> -#if $varExists('machine') -<li><a href="info?machine_id=$machine.machine_id">Info</a></li> -<li><a href="vnc?machine_id=$machine.machine_id">Console</a></li> -#end if +% if machine: +<li><a href="info?machine_id=${machine.machine_id}">Info</a></li> +<li><a href="vnc?machine_id=${machine.machine_id}">Console</a></li> +% endif <li><a href="help">Help</a></li> </ul> -#end if + +% endif + <div id="result" class="result"> -#if $varExists('result') -$result -#end if +% if result: +${result} +% endif </div> -#if not $varExists('simple') or not $simple -<h1>$title — XVM</h1> -#end if -#filter None -$body -#end filter -#if not $varExists('simple') or not $simple +% if not simple: +<h1>${self.title()} — XVM</h1> +% endif +${next.body()} +% if not simple: <hr /> Questions? Contact <a href="mailto:xvm@mit.edu">xvm@mit.edu</a>. -#end if +% endif </body> </html> -#end def + +<%def name="title()"> +XVM +</%def>