[#1027] Convert ForgeChat templates to Jinja.

Paul Sokolovsky Paul Sokolovsky 2010-10-12

added ForgeChat/forgechat/templates/chat_index.html
removed ForgeChat/forgechat/templates/search.html
changed Allura/allura/config/app_cfg.py
changed ForgeChat/forgechat/main.py
copied ForgeChat/forgechat/templates/day.html -> ForgeChat/forgechat/templates/chat_search.html
copied ForgeChat/forgechat/templates/index.html -> ForgeChat/forgechat/templates/chat_day.html
ForgeChat/forgechat/templates/chat_index.html Diff Switch to side-by-side view
Loading...
Allura/allura/config/app_cfg.py Diff Switch to side-by-side view
Loading...
ForgeChat/forgechat/main.py Diff Switch to side-by-side view
Loading...
ForgeChat/forgechat/templates/day.html to ForgeChat/forgechat/templates/chat_search.html
--- a/ForgeChat/forgechat/templates/day.html
+++ b/ForgeChat/forgechat/templates/chat_search.html
@@ -1,31 +1,28 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:py="http://genshi.edgewall.org/"
-      xmlns:xi="http://www.w3.org/2001/XInclude">
+{% extends 'jinja_master/master.html' %}
 
-  <xi:include href="${g.allura_templates}/master.html"/>
+{% block title %}{{c.project.name}} / {{c.app.config.options.mount_label}} / Search{% endblock %}
 
-  <head>
-    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
-    <title>$c.project.name / $c.app.config.options.mount_label</title>
-  </head>
+{% block header %}ForgeChat Search{% endblock %}
 
-  <body>
-    <h1 class="title">$c.project.name / $c.app.config.options.mount_label</h1>
-    <div class="content">
-      <div class="row">
-        <div class="column grid_12">
-          <h2>Log for ${day.strftime('%Y-%m-%d')}</h2>
-          <a href="$prev">Earlier</a>...
-          <a href="$next">Later</a><br/>
-          <ul>
-            <li py:for="msg in messages" id="$msg._id">
-              ${Markup(msg.html_text)}
-            </li>
-          </ul>
-        </div>
-      </div>
-    </div>
-  </body>
-</html>
+{% block content %}
+          <form method="GET" action="search">
+            <input type="text" name="q" value="{{q}}"/><br/>
+            Search history? <input type="checkbox" name="history" {% if history %}checked="checked"{% endif %}/><br/>
+            <input type="submit" value="Search"/>
+          </form>
+          {% if count==0 and q %}
+            <p>No results.</p>
+          {% elif count==1 and q %}
+            <p>{{count}} result.</p>
+          {% elif count > 1 and q %}
+            <p>{{count}} results.</p>
+          {% endif %}
+          
+          {% for doc in results %}
+          <div>
+            <a href="{{doc['url_s']}}">{{doc.title_s}}</a><br/>
+            <pre>{{doc|pprint}}</pre>
+            <hr/>
+          </div>
+          {% endfor %}
+{% endblock %}
ForgeChat/forgechat/templates/index.html to ForgeChat/forgechat/templates/chat_day.html
--- a/ForgeChat/forgechat/templates/index.html
+++ b/ForgeChat/forgechat/templates/chat_day.html
@@ -1,28 +1,18 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:py="http://genshi.edgewall.org/"
-      xmlns:xi="http://www.w3.org/2001/XInclude">
+{% extends 'jinja_master/master.html' %}
 
-  <xi:include href="${g.allura_templates}/master.html"/>
+{% block title %}{{c.project.name}} / {{c.app.config.options.mount_label}}{% endblock %}
 
-  <head>
-    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
-    <title>$c.project.name / $c.app.config.options.mount_label</title>
-  </head>
+{% block header %}{{c.project.name}} / {{c.app.config.options.mount_label}}{% endblock %}
 
-  <body>
-    <h1>$c.project.name / $c.app.config.options.mount_label</h1>
-    <div class="content">
-      <div class="row">
-        <div class="column grid_12">
+{% block content %}
+          <h2>Log for {{day.strftime('%Y-%m-%d')}}</h2>
+          <a href="{{prev}}">Earlier</a>...
+          <a href="{{next}}">Later</a><br/>
           <ul>
-            <li py:for="msg in messages">
-              ${msg.timestamp.isoformat(' ')}: ${msg.sender.split('!')[0]}: $msg.text
+            {% for msg in messages %}
+            <li id="{{msg._id}}">
+              {{msg.html_text|safe}}
             </li>
+            {% endfor %}
           </ul>
-        </div>
-      </div>
-    </div>
-  </body>
-</html>
+{% endblock %}