From 30cbc8af0b587dacab3d03f0c84f540b9000be70 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 16 Feb 2010 08:02:31 +0200 Subject: [PATCH] Last few touchups: - Added a hint to the date fields. - Renamed the input fields. --- scribeengine/controllers/post.py | 17 +++++++++-------- scribeengine/public/styles/style.css | 6 ++++++ scribeengine/templates/post/edit.mako | 7 ++++--- scribeengine/templates/post/new.mako | 5 +++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/scribeengine/controllers/post.py b/scribeengine/controllers/post.py index b750cb4..9cc5232 100644 --- a/scribeengine/controllers/post.py +++ b/scribeengine/controllers/post.py @@ -22,6 +22,7 @@ import logging from datetime import datetime +import time from scribeengine.lib.base import * from scribeengine.lib import utils @@ -61,23 +62,23 @@ class PostController(BaseController): @authenticate(u'Edit My Posts') def edit_POST(self, id=None): - url = utils.generate_url(c.form_values[u'edit-title']) + url = utils.generate_url(c.form_values[u'post-title']) if id is None: post = Post() post.user = c.current_user else: post = Session.query(Post).get(id) post.modified = datetime.now() - if c.form_values.get(u'authored') and c.form_values[u'authored']: - c.post.created = datetime(*time.strptime(c.form_values[u'authored'], '%Y/%m/%d %H:%M:%S')) - post.title = c.form_values[u'title'] - post.body = c.form_values[u'body'] - if c.form_values[u'action'] == u'Save Draft': + if c.form_values.get(u'post-authored') and c.form_values[u'post-authored']: + post.created = datetime(*time.strptime(c.form_values[u'post-authored'], '%Y/%m/%d %H:%M:%S')[0:6]) + post.title = c.form_values[u'post-title'] + post.body = c.form_values[u'post-body'] + if c.form_values[u'post-action'] == u'Save Draft': post.status = u'draft' else: post.status = u'published' post.url = url - tags = c.form_values[u'tags'] + tags = c.form_values[u'post-tags'] tag_list = [tag_name.strip() for tag_name in tags.split(u',')] tag_urls = [utils.generate_url(tag_name) for tag_name in tags.split(u',')] db_tags = Session.query(Tag).filter(Tag.url.in_(tag_urls)).all() @@ -89,7 +90,7 @@ class PostController(BaseController): post.tags.append(Tag(name=tag, url=utils.generate_url(tag))) Session.add(post) Session.commit() - if c.form_values[u'action'] == u'Save Draft': + if c.form_values[u'post-action'] == u'Save Draft': h.redirect_to(h.url_for(controller=u'post', action=u'draft')) else: h.redirect_to(h.url_for_post(post)) diff --git a/scribeengine/public/styles/style.css b/scribeengine/public/styles/style.css index 2c83039..1d3b53a 100644 --- a/scribeengine/public/styles/style.css +++ b/scribeengine/public/styles/style.css @@ -404,6 +404,12 @@ fieldset { margin-bottom: 1em; } +.form-hint { + color: #454545; + font-size: 0.8em; + margin-top: 0.2em; +} + #register-now { margin-left: 1em; } diff --git a/scribeengine/templates/post/edit.mako b/scribeengine/templates/post/edit.mako index f8b6d48..1b1dbc1 100644 --- a/scribeengine/templates/post/edit.mako +++ b/scribeengine/templates/post/edit.mako @@ -20,13 +20,14 @@
+
Date format is YYYY/MM/DD HH:MM:SS.
% if c.post.status == u'published': - + % else: - - + + % endif
diff --git a/scribeengine/templates/post/new.mako b/scribeengine/templates/post/new.mako index f8b7176..1766fad 100644 --- a/scribeengine/templates/post/new.mako +++ b/scribeengine/templates/post/new.mako @@ -20,10 +20,11 @@
+
Date format is YYYY/MM/DD HH:MM:SS.
- - + +