[Repoze-checkins] r1635 - in repoze.shootout/trunk: . repoze/shootout repoze/shootout/deliverance repoze/shootout/deliverance/rules repoze/shootout/resources repoze/shootout/resources/thewildwest repoze/shootout/resources/thewildwest/images repoze/shootout/templates
Carlos de la Guardia
cguardia at yahoo.com
Wed Aug 20 13:56:45 EDT 2008
Author: Carlos de la Guardia <cguardia at yahoo.com>
Date: Wed Aug 20 13:56:44 2008
New Revision: 1635
Log:
integration with deliverance with a Big Gun theme (work in progress); Added a tag cloud
Added:
repoze.shootout/trunk/repoze/shootout/deliverance/
repoze.shootout/trunk/repoze/shootout/deliverance/rules/
repoze.shootout/trunk/repoze/shootout/deliverance/rules/standardrules.xml
repoze.shootout/trunk/repoze/shootout/deliverance/rules/thewildwest.xml
repoze.shootout/trunk/repoze/shootout/resources/
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/default.css
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/bg.gif (contents, props changed)
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/bullet.gif (contents, props changed)
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/cbg.gif (contents, props changed)
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/fbg.gif (contents, props changed)
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/gun.jpg (contents, props changed)
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/listoff.gif (contents, props changed)
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/liston.gif (contents, props changed)
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/sbg.gif (contents, props changed)
repoze.shootout/trunk/repoze/shootout/resources/thewildwest/index.html
repoze.shootout/trunk/repoze/shootout/templates/cloud.pt
Modified:
repoze.shootout/trunk/repoze/shootout/configure.zcml
repoze.shootout/trunk/repoze/shootout/models.py
repoze.shootout/trunk/repoze/shootout/templates/idea.pt
repoze.shootout/trunk/repoze/shootout/templates/idea_add.pt
repoze.shootout/trunk/repoze/shootout/templates/main.pt
repoze.shootout/trunk/repoze/shootout/templates/tag.pt
repoze.shootout/trunk/repoze/shootout/templates/user.pt
repoze.shootout/trunk/repoze/shootout/templates/user_add.pt
repoze.shootout/trunk/repoze/shootout/views.py
repoze.shootout/trunk/setup.py
repoze.shootout/trunk/shootout.ini
Modified: repoze.shootout/trunk/repoze/shootout/configure.zcml
==============================================================================
--- repoze.shootout/trunk/repoze/shootout/configure.zcml (original)
+++ repoze.shootout/trunk/repoze/shootout/configure.zcml Wed Aug 20 13:56:44 2008
@@ -73,11 +73,24 @@
<bfg:view
for=".models.IRange"
+ view=".views.cloud_view"
+ name="cloud"
+ permission="view"
+ />
+
+ <bfg:view
+ for=".models.IRange"
view=".views.toolbar_view"
name="toolbar"
permission="view"
/>
+ <bfg:view
+ for=".models.IRange"
+ view=".views.static_view"
+ name="resources"
+ />
+
<utility
provides="repoze.bfg.interfaces.ISecurityPolicy"
factory="repoze.bfg.security.RemoteUserACLSecurityPolicy"
Added: repoze.shootout/trunk/repoze/shootout/deliverance/rules/standardrules.xml
==============================================================================
--- (empty file)
+++ repoze.shootout/trunk/repoze/shootout/deliverance/rules/standardrules.xml Wed Aug 20 13:56:44 2008
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rules xmlns:xi="http://www.w3.org/2001/XInclude" xmlns="http://www.plone.org/deliverance">
+ <prepend theme="//head" content="//head/link" nocontent="ignore" />
+ <prepend theme="//head" content="//head/style" nocontent="ignore" />
+ <append theme="//head" content="//head/script" nocontent="ignore" />
+ <append theme="//head" content="//head/meta" nocontent="ignore" />
+ <append-or-replace theme="//head" content="//head/title"
+ nocontent="ignore" />
+</rules>
Added: repoze.shootout/trunk/repoze/shootout/deliverance/rules/thewildwest.xml
==============================================================================
--- (empty file)
+++ repoze.shootout/trunk/repoze/shootout/deliverance/rules/thewildwest.xml Wed Aug 20 13:56:44 2008
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rules xmlns:xi="http://www.w3.org/2001/XInclude" xmlns="http://www.plone.org/deliverance" >
+ <xi:include href="standardrules.xml" />
+
+ <copy theme="//div[@id='menu']" content="//div[@id='menu']/*" nocontent="ignore"/>
+ <append theme="//div[@id='cloud']" content="//div[@id='cloud']/*" nocontent="ignore" />
+ <append theme="//div[@id='latest']" content="//div[@id='latest']/*" nocontent="ignore" />
+ <copy theme="//div[@id='toolbar']" content="//div[@id='toolbar']/*" nocontent="ignore" />
+ <prepend theme="//div[@id='message']" content="//div[@id='message']/*" nocontent="ignore" />
+ <prepend theme="//div[@id='sections']" content="//div[@id='sections']/*" nocontent="ignore" />
+ <copy theme="//div[@id='footer']" content="//div[@id='footer']/*" nocontent="ignore" />
+</rules>
Modified: repoze.shootout/trunk/repoze/shootout/models.py
==============================================================================
--- repoze.shootout/trunk/repoze/shootout/models.py (original)
+++ repoze.shootout/trunk/repoze/shootout/models.py Wed Aug 20 13:56:44 2008
@@ -93,6 +93,12 @@
def __init__(self, name):
self.name = name
+class IIdeaTag(Interface):
+ pass
+
+class IdeaTag(object):
+ implements(IIdeaTag)
+
tag_mapper = mapper(Tag, tags_table)
ideas_table = Table(
@@ -131,6 +137,8 @@
'tags':relation(Tag, secondary=ideas_tags_table, backref='ideas'),
})
+idea_tag_mapper = mapper(IdeaTag, ideas_tags_table)
+
class IRange(Interface):
pass
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/default.css
==============================================================================
--- (empty file)
+++ repoze.shootout/trunk/repoze/shootout/resources/thewildwest/default.css Wed Aug 20 13:56:44 2008
@@ -0,0 +1,434 @@
+/* SET MARGIN AND PADDING TO 0 FOR ALL ELEMENTS */
+* {
+margin: 0; padding: 0;
+}
+
+/* SET BASE FONT ATTRUBUTES */
+html, body {
+font: Georgia, "Times New Roman", Times, serif 14px/1.5em;
+color: #000;
+}
+
+/* REMOVE PADDING AND MARGIN VALUES */
+html, body, h1, h2, h3, h4, h5, h6, p, ul, ol, dl, li, dd, dt, img,
+blockquote, q, table, thead, tbody, tfoot, caption, th, tr, td, a, form,
+input, textarea, fieldset, pre
+{margin: 0; padding: 0;}
+
+/* SORT OUT HEADER FORMATTING AND SIZES */
+h1, h2, h3, h4, h5 {font-weight: bold;}
+
+h1 {font-size: 2em;}
+h2 {font-size: 1.75em;}
+h3 {font-size: 1.5em;}
+h4 {font-size: 1.2em;}
+h5 {font-size: 1.1em;}
+h6 {font-size: 1em;}
+
+/* HARMONIZE LINKS, KILL BORDER ON IMG LINKS */
+a {text-decoration: underline;}
+a:link, a:visited {color: #00f;}
+a:hover {color: #33f;}
+a:active {color: #fff;}
+a img, :link img, :visited img {border: none}
+
+/* REMOVE BROWSERS DEFAULT TABLE BORDERS */
+table {border-collapse: collapse;}
+
+/* REMOVE AUTOMATIC TOP/BOTTOM MARGINS ON NESTED LISTS */
+ul ul, ul ol, ul dir, ul menu, ul dl,
+ol ul, ol ol, ol dir, ol menu, ol dl,
+dir ul, dir ol, dir dir, dir menu, dir dl,
+menu ul, menu ol, menu dir, menu menu, menu dl,
+dl ul, dl ol, dl dir, dl menu, dl dl
+{margin-top: 0; margin-bottom: 0;}
+
+/* HARMONISE LIST-BULLET TYPE */
+ul, ol, dl {list-style-type: disc;}
+
+body {
+ background: #666;
+}
+
+body, input, textarea, select {
+ font: normal small "Trebuchet MS", Arial, Helvetica, sans-serif;
+ color: #333;
+ margin: 5px auto;
+}
+
+h1, h2, h3 {
+ margin-bottom: 1em;
+ font-weight: normal;
+ color: #975700;
+}
+
+h1 {
+ font-size: 2.2em;
+}
+
+h2 {
+ font-size: 1.7em;
+}
+
+h3 {
+ font-size: 1em;
+ font-weight: bold;
+}
+
+p, blockquote, ul, ol, form {
+ margin-bottom: 1.5em;
+}
+
+blockquote, ul, ol {
+ margin-left: 3em;
+}
+
+blockquote {
+ margin-right: 3em;
+ font-style: italic;
+}
+
+ul {
+ list-style-type: square;
+}
+
+a {
+ color: #975700;
+}
+
+a:hover {
+ text-decoration: none;
+}
+
+a:link, a:visited {color: #975700;}
+
+
+/* Wrapper */
+
+#wrapper {
+ width: 942px;
+ margin: 0px auto;
+ background-color: #FFFFFF;
+}
+
+/* Header */
+
+#header {
+ height: 257px;
+ width: 942px;
+ position: relative;
+ background: #E6CD91 url(images/gun.jpg) no-repeat;
+ margin: 0px auto;
+}
+
+#header h1, #header h2 {
+}
+
+#header h1 {
+ position: absolute;
+ top: 13px;
+ left: 20px;
+ font-size: 3em;
+ letter-spacing: -2px;
+ text-decoration: none;
+ color: #FFF;
+}
+
+#header h2 {
+ position: absolute;
+ top: 55px;
+ left: 30px;
+ font-size: 1em;
+ text-decoration: none;
+ color: #FFF;
+}
+
+#header:after {
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+/* Menu */
+
+#menu
+{
+ width: 928px;
+ position: absolute;
+ margin: -40px 0;
+}
+
+#menu ul
+{
+ list-style: none;
+ text-align: right;
+ padding: 10px 0px 10px 0px;
+ margin: 0;
+}
+
+#menu li
+{
+ padding: 0em 0.7em 0em 0.7em;
+ display: inline;
+}
+
+#menu li a
+{
+ color: #FFFFFF;
+ font-weight: bold;
+ text-decoration: none;
+ border-bottom: 1px dotted #FFFFFF;
+ font-size: 1.2em;
+}
+
+#menu li a.active
+{
+ border-bottom: 4px solid #FFFFFF;
+}
+
+#menu li a:hover
+{
+ border-bottom: 4px solid #FFFFFF;
+}
+
+/* tags */
+
+.tags {
+}
+
+.tags a {
+ color: #FFFFFF;
+ background-color: #975700;
+ margin: 3px 1px 3px 1px;
+ padding: 1px 3px;
+ text-decoration: none;
+ font-size: 80%;
+}
+
+/* Content */
+
+#content {
+ background: #FFFFFF url(images/bg.gif) repeat-y;
+ border-top: 5px solid #C48C05;
+ border-bottom: 1px solid #C48C05;
+ margin: 0px auto;
+ width: 928px;
+}
+
+/* Blog */
+
+#main {
+ float: right;
+ width: 678px !important;
+ width: 675px; /*IE6 3px problem */
+ margin: 0px auto;
+}
+
+/* Post */
+
+#sections {
+ padding-bottom: 20px;
+}
+
+#sections .title {
+ height: 30px;
+ border-top: 1px solid #C48C05;
+ text-transform: uppercase;
+ font-size: small;
+ font-weight: bold;
+ padding: 5px 10px 0px 10px;
+ background: #FFF url(images/cbg.gif) repeat-x;
+}
+
+#sections .title a {
+ text-decoration: none;
+}
+
+#sections .title a:hover {
+ text-decoration: underline;
+}
+
+#sections .byline{
+ margin-top: -73px;
+ text-align: right;
+ font-size: 90%;
+ padding: 0px;
+ color: #975700;
+}
+
+#sections .idea {
+ font-weight: bold;
+ font-size: 110%;
+}
+
+#sections .text {
+ padding: 10px 20px 10px 20px;
+ line-height: 1.8em;
+}
+
+#sections h1 {
+ margin: 25px 5px 5px 5px;
+}
+
+#sections p {
+ text-align: justify;
+ font-size: 120%;
+ margin: 5px 5px 5px 5px;
+}
+
+#sections ul {
+ list-style: none;
+}
+
+#sections .meta {
+ padding: 0 15px;
+ font-size: x-small;
+ color: #333;
+}
+
+.text h1, .text h2, .text h3 {
+ color: #333;
+}
+
+/* Sidebar */
+
+#sidebar {
+ float: left;
+ width: 250px;
+ padding-top: 5px;
+ margin: 0px auto;
+ border-top: 1px solid #C48C05;
+}
+
+#sidebar div {
+ margin: 0;
+ padding: 0 10px;
+}
+
+#sidebar div {
+ margin-bottom: 35px;
+ background: url(images/sbg.gif) repeat-x;
+}
+
+#sidebar div ul {
+ line-height: 1.5em;
+ list-style-type: none;
+ padding: 5px 0px 0px 0px;
+}
+
+#sidebar div li {
+ margin: 0;
+ color: #975700;
+}
+
+#sidebar h2 {
+ border-bottom: 3px solid #C48C05;
+ text-transform: uppercase;
+ font-size: small;
+ font-weight: bold;
+ margin: 0px;
+}
+
+#sidebar li a {
+ text-decoration: none;
+ color: #975700;
+ padding-left: 15px;
+ background: transparent url(images/listoff.gif) left center no-repeat;
+}
+
+#sidebar li a:hover {
+ text-decoration: none;
+ color: #530000;
+ background: transparent url(images/liston.gif) left center no-repeat;
+}
+
+/* Search */
+
+#search {
+}
+
+#search h2 {
+}
+
+#search form {
+}
+
+#search #inputtext1 {
+}
+
+#search #inputsubmit1 {
+}
+
+/* Archives */
+
+#archives {
+}
+
+/* Categories */
+
+#categories {
+}
+
+/* Blogroll */
+
+#blogroll {
+}
+
+/* Meta */
+
+#meta {
+}
+
+/* Footer */
+
+#footer {
+ width: 928px;
+ height: 50px;
+ margin: 0px auto;
+ background: #CDE691 url(images/fbg.gif) repeat-x;
+}
+
+#footer p {
+ margin: 0;
+ padding: 10px 0;
+ text-align: center;
+ font-size: x-small;
+}
+
+#footer a {
+}
+
+#toolbar {
+ float: right;
+ font-size: 90%;
+}
+
+.hits {
+ color: green;
+ font-weight: bold;
+}
+
+.hits0 {
+ color: black;
+}
+
+.misses {
+ font-weight: bold;
+ color: red;
+}
+
+.misses0 {
+ color: black;
+}
+
+#cloud {
+ margin: 10px 10px 30px 10px;
+}
+
+#cloud a {
+ font-weight: bold;
+ padding: 2px 3px;
+ text-decoration: none;
+}
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/bg.gif
==============================================================================
Binary file. No diff available.
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/bullet.gif
==============================================================================
Binary file. No diff available.
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/cbg.gif
==============================================================================
Binary file. No diff available.
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/fbg.gif
==============================================================================
Binary file. No diff available.
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/gun.jpg
==============================================================================
Binary file. No diff available.
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/listoff.gif
==============================================================================
Binary file. No diff available.
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/liston.gif
==============================================================================
Binary file. No diff available.
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/images/sbg.gif
==============================================================================
Binary file. No diff available.
Added: repoze.shootout/trunk/repoze/shootout/resources/thewildwest/index.html
==============================================================================
--- (empty file)
+++ repoze.shootout/trunk/repoze/shootout/resources/thewildwest/index.html Wed Aug 20 13:56:44 2008
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>The Wild West</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link href="default.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<div id="wrapper">
+ <div id="header">
+ <h1>Shootout</h1>
+ <h2>repoze.bfg demo app</h2>
+ </div>
+ <div id="menu">
+ <ul>
+ <li><a href="/" class="active">Home</a></li>
+ <li><a href="/about">About this demo</a></li>
+ </ul>
+ </div>
+ <div id="content">
+ <div id="sidebar">
+ <h2>Tag cloud</h2>
+ <div id="cloud">
+ </div>
+ <h2>Latest</h2>
+ <div id="latest">
+ </div>
+ </div>
+ <div id="main">
+ <div id="toolbar"></div>
+ <div id="message"></div>
+ <div id="sections">
+ </div>
+ </div>
+ <div style="clear: both; height: 1px;"></div>
+ </div>
+ <div id="footer">
+ <p>Copyright © 2008 <a href="http://www.delaguardia.com.mx">Carlos de la Guardia</a>. Powered by <a href="http://www.repoze.org/bfg">repoze.bfg</a>. Design by <a href="http://www.sumanasa.com/">Sumanasa.com</a>.</p>
+ </div>
+</div>
+</body>
+</html>
Added: repoze.shootout/trunk/repoze/shootout/templates/cloud.pt
==============================================================================
--- (empty file)
+++ repoze.shootout/trunk/repoze/shootout/templates/cloud.pt Wed Aug 20 13:56:44 2008
@@ -0,0 +1,4 @@
+<div id="cloud" xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:tal="http://xml.zope.org/namespaces/tal">
+ <a tal:repeat="tag cloud" href="${app_url}/tags/${tag[0]}" style="font-size: ${tag[2]}px">${tag[0]}</a>
+ </div>
Modified: repoze.shootout/trunk/repoze/shootout/templates/idea.pt
==============================================================================
--- repoze.shootout/trunk/repoze/shootout/templates/idea.pt (original)
+++ repoze.shootout/trunk/repoze/shootout/templates/idea.pt Wed Aug 20 13:56:44 2008
@@ -1,11 +1,14 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head></head>
-<body>
- <div id="home_link">
- <p><a href="${app_url}">Back to home page</a></p>
+ <head>
+ <title>Shootout</title>
+ </head>
+ <body>
+ <div id="menu">
+ <ul><li><a href="${app_url}">Back to home page</a></li></ul>
</div>
<div tal:replace="structure toolbar" />
+ <div id="sections">
<h1>${idea.title}</h1>
<p>Tags: <ul class="tag-list"><li tal:repeat="tag idea.tags"><a href="${app_url}/tags/${tag.name}">${tag.name}</a></li></ul></p>
<p>By <a href="${app_url}/users/${poster.username}">${poster.name}</a>.</p>
@@ -29,5 +32,6 @@
<li tal:repeat="comment comments"><span class="tags"><a tal:repeat="tag comment.tags" href="${app_url}/tags/${tag.name}">${tag.name}</a></span> <a href="${app_url}/ideas/${comment.idea_id}">${comment.title}</a>, by ${comment.users.name} (+${comment.hits}, -${comment.misses}).</li>
</ul>
</div>
+ </div>
</body>
</html>
Modified: repoze.shootout/trunk/repoze/shootout/templates/idea_add.pt
==============================================================================
--- repoze.shootout/trunk/repoze/shootout/templates/idea_add.pt (original)
+++ repoze.shootout/trunk/repoze/shootout/templates/idea_add.pt Wed Aug 20 13:56:44 2008
@@ -1,14 +1,17 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head></head>
+ <head>
+ <title>Shootout</title>
+ </head>
<body>
- <div id="home_link">
- <p><a href="${app_url}">Back to home page</a></p>
+ <div id="menu">
+ <ul><li><a href="${app_url}">Back to home page</a></li></ul>
</div>
<div tal:replace="structure toolbar" />
<div id="message" tal:condition="message">
<p>${message}</p>
</div>
+ <div id="sections">
<h1>Add ${kind}</h1>
<div class="instructions" tal:condition="target">
<p>You are commenting on <a href="${app_url}/ideas/${target.idea_id}">${target.title}</a>, by <a href="${app_url}/users/${target.users.username}">${target.users.name}</a>.</p>
@@ -31,5 +34,6 @@
<input type="submit" name="form.submitted" value="Shoot" />
</fieldset>
</form>
+ </div>
</body>
</html>
Modified: repoze.shootout/trunk/repoze/shootout/templates/main.pt
==============================================================================
--- repoze.shootout/trunk/repoze/shootout/templates/main.pt (original)
+++ repoze.shootout/trunk/repoze/shootout/templates/main.pt Wed Aug 20 13:56:44 2008
@@ -1,21 +1,35 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head></head>
-<body>
+ <head>
+ <title>Shootout</title>
+ </head>
+ <body>
+ <div id="menu">
+ <ul><li><a href="${app_url}/about">About this demo</a></li></ul>
+ </div>
<div id="message" tal:condition="message">
<p>${message}</p>
</div>
<div tal:replace="structure toolbar" />
+ <div tal:replace="structure cloud" />
+ <div id="latest" tal:condition="toplists">
+ <ul tal:define="latest toplists[0]">
+ <li tal:repeat="idea latest['items']"><a class="idea" href="${app_url}/ideas/${idea.idea_id}">${idea.title}</a>.</li>
+ </ul>
+ </div>
+ <div id="sections">
<h1>The Shooting Range</h1>
<p>This is a place to discuss and vote on ideas of all kind. Want to know what others think about your idea? Give it a shot.</p>
- <p><a href="idea_add">What's your idea?</a></p>
+ <p tal:condition="username"><a href="idea_add">What's your idea?</a></p>
+ <p tal:condition="not username">You need to <a href="${app_url}/register">register</a> to be able to post.</p>
<div tal:condition="toplists">
<div tal:repeat="toplist toplists">
- <h3>${toplist['title']}</h3>
+ <h3 class="title">${toplist['title']}</h3>
<ul>
- <li tal:repeat="idea toplist['items']"><span class="tags"><a tal:repeat="tag idea.tags" href="${app_url}/tags/${tag.name}">${tag.name}</a></span> <a href="${app_url}/ideas/${idea.idea_id}">${idea.title}</a>, by <a href="${app_url}/users/${idea.users.username}">${idea.users.name}</a> (+${idea.hits}, -${idea.misses}).</li>
+ <li tal:repeat="idea toplist['items']"><span class="tags"><a tal:repeat="tag idea.tags" href="${app_url}/tags/${tag.name}">${tag.name}</a></span> <a class="idea" href="${app_url}/ideas/${idea.idea_id}">${idea.title}</a>,by <a class="byline" href="${app_url}/users/${idea.users.username}">${idea.users.name}</a> <span class="hits hits${idea.hits}">${idea.hits}</span> hits, <span class="misses misses${idea.misses}">${idea.misses}</span> misses.</li>
</ul>
</div>
</div>
+ </div>
</body>
</html>
Modified: repoze.shootout/trunk/repoze/shootout/templates/tag.pt
==============================================================================
--- repoze.shootout/trunk/repoze/shootout/templates/tag.pt (original)
+++ repoze.shootout/trunk/repoze/shootout/templates/tag.pt Wed Aug 20 13:56:44 2008
@@ -1,14 +1,18 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head></head>
-<body>
- <div id="home_link">
- <p><a href="${app_url}">Back to home page</a></p>
+ <head>
+ <title>Shootout</title>
+ </head>
+ <body>
+ <div id="menu">
+ <ul><li><a href="${app_url}">Back to home page</a></li></ul>
</div>
<div tal:replace="structure toolbar" />
+ <div id="sections">
<h1>${tag}</h1>
<ul>
<li tal:repeat="idea ideas"><span class="tags"><a tal:repeat="tag idea.tags" href="${app_url}/tags/${tag.name}">${tag.name}</a></span> <a href="${app_url}/ideas/${idea.idea_id}">${idea.title}</a>, by ${idea.users.name} (+${idea.hits}, -${idea.misses}).</li>
</ul>
+ </div>
</body>
</html>
Modified: repoze.shootout/trunk/repoze/shootout/templates/user.pt
==============================================================================
--- repoze.shootout/trunk/repoze/shootout/templates/user.pt (original)
+++ repoze.shootout/trunk/repoze/shootout/templates/user.pt Wed Aug 20 13:56:44 2008
@@ -1,11 +1,14 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head></head>
-<body>
- <div id="home_link">
- <p><a href="${app_url}">Back to home page</a></p>
+ <head>
+ <title>Shootout</title>
+ </head>
+ <body>
+ <div id="menu">
+ <ul><li><a href="${app_url}">Back to home page</a></li></ul>
</div>
<div tal:replace="structure toolbar" />
+ <div id="sections">
<h1>${user.name}</h1>
<p>login: <b>${user.username}</b>.</p>
<h3>Performance</h3>
@@ -14,5 +17,6 @@
<h3>Vote history</h3>
<p>Hits: <b>${user.delivered_hits}</b>.</p>
<p>Misses: <b>${user.delivered_misses}</b>.</p>
+ </div>
</body>
</html>
Modified: repoze.shootout/trunk/repoze/shootout/templates/user_add.pt
==============================================================================
--- repoze.shootout/trunk/repoze/shootout/templates/user_add.pt (original)
+++ repoze.shootout/trunk/repoze/shootout/templates/user_add.pt Wed Aug 20 13:56:44 2008
@@ -1,14 +1,17 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal">
-<head></head>
-<body>
- <div id="home_link">
- <p><a href="${app_url}">Back to home page</a></p>
+ <head>
+ <title>Shootout</title>
+ </head>
+ <body>
+ <div id="menu">
+ <ul><li><a href="${app_url}">Back to home page</a></li></ul>
</div>
<div tal:replace="structure toolbar" />
<div id="message" tal:condition="message">
<p>${message}</p>
</div>
+ <div id="sections">
<h1>Register</h1>
<form action="register" method="post">
<fieldset>
@@ -30,5 +33,6 @@
<input type="submit" name="form.submitted" value="Register" />
</fieldset>
</form>
+ </div>
</body>
</html>
Modified: repoze.shootout/trunk/repoze/shootout/views.py
==============================================================================
--- repoze.shootout/trunk/repoze/shootout/views.py (original)
+++ repoze.shootout/trunk/repoze/shootout/views.py Wed Aug 20 13:56:44 2008
@@ -1,14 +1,24 @@
import sha
+import os
+import math
import webob
import formencode
from webob.exc import HTTPFound
+from paste import urlparser
+
+from sqlalchemy.sql import func
+
+from repoze.bfg.wsgi import wsgiapp
from repoze.bfg.template import render_template_to_response, render_template
from repoze.bfg.security import authenticated_userid
from repoze.shootout.models import DBSession
-from repoze.shootout.models import User, Idea, Tag
+from repoze.shootout.models import User, Idea, Tag, IdeaTag
+
+here = os.path.abspath(os.path.dirname(__file__))
+static = urlparser.StaticURLParser(os.path.join(here, 'resources', '..'))
COOKIE_VOTED = 'repoze.shootout.voted'
@@ -26,9 +36,11 @@
{'title':'Best performance','items':hitpct},
]
return render_template_to_response('templates/main.pt',
+ username = authenticated_userid(request),
app_url=request.application_url,
message=message,
toolbar=toolbar_view(context,request),
+ cloud=cloud_view(context,request),
toplists=toplists)
def idea_vote(context, request):
@@ -194,3 +206,19 @@
app_url=request.application_url,
viewer_username=viewer_username)
+def cloud_view(context, request):
+ tag_counts = DBSession.query(Tag.name, func.count('*')).join(IdeaTag).group_by(Tag.name).all()
+ total = sum([tag[1] for tag in tag_counts])
+ totalcounts = []
+ for tag in tag_counts:
+ weight = int((math.log(tag[1] or 1) * 4) + 10)
+ totalcounts.append((tag[0], tag[1],weight))
+ cloud = sorted(totalcounts, cmp=lambda x,y: cmp(x[0], y[0]))
+ return render_template('templates/cloud.pt',
+ app_url=request.application_url,
+ cloud=cloud)
+
+ at wsgiapp
+def static_view(environ, start_response):
+ return static(environ, start_response)
+
Modified: repoze.shootout/trunk/setup.py
==============================================================================
--- repoze.shootout/trunk/setup.py (original)
+++ repoze.shootout/trunk/setup.py Wed Aug 20 13:56:44 2008
@@ -13,6 +13,7 @@
'setuptools',
'repoze.bfg',
'repoze.who',
+ 'deliverance',
'SQLAlchemy',
]
import sys
Modified: repoze.shootout/trunk/shootout.ini
==============================================================================
--- repoze.shootout/trunk/shootout.ini (original)
+++ repoze.shootout/trunk/shootout.ini Wed Aug 20 13:56:44 2008
@@ -1,5 +1,7 @@
[DEFAULT]
debug = true
+theme = thewildwest
+theme_host = http://localhost:5430
[app:shootout]
use = egg:repoze.shootout#make_app
@@ -8,8 +10,14 @@
use = egg:repoze.who#config
config_file = %(here)s/who.ini
+[filter:deliverance]
+paste.filter_app_factory = deliverance.wsgimiddleware:make_filter
+theme_uri = %(theme_host)s/resources/%(theme)s/index.html?notheme
+rule_uri = file:///%(here)s/repoze/shootout/deliverance/rules/%(theme)s.xml
+
[pipeline:main]
-pipeline = who
+pipeline = deliverance
+ who
shootout
[server:main]
More information about the Repoze-checkins
mailing list