Added an edit screen, removed and ignore generated files or data files.

This commit is contained in:
Raoul Snyman 2010-01-16 00:40:32 +02:00
parent 1803fbe824
commit e117bd5e58
13 changed files with 41 additions and 61 deletions

6
.bzrignore Normal file
View File

@ -0,0 +1,6 @@
data
.eric4project
ScribeEngine.e4p
scribeengine.sqlite
posts.sql
*.egg-info

View File

@ -1,10 +0,0 @@
Metadata-Version: 1.0
Name: ScribeEngine
Version: 0.1dev
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN

View File

@ -1,34 +0,0 @@
MANIFEST.in
README.txt
setup.cfg
setup.py
ScribeEngine.egg-info/PKG-INFO
ScribeEngine.egg-info/SOURCES.txt
ScribeEngine.egg-info/dependency_links.txt
ScribeEngine.egg-info/entry_points.txt
ScribeEngine.egg-info/not-zip-safe
ScribeEngine.egg-info/paster_plugins.txt
ScribeEngine.egg-info/requires.txt
ScribeEngine.egg-info/top_level.txt
scribeengine/__init__.py
scribeengine/websetup.py
scribeengine/config/__init__.py
scribeengine/config/deployment.ini_tmpl
scribeengine/config/environment.py
scribeengine/config/middleware.py
scribeengine/config/routing.py
scribeengine/controllers/__init__.py
scribeengine/controllers/error.py
scribeengine/lib/__init__.py
scribeengine/lib/app_globals.py
scribeengine/lib/base.py
scribeengine/lib/helpers.py
scribeengine/model/__init__.py
scribeengine/model/meta.py
scribeengine/public/bg.png
scribeengine/public/favicon.ico
scribeengine/public/index.html
scribeengine/public/pylons-logo.gif
scribeengine/tests/__init__.py
scribeengine/tests/test_models.py
scribeengine/tests/functional/__init__.py

View File

@ -1 +0,0 @@

View File

@ -1,7 +0,0 @@
[paste.app_factory]
main = scribeengine.config.middleware:make_app
[paste.app_install]
main = pylons.util:PylonsInstaller

View File

@ -1 +0,0 @@

View File

@ -1,2 +0,0 @@
PasteScript
Pylons

View File

@ -1,2 +0,0 @@
Pylons>=0.9.7
SQLAlchemy>=0.5

View File

@ -1 +0,0 @@
scribeengine

View File

@ -42,7 +42,10 @@ class PostController(BaseController):
@authenticate(u'Edit My Posts') @authenticate(u'Edit My Posts')
def edit(self, id=None): def edit(self, id=None):
c.page_title = 'New Post' if id is None:
h.redirect_to('/post/new')
c.post = Session.query(Post).get(id)
c.page_title = 'Edit Post: %s' % c.post.title
return render(u'/post/edit.mako') return render(u'/post/edit.mako')
def edit_POST(self, id=None): def edit_POST(self, id=None):

View File

@ -227,7 +227,7 @@ def authenticate(permission=None):
session[u'redirect_url'] = request.environ[u'PATH_INFO'] session[u'redirect_url'] = request.environ[u'PATH_INFO']
session.save() session.save()
h.flash.set_message(u'You need to be logged in to do that.', u'error') h.flash.set_message(u'You need to be logged in to do that.', u'error')
h.redirect_to('/login') h.redirect_to('/admin/login')
return decorator(validate) return decorator(validate)

View File

@ -0,0 +1,21 @@
<%inherit file="/base.mako"/>
<div class="post">
<h2 class="title">Edit Post: ${c.post.title}</h2>
<%include file="/errors.mako"/>
<form id="post-new" action="${h.url_for('/post/edit/%s' % str(c.post.id))}" method="post">
<fieldset>
<div class="form-item">
<!-- <label for="post-title">Title:</label> -->
<input type="text" name="title" value="${c.post.title}" id="post-title" class="form-text" />
</div>
<div class="form-item">
<!-- <label for="post-body">Body:</label> -->
<textarea name="body" id="post-body" class="form-textarea">${c.post.body}</textarea>
</div>
<div class="form-item">
<input type="submit" name="action" value="Save Draft"/>
<input type="submit" name="action" value="Save &amp; Publish"/>
</div>
</fieldset>
</form>
</div>

View File

@ -32,7 +32,7 @@ h3 {
font-size: 1em; font-size: 1em;
} }
p, ul, ol { p, ul, ol, pre {
margin-top: 1.8em; margin-top: 1.8em;
line-height: 180%; line-height: 180%;
} }
@ -186,6 +186,14 @@ hr {
margin-left: 1em; margin-left: 1em;
} }
.post pre {
background-color: #191919;
border: 1px solid #333333;
font-family: Monaco, Lucida Typewriter, Courier New, monospace;
margin-bottom: 0.5em;
padding: 0.3em 0.5em;
}
/* Sidebar */ /* Sidebar */
#sidebar { #sidebar {