Commits

Anonymous committed 5bf54df

Changed wiki pages to .html extension so URL-manipulation for formatting is easier. Fixed comment form not displaying.

  • Participants
  • Parent commits 015f945

Comments (0)

Files changed (5)

 			db.store.rollback()
 			
 			# only if we're dealing in html
-			if type(format) == type(None):
+			if 'html' in format:
 			
 				# now grab all comments for this article (by id_)
 				comments = db.store.find(db.Comment, db.Comment.article_id == article.id_).order_by(db.Comment.id_)
 		except IOError:
 			page = open(config.general.base_path+"static/pages/404")
 			
-		if (type(format) == type(None)):
+		if format == '.html':
 			# when was this modified?
 			# os.stat() returns an iterable of file metadata items, -2 is last-motified
 			last_modified_date = data_handler.human_timestamp(os.stat(config.general.base_path+"static/pages/%s" % (name,))[-2])
 			web.webapi.header("Content-Type","text/html; charset=utf-8") 
 			return templater(config.general.base_path+"templates/site.html", {"page_html":page_html, "page_name":"Wiki", "page_type":page_type, "session":session, "date_modified":last_modified_date})
 			
-		elif format == ".html":
-			url = config.general.domain+web.http.url()
-			url = url.replace(".html", "/")
-			raise web.seeother(url)
-			
-		elif format == ".markdown" or format == ".txt" or format == ".raw":
-			web.webapi.header("Content-Type","text/plain; charset=utf-8") 
-			return page
-			
-		else:
+		elif format == ".markdown" :
 			web.webapi.header("Content-Type","text/plain; charset=utf-8") 
 			return page
 		
+		elif type(format) == type(None):
+			url = config.general.domain+web.http.url()
+			if url[-1] == u"/":
+				url = url[0:-1]
+			
+			raise web.seeother(url+u'.html')
+		
 		page.close()
 		
-		
 class Login:
 	def GET(self):
 		page_type="login"

File static/js/_site.js

 
 jQuery("#cancel_article").click(function(event){
 	event.preventDefault();
-	var answer = confirm("Cancel these changes?")
+	var answer = confirm("Cancel this article?")
 	if (answer) {
-		jQuery("div.article").html(jQuery("div.original_article").html());
+		jQuery(".add_content_here form").toggle("slow");
 	}
 });
 });

File templater.py

 		recent_comments = db.store.find(db.Comment).order_by(db.Desc(db.Comment.id_))
 		# 6 recent comments...
 		for x in recent_comments[:3]:
-			recent_comments_html += '<li><strong>%s</strong> <a href="#">posted</a> %s</li>' % (x.author, x.text)
+			recent_comments_html += '<li><strong>%s</strong> posted %s</li>' % (x.author, x.text[0:20]+u'...')
 				
 		# add recent comments list
 		values.update({"recent_comments_html":recent_comments_html})

File templates/comment_form.html

 $def with (comment_form)
 		<div class="comment_form">
-			<form action="$comment_form['base_url']$comment_form['year']/$comment_form['month']/$comment_form['day']/$comment_form['url_id']" method="post">
+			<form action="$comment_form['base_url']$comment_form['year']/$comment_form['month']/$comment_form['day']/$(comment_form['url_id']).html" method="post">
 				<label><textarea name="text" class="resizable"></textarea>
 				</label><a id="markdown" href="http://en.wikipedia.org/wiki/Markdown#Syntax_examples">Formatting help (markdown)</a>
 				<input type="hidden" name="article_id" value="$comment_form['article_id']" />

File templates/site.html

 		<link rel="stylesheet" type="text/css" href="$site_vars['base_url']static/css/article_display.css" />
 		<link rel="stylesheet" type="text/css" href="$site_vars['base_url']static/css/static_page.css" />
 		<script type="text/javascript" src="$site_vars['base_url']static/js/jquery-1.3.2.min.js"></script>
-		<script type="text/javascript" src="$site_vars['base_url']static/js/jquery.textarearesizer.compressed.js"></script>
 		<script type="text/javascript" src="$site_vars['base_url']static/js/tag.js"></script>
 		<script type="text/javascript" src="$site_vars['base_url']static/js/_site.js"></script>
 		<link rel="alternate" type="application/rss+xml" title="Latest articles feed" href="/rss" /> 
 					<strong>Other pages</strong>
 					<ul>
 						<li><a href="$site_vars['base_url']">Home</a></li>
-						<li><a href="$site_vars['base_url']about">About me</a></li>
-						<li><a href="$site_vars['base_url']contact">Contact</a></li>
-						<li><a href="$site_vars['base_url']projects">Projects</a></li>
+						<li><a href="$site_vars['base_url']about.html">About me</a></li>
+						<li><a href="$site_vars['base_url']contact.html">Contact</a></li>
+						<li><a href="$site_vars['base_url']projects.html">Projects</a></li>
 					</ul>
 				
 					<strong>My projects</strong>
 					<ul>
 						<li><a href="http://phpns.alecwh.com/">Phpns</a></li>
-						<li><a href="$site_vars['base_url']pointblank">Point-blank</a></li>
+						<li><a href="$site_vars['base_url']pointblank.html">Point-blank</a></li>
 						<li><a href="http://pyfig.alecwh.com/">Pyfig</a></li>
 						<li><a href="$site_vars['base_url']projects">More here...</a></li>
 					</ul>