Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed Bugs #5 and #7 and added Themes

  • Loading branch information...
commit f995a5215cd3605acaec40e22242a3b5f0ef4583 1 parent 71f91dd
@koostudios authored
View
9 config.coffee
@@ -13,9 +13,16 @@ exports.config =
# Site port - get this from your NodeJS host
port: ''
# Session Secret - a random string used to compute the session hash
- secret: ''
+ secret: 'somestringhere'
# CouchPress Version
version: '0.1.2'
+
+ # Theme Information
+ theme:
+ # Folder Name of Admin Theme
+ admin: 'admin'
+ # Folder Name of Frontend Theme
+ front: 'soothe'
# Database Settings - get this info from your CouchDB host
db:
View
41 main.coffee
@@ -19,12 +19,17 @@ pass.deserializeUser (id, done) ->
pass.use 'local', new Local (username, password, done) ->
process.nextTick () ->
users.find username, password, done
+
+# Theme Paths
+admin = __dirname + '/views/' + config.theme.admin + '/'
+front = __dirname + '/views/' + config.theme.front + '/'
# App Configuration
app.configure () ->
app.set 'view engine', 'jade'
app.set 'views', __dirname + '/views'
- app.use exp.static __dirname + '/public'
+ app.use '/admin', exp.static admin + '/public'
+ app.use exp.static front + '/public'
app.use exp.cookieParser()
app.use exp.bodyParser()
app.use exp.methodOverride()
@@ -40,24 +45,24 @@ console.log 'Server running at port ' + app.address().port
# Routing
app.get '/', (req, res) ->
posts.findAll (err, docs) ->
- res.render 'index',
+ res.render front + 'index',
locals:
title: config.site.title + ' / Home'
articles: docs
config: config
-app.get '/view/:id', (req, res) ->
+app.get '/view/:id?', (req, res, next) ->
posts.findById req.params.id, (err, docs) ->
- res.render 'view',
+ res.render front + 'view',
locals:
title: config.site.title + ' / ' + docs.title
article: docs
config: config
app.get '/login', (req, res) ->
- res.render 'login',
+ res.render front + 'login',
locals:
- title: config.site.title + å' / Login'
+ title: config.site.title + ' / Login'
message: req.flash('error')
config: config
@@ -67,8 +72,8 @@ app.post '/login', pass.authenticate 'local',
failureFlash: true
app.get '/register', (req, res) ->
- res.render 'register',
- title: config.site.title
+ res.render front + 'register',
+ title: config.site.title + ' / Register'
config: config
app.post '/register', (req, res) ->
@@ -95,23 +100,23 @@ app.get '/logout', (req, res) ->
app.get '/admin', users.check, (req, res) ->
posts.findAll (err, docs) ->
- res.render 'admin/posts',
- layout: 'admin/layout'
+ res.render admin + 'posts',
+ layout: admin + 'layout'
locals:
title: 'Posts'
articles: docs
app.get '/admin/new', users.check, (req, res) ->
- res.render 'admin/new',
- layout: 'admin/layout',
+ res.render admin + 'new',
+ layout: admin + 'layout',
locals:
title: 'New'
config: config
app.get '/admin/edit/:id?', users.check, (req, res) ->
posts.findById req.params.id, (err, docs) ->
- res.render 'admin/editor',
- layout: 'admin/layout'
+ res.render admin + 'editor',
+ layout: admin + 'layout'
locals:
title: 'Edit'
article: docs
@@ -121,8 +126,8 @@ app.post '/admin/new', users.check, (req, res) ->
docs =
title: req.param 'title'
body: ''
- res.render 'admin/new'
- layout: 'admin/layout',
+ res.render admin + 'new'
+ layout: admin + 'layout',
locals:
title: 'New'
article: docs
@@ -140,8 +145,8 @@ app.post '/admin/edit', users.check, (req, res) ->
created_at: new Date()
}, (err, docs) ->
if (err)
- res.render 'admin/error'
- layout: 'admin/layout'
+ res.render admin + 'error'
+ layout: admin + 'layout'
locals:
title: 'Error'
error: JSON.stringify(err)
View
2  package.json
@@ -3,7 +3,7 @@
"description": "A super lightweight and modular CMS built on NodeJS, Express and CouchDB.",
"tags": ["cms", "content management", "blog", "blogging", "node","couchdb"],
"version": "0.1.2",
- "homepage": "http://couchpress.nodester.com",
+ "homepage": "https://github.com/koostudios/Couchpress",
"author": "Alexander Yuen <koo.studios@gmail.com> (http://www.koostudios.com/)",
"repository": {
"type": "git",
View
10 views/admin/editor.jade
@@ -7,16 +7,16 @@ form#editor(method= 'post', action= '/admin/edit')
.tray
.visual
button#bold.edit
- img(src= '/img/tray/icon-bold.png')
+ img(src= '/admin/img/tray/icon-bold.png')
button#italic.edit
- img(src= '/img/tray/icon-italic.png')
+ img(src= '/admin/img/tray/icon-italic.png')
button#underline.edit
- img(src= '/img/tray/icon-underline.png')
+ img(src= '/admin/img/tray/icon-underline.png')
.visual
button#InsertUnorderedList.edit
- img(src= '/img/tray/icon-unordered.png')
+ img(src= '/admin/img/tray/icon-unordered.png')
button#InsertOrderedList.edit
- img(src= '/img/tray/icon-ordered.png')
+ img(src= '/admin/img/tray/icon-ordered.png')
.toggle-mode
button#visual.selected= 'Visual'
button#html= 'HTML'
View
4 views/admin/layout.jade
@@ -2,11 +2,11 @@
html(lang="en")
head
title= 'Couchpress / ' + title
- link(rel= 'stylesheet', href= '/css/admin.css')
+ link(rel= 'stylesheet', href= '/admin/css/style.css')
body
header
a(href= '/admin')
- img(src= '/img/logo.png', alt= 'Couchpress')
+ img(src= '/admin/img/logo.png', alt= 'Couchpress')
nav
ul
a(href= '/admin')
View
15 views/admin/new.jade
@@ -1,18 +1,21 @@
form#editor(method= 'post', action= '/admin/edit')
- input#title(type="text", name="title", placeholder="Title")
+ - if (typeof article.title != 'undefined')
+ input#title(type="text", name="title", placeholder="Title", value= article.title)
+ -else
+ input#title(type="text", name="title", placeholder="Title")
.tray
.visual
button#bold.edit
- img(src= '/img/tray/icon-bold.png')
+ img(src= '/admin/img/tray/icon-bold.png')
button#italic.edit
- img(src= '/img/tray/icon-italic.png')
+ img(src= '/admin/img/tray/icon-italic.png')
button#underline.edit
- img(src= '/img/tray/icon-underline.png')
+ img(src= '/admin/img/tray/icon-underline.png')
.visual
button#InsertUnorderedList.edit
- img(src= '/img/tray/icon-unordered.png')
+ img(src= '/admin/img/tray/icon-unordered.png')
button#InsertOrderedList.edit
- img(src= '/img/tray/icon-ordered.png')
+ img(src= '/admin/img/tray/icon-ordered.png')
.toggle-mode
button#visual.selected= 'Visual'
button#html= 'HTML'
View
0  public/css/admin.css → views/admin/public/css/style.css
File renamed without changes
View
0  public/img/logo.png → views/admin/public/img/logo.png
File renamed without changes
View
0  public/img/tray/icon-bold.png → views/admin/public/img/tray/icon-bold.png
File renamed without changes
View
0  public/img/tray/icon-fullscreen.png → ...admin/public/img/tray/icon-fullscreen.png
File renamed without changes
View
0  public/img/tray/icon-italic.png → views/admin/public/img/tray/icon-italic.png
File renamed without changes
View
0  public/img/tray/icon-ordered.png → views/admin/public/img/tray/icon-ordered.png
File renamed without changes
View
0  public/img/tray/icon-underline.png → .../admin/public/img/tray/icon-underline.png
File renamed without changes
View
0  public/img/tray/icon-unordered.png → .../admin/public/img/tray/icon-unordered.png
File renamed without changes
View
0  public/js/editor.coffee → views/admin/public/js/editor.coffee
File renamed without changes
View
0  public/js/editor.js → views/admin/public/js/editor.js
File renamed without changes
View
2  views/index.jade → views/soothe/index.jade
@@ -1,7 +1,7 @@
- if(typeof(articles) != 'undefined')
- each article in articles
.article
- - var link = 'view/' + article._id
+ - var link = '/view/' + article._id
a(href= link, class= 'title')
h1= article.title
span.created= article.created_at
View
6 views/layout.jade → views/soothe/layout.jade
@@ -7,8 +7,10 @@ html(lang="en")
body
header
a(href='/')
- img(src= '/img/logo-blog.png')
- h1= 'CouchPress'
+ img(src= '/img/logo.png')
+ h1= config.site.title
+ a(href= 'http://github.com/koostudios/couchpress')
+ img(style= 'position: fixed; top: 0; right: 0; border: 0;',m src= 'https://a248.e.akamai.net/assets.github.com/img/7afbc8b248c68eb468279e8c17986ad46549fb71/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67', alt= 'Fork me on GitHub')
section.content
!= body
footer
View
0  views/login.jade → views/soothe/login.jade
File renamed without changes
View
8 public/css/style.css → views/soothe/public/css/style.css
@@ -1,3 +1,11 @@
+/*
+ Theme Name: Soothe
+ Author: Alexander Yuen
+ Author URI: http://www.koostudios.com
+ License: MIT License
+
+*/
+
::selection {
background: #FFC;
}
View
0  public/img/logo-blog.png → views/soothe/public/img/logo.png
File renamed without changes
View
0  views/register.jade → views/soothe/register.jade
File renamed without changes
View
0  views/view.jade → views/soothe/view.jade
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.