Some theme fixes, links and hopefully a longer lasting session.
This commit is contained in:
commit
9d0000c69d
@ -23,6 +23,7 @@ static_files = true
|
||||
cache_dir = %(here)s/data
|
||||
beaker.session.key = scribeengine
|
||||
beaker.session.secret = somesecret
|
||||
beaker.session.timeout = 1209600
|
||||
|
||||
# If you'd like to fine-tune the individual locations of the cache data dirs
|
||||
# for the Cache data, or the Session saves, un-comment the desired settings
|
||||
|
@ -23,6 +23,7 @@
|
||||
import logging
|
||||
import string
|
||||
import random
|
||||
from urlparse import urlsplit
|
||||
from datetime import datetime
|
||||
|
||||
from formencode.validators import Int
|
||||
@ -208,6 +209,9 @@ class AccountController(BaseController):
|
||||
h.redirect_to('/account/login')
|
||||
|
||||
def login(self):
|
||||
if u'redirect_url' not in session and u'REFERER' in request.headers:
|
||||
session[u'redirect_url'] = str(urlsplit(request.headers[u'REFERER']).path)
|
||||
session.save()
|
||||
c.page_title = u'Login'
|
||||
return render(u'/account/login.mako')
|
||||
|
||||
@ -239,9 +243,13 @@ class AccountController(BaseController):
|
||||
elif user and user.password == password:
|
||||
log.debug('Logged in successfully.')
|
||||
redirect_url = str(session.get(u'redirect_url', u'/'))
|
||||
session[u'REMOTE_USER'] = user.id
|
||||
if u'redirect_url' in session:
|
||||
del session[u'redirect_url']
|
||||
else:
|
||||
redirect_url = '/'
|
||||
if redirect_url == '/account/login':
|
||||
redirect_url = '/'
|
||||
session[u'REMOTE_USER'] = user.id
|
||||
session.save()
|
||||
h.flash.set_message(u'You have logged in successfully.', u'success')
|
||||
h.redirect_to(redirect_url)
|
||||
|
@ -35,6 +35,11 @@ log = logging.getLogger(__name__)
|
||||
|
||||
class BlogController(BaseController):
|
||||
|
||||
def __before__(self):
|
||||
BaseController.__before__(self)
|
||||
self._add_javascript(u'jquery.elastic.js')
|
||||
self._add_javascript(u'ScribeEngine.Blog.js')
|
||||
|
||||
def index(self):
|
||||
posts = Session.query(Post)\
|
||||
.filter_by(status=u'published')\
|
||||
|
26
scribeengine/public/scripts/ScribeEngine.Blog.js
Normal file
26
scribeengine/public/scripts/ScribeEngine.Blog.js
Normal file
@ -0,0 +1,26 @@
|
||||
/*****************************************************************************
|
||||
* ScribeEngine - Open Source Blog Software *
|
||||
* ------------------------------------------------------------------------- *
|
||||
* Copyright (c) 2010 Raoul Snyman *
|
||||
* ------------------------------------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; version 2 of the License. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
|
||||
* Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
*****************************************************************************/
|
||||
|
||||
ScribeEngine.Namespace.create("ScribeEngine.Blog", {
|
||||
|
||||
});
|
||||
|
||||
ScribeEngine.Events.load(function () {
|
||||
ScribeEngine.Widgets.elastic("#commentform textarea");
|
||||
});
|
@ -126,6 +126,10 @@ ScribeEngine.Namespace.create("ScribeEngine.Widgets", {
|
||||
tagEditor: function (selector)
|
||||
{
|
||||
$(selector).tagEditor({completeOnBlur: true, initialParse: true});
|
||||
},
|
||||
elastic: function (selector)
|
||||
{
|
||||
$(selector).elastic();
|
||||
}
|
||||
});
|
||||
|
||||
|
1
scribeengine/public/scripts/jquery.elastic.js
Normal file
1
scribeengine/public/scripts/jquery.elastic.js
Normal file
@ -0,0 +1 @@
|
||||
(function(jQuery){jQuery.fn.extend({elastic:function(){var mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return this.each(function(){if(this.type!='textarea'){return false}var $textarea=jQuery(this),$twin=jQuery('<div />').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight<0){maxheight=Number.MAX_VALUE}$twin.appendTo($textarea.parent());var i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()))}function setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow})}}function update(){var textareaContent=$textarea.val().replace(/&/g,'&').replace(/ /g,' ').replace(/<|>/g,'>').replace(/\n/g,'<br />');var twinContent=$twin.html();if(textareaContent+' '!=twinContent){$twin.html(textareaContent+' ');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight){setHeightAndOverflow(maxheight,'auto')}else if(goalheight<=minheight){setHeightAndOverflow(minheight,'hidden')}else{setHeightAndOverflow(goalheight,'hidden')}}}}$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update()});$textarea.live('input paste',function(e){setTimeout(update,250)});update()})}})})(jQuery);
|
13
scribeengine/public/styles/print.css
Normal file
13
scribeengine/public/styles/print.css
Normal file
@ -0,0 +1,13 @@
|
||||
html,
|
||||
body {
|
||||
background-color: #fff;
|
||||
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#menu,
|
||||
#sidebar,
|
||||
#commentform {
|
||||
display: none;
|
||||
}
|
@ -9,6 +9,10 @@ Released for free under a Creative Commons Attribution 2.5 License
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #000000 url(../images/img01.gif) repeat-x;
|
||||
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||
|
@ -9,6 +9,7 @@
|
||||
<link href="${h.url_for(controller=u'feed', action=u'atom')}" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed" />
|
||||
<link href="${h.url_for(controller=u'feed', action=u'rss')}" type="application/rss+xml" rel="alternate" title="Sitewide RSS Feed" />
|
||||
<link href="${h.url_for('/styles/style.css')}" rel="stylesheet" type="text/css" media="screen" />
|
||||
<link href="${h.url_for('/styles/print.css')}" rel="stylesheet" type="text/css" media="print" />
|
||||
% for script in c.scripts:
|
||||
<script src="/scripts/${script}" type="text/javascript"></script>
|
||||
% endfor
|
||||
@ -52,7 +53,7 @@
|
||||
</div>
|
||||
<hr />
|
||||
<div id="footer">
|
||||
<p>Copyright © 2010 Raoul and Hannah Snyman. Powered by ScribeEngine. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
|
||||
<p>Copyright © 2010 Raoul and Hannah Snyman. Powered by <a href="http://launchpad.net/scribeengine" title="Open Source Python Blog Engine">ScribeEngine</a>. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user