Permalink
Browse files

added beginings of admin interface

  • Loading branch information...
1 parent cf3587f commit 927f89da29f79adef6376b8c172e428065367735 @thecolorblue committed Apr 7, 2011
Showing with 30 additions and 4 deletions.
  1. +2 −2 murray.js
  2. +22 −0 resources/admin.js
  3. +2 −0 views/index.jade
  4. +4 −2 views/layout.jade
View
@@ -27,9 +27,9 @@ exports.getposts = function(req,res,options,callback){
collection.find(filters,config, function(err, cursor){
cursor.toArray(function(err, posted){
if(req.cookies.loggedin == 1){
- var logged = 'you are logged in';
+ var logged = true;
} else {
- var logged = 'you should log in';
+ var logged = false;
}
if(callback != ''){
res.render('index.jade', {posts: posted, logged: logged});
View
@@ -0,0 +1,22 @@
+$(document).ready(function(){
+ $('body').append('<div id="toolbar">toolbar</div>');
+ $('#toolbar').css({'position':'fixed','right':'50px'});
+ $('#toolbar').append('<ul id="actions"><li id="createpostli"><a href="#" id="createpostlink">create post</a></li></ul>');
+ $('#actions').css('position','relative').append('<li><a href="logout">logout</a></li>');
+ var postformstyle = {
+ 'position':'absolute',
+ 'right':'100px',
+ 'background':'#ddd',
+ 'display':'none',
+ 'padding':'15px'
+ };
+ $('#createpostli').append('<div id="createpostform"><form method="post" action="/create/post"><ul><li>title</li></ul></form></div>');
+ $('#createpostform').css(postformstyle);
+ $('#createpostform form ul').append('<li><input type="text" name="title"></input>');
+ $('#createpostform form ul').append('<li><input type="text" name="body"></input>');
+ $('#createpostform form ul').append('<li><input type="submit" name="submit"></input>');
+ $('#createpostlink').click(function(){
+ $('#createpostform').css('display','block');
+ });
+
+});
View
@@ -7,3 +7,5 @@ p #{logged}
p #{post.body}
p #{post.date}
<hr/>
+- if (logged == true)
+ script(src='/admin.js',type='text/javascript')
View
@@ -2,8 +2,8 @@
html
head
title Blog Posts
- script(rel='jquery.min.js',type='text/javascript')
- link(rel='stylesheet', href='localhost/960.css')
+ script(src='/jquery.min.js',type='text/javascript')
+ link(rel='stylesheet', href='/960.css')
body
div.container_12
div.grid_12
@@ -12,3 +12,5 @@ html
#container!= body
div.grid_4
p sidebar
+ div.grid_12
+ p footer

0 comments on commit 927f89d

Please sign in to comment.