From: Eevee <git@veekun.com> Date: Thu, 6 Aug 2009 16:43:01 +0000 (-0700) Subject: Index page lists titles of art in the "art" table. X-Git-Url: http://git.veekun.com/zzz-floof.git/commitdiff_plain/68a31d533aba7490c3f1f812075e8ab6eb9265d0 Index page lists titles of art in the "art" table. --- diff --git a/floof/config/routing.py b/floof/config/routing.py index 1fd081a..f78246a 100644 --- a/floof/config/routing.py +++ b/floof/config/routing.py @@ -20,6 +20,8 @@ def make_map(): map.connect('/error/{action}', controller='error') map.connect('/error/{action}/{id}', controller='error') + map.connect('/', controller='main', action='index') + map.connect('/account/login', controller='account', action='login') map.connect('/account/login_begin', controller='account', action='login_begin', **require_POST) map.connect('/account/login_finish', controller='account', action='login_finish') diff --git a/floof/controllers/main.py b/floof/controllers/main.py new file mode 100644 index 0000000..2b8b877 --- /dev/null +++ b/floof/controllers/main.py @@ -0,0 +1,15 @@ +import logging + +from pylons import request, response, session, tmpl_context as c +from pylons.controllers.util import abort, redirect_to + +from floof.lib.base import BaseController, render +from floof.model import meta, Art + +log = logging.getLogger(__name__) + +class MainController(BaseController): + + def index(self): + c.artwork = meta.Session.query(Art).order_by(Art.id.desc()).all() + return render('/index.mako') diff --git a/floof/model/__init__.py b/floof/model/__init__.py index e3f810d..d0f03b3 100644 --- a/floof/model/__init__.py +++ b/floof/model/__init__.py @@ -6,6 +6,7 @@ from floof.model import meta # Tables are defined in separate files and imported to here from floof.model.users import * +from floof.model.art import * def init_model(engine): """Call me before using any of the tables or classes in the model""" diff --git a/floof/model/art.py b/floof/model/art.py new file mode 100644 index 0000000..8cfcd5a --- /dev/null +++ b/floof/model/art.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, ForeignKey +from sqlalchemy.orm import relation +from sqlalchemy.types import Integer, Unicode + +from floof.model import meta + +__all__ = ['Art'] + +class Art(meta.TableBase): + __tablename__ = 'art' + id = Column(Integer, primary_key=True) + title = Column(Unicode(length=120), nullable=False) diff --git a/floof/public/bg.png b/floof/public/bg.png deleted file mode 100644 index 69c1798..0000000 Binary files a/floof/public/bg.png and /dev/null differ diff --git a/floof/public/favicon.ico b/floof/public/favicon.ico deleted file mode 100644 index 21e215e..0000000 Binary files a/floof/public/favicon.ico and /dev/null differ diff --git a/floof/public/index.html b/floof/public/index.html deleted file mode 100644 index 0719061..0000000 --- a/floof/public/index.html +++ /dev/null @@ -1,137 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!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" xml:lang="en" lang="en"> - <head> - <title>Welcome to Pylons!</title> - <style type="text/css"> - body { - font-family: arial, helvetica, sans-serif; - background-color: #ffc900; - background-image: url(bg.png); - background-repeat: repeat-x; - width:100%; - height:100%; - margin:0; - max-height: 100%; - padding:0; - border:none; - line-height:1.4; - } - #container { - color:white; - background-color:#111; - position: absolute; - left: 50%; - width: 500px; - margin-left: -300px; - padding:50px; - height:100%; - } - #footer { - margin: 120px 0 0 0; - padding: 3px; - text-align:center; - font-size:small; - background-color:#222; - letter-spacing: 1px; - } - h1 { - text-align:center; - font-size:xx-large; - font-weight:normal; - margin: 0 0 20px 0; - border:none; - padding:0; - letter-spacing: 5px; - } - h2 { - font-size:xx-large; - font-weight:normal; - margin: 0 0 20px 0; - border:none; - padding:0; - } - hr { - margin-bottom:30px; - border: 1px solid #222; - background-color: #222; - padding: 2px; - } - #logo { - background-image: url(signum8b_spk.png); - background-repeat: no-repeat; - height: 0; - overflow: hidden; - padding-top: 99px; - width: 239px; - } - #left { - float:left; - width:250px; - margin:0 50px 0 0; - border:none; - padding:0 0 0 10px; - } - #right { - margin:0 0 0 330px; - border:none; - padding:0; - } - ul { - list-style:none; - margin:0; - border:none; - padding:0; - } - a:visited { - color:white; - text-decoration:none; - } - a:link { - color:white; - text-decoration:none; - }</style> - </head> - <body> - <div id="container"> - <h1>Welcome to <img src="pylons-logo.gif" alt="Logo displaying the word Pylons" - style="vertical-align:-15px; width: 250px;"/> - </h1> - <hr/> - <div id="left"> - <h2>Let's begin!</h2> - <p>If you haven't used Pylons before, start with the <a href="http://pylonshq.com/docs/en/0.9.7/gettingstarted/" - style="text-decoration:underline;">beginners' tutorial</a>.</p> - </div> - <div id="right"> - <h2>Help</h2> - <ul> - <li> - <a href="http://pylonshq.com/docs/en/0.9.7/">Official documentation</a> - </li> - <li> - <a href="http://wiki.pylonshq.com/display/pylonsfaq/Home">FAQ</a> - </li> - <li> - <a href="http://wiki.pylonshq.com/dashboard.action">Wiki</a> - </li> - <li> - <a href="http://wiki.pylonshq.com/display/pylonscommunity/Home#Home-JointheMailingLists">Mailing list</a> - </li> - <li> - <a href="http://wiki.pylonshq.com/display/pylonscommunity/Home#Home-IRC">IRC</a> - </li> - <li> - <a href="http://pylonshq.com/project/pylonshq/roadmap">Bug tracker</a> - </li> - </ul> - </div> - <div id="footer"> - <a href="http://www.pylonshq.com" style="color: #ccc; text-decoration:none;" - >www.pylonshq.com</a> - </div> - </div> - </body> -</html> diff --git a/floof/public/pylons-logo.gif b/floof/public/pylons-logo.gif deleted file mode 100644 index 61b2d9a..0000000 Binary files a/floof/public/pylons-logo.gif and /dev/null differ diff --git a/floof/public/reset.css b/floof/public/reset.css new file mode 100644 index 0000000..ca33138 --- /dev/null +++ b/floof/public/reset.css @@ -0,0 +1,47 @@ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; +} +/* remember to define focus styles! */ +:focus { + outline: 0; +} +body { + line-height: 1; + color: black; + background: white; +} +ol, ul { + list-style: none; +} +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: separate; + border-spacing: 0; +} +caption, th, td { + text-align: left; + font-weight: normal; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ""; +} +blockquote, q { + quotes: "" ""; +} + diff --git a/floof/templates/base.mako b/floof/templates/base.mako index 340cdf9..50bed27 100644 --- a/floof/templates/base.mako +++ b/floof/templates/base.mako @@ -3,6 +3,8 @@ <html> <head> <title>${title()} â Floof</title> +<link rel="stylesheet" type="text/css" href="/reset.css"> +<link rel="stylesheet" type="text/css" href="/layout.css"> </head> <body> % if c.user: diff --git a/floof/templates/index.mako b/floof/templates/index.mako index d3c64b9..ce3a112 100644 --- a/floof/templates/index.mako +++ b/floof/templates/index.mako @@ -1 +1,7 @@ <%inherit file="base.mako" /> + +<ul class="artwork-grid"> + % for artwork in c.artwork: + <li>${artwork.title}</li> + % endfor +</ul> diff --git a/floof/tests/functional/test_main.py b/floof/tests/functional/test_main.py new file mode 100644 index 0000000..3fcac13 --- /dev/null +++ b/floof/tests/functional/test_main.py @@ -0,0 +1,7 @@ +from floof.tests import * + +class TestMainController(TestController): + + def test_index(self): + response = self.app.get(url(controller='main', action='index')) + # Test response...