diff --git a/README.md b/README.md index 2fd4641..b2d6dfa 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,8 @@ primary key(category_id) create table posts( post_id mediumint unsigned not null AUTO_INCREMENT, category_id mediumint unsigned not null, -user_id mediumint unsigned not null, picture_url varchar(100) not null, published datetime not null, -url varchar(100) not null, name varchar(100) not null, primary key(post_id) ); diff --git a/admin/addCategory.html b/admin/addCategory.html index 54bad0e..0bcb92b 100644 --- a/admin/addCategory.html +++ b/admin/addCategory.html @@ -1,10 +1,13 @@ -

Add Category

+
-
-
- - -
-

-
\ No newline at end of file +

Add Category

+ +
+
+ + +
+

+
+
\ No newline at end of file diff --git a/admin/addCategory.js b/admin/addCategory.js index 7a81949..60d8e5b 100644 --- a/admin/addCategory.js +++ b/admin/addCategory.js @@ -5,7 +5,6 @@ const qs = require('querystring'); var Promise = require('promise'); - module.exports= { main: function(res, postData) @@ -13,6 +12,15 @@ module.exports= utils.include(res, "./admin/addCategory.html"); return this.processPost(res, postData); }, + /** + * Checks for post data regarding adding a new category. + * If a post is made with add_category, it parses the url-- replaces spaces + * with dashes -- and calls a insert method on the database + * + * @param res + * @param postData + * @return {*|Promise} + */ processPost: function(res, postData) { return new Promise(function(resolve, reject) @@ -34,7 +42,7 @@ module.exports= } } - resolve(); + resolve(postData); }); } }; \ No newline at end of file diff --git a/admin/admin.js b/admin/admin.js index da72ba4..338657a 100644 --- a/admin/admin.js +++ b/admin/admin.js @@ -15,14 +15,19 @@ module.exports= { return new Promise(function(resolve, reject) { + result.write("
"); utils.getPostData(request).then(function (postData) + { + return require("../admin/newPost.js").main(result, postData); + }).then(function(postData) { return require("../admin/addCategory.js").main(result, postData); }).then(function() { console.log("admin page ended"); resolve(); - }); + }) + result.write("
"); }); } }; \ No newline at end of file diff --git a/admin/newPost.html b/admin/newPost.html new file mode 100644 index 0000000..6bb80d8 --- /dev/null +++ b/admin/newPost.html @@ -0,0 +1,29 @@ +
+

New Post

+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+

+
+
\ No newline at end of file diff --git a/admin/newPost.js b/admin/newPost.js new file mode 100644 index 0000000..9ba8100 --- /dev/null +++ b/admin/newPost.js @@ -0,0 +1,27 @@ +const utils = require('../utils/utils.js'); +const sql = require('../utils/sql'); + +const qs = require('querystring'); +var Promise = require('promise'); + + +module.exports= + { + main: function(res, postData) + { + utils.include(res, "./admin/newPost.html"); + return this.processPost(res, postData); + }, + processPost: function(res, postData) + { + return new Promise(function(resolve, reject) + { + var post = qs.parse(postData); + if(post.add_post_name) + { + + } + resolve(postData); + }); + } + }; \ No newline at end of file diff --git a/admin/test.html b/admin/test.html deleted file mode 100644 index 5b92e26..0000000 --- a/admin/test.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - -W3.CSS Template - - - - - - - - - - - - - - - - - -
- - - - - -
- -

MY BLOG

- -

Welcome to the blog of unknown

- -
- - - - - -
- - - - - -
- - - -
- - Nature - -
- -

TITLE HEADING

- -
Title description, April 7, 2014
- -
- - - -
- -

Mauris neque quam, fermentum ut nisl vitae, convallis maximus nisl. Sed mattis nunc id lorem euismod placerat. Vivamus porttitor magna enim, ac accumsan tortor cursus at. Phasellus sed ultricies mi non congue ullam corper. Praesent tincidunt sed - - tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

- - -
- -
- -
- - - - - -
- - Norway - -
- -

BLOG ENTRY

- -
Title description, April 2, 2014
- -
- - - -
- -

Mauris neque quam, fermentum ut nisl vitae, convallis maximus nisl. Sed mattis nunc id lorem euismod placerat. Vivamus porttitor magna enim, ac accumsan tortor cursus at. Phasellus sed ultricies mi non congue ullam corper. Praesent tincidunt sed - - tellus ut rutrum. Sed vitae justo condimentum, porta lectus vitae, ultricies congue gravida diam non fringilla.

- -
- -
- -

- -
- -
- -

Comments   2

- -
- -
- -
- -
- - - -
- - - - -
- - - -
- - - -
- -

My Name

- -

Just me, myself and I, exploring the universe of uknownment. I have a heart of love and a interest of lorem ipsum and mauris neque quam blog. I want to share my world with you.

- -
- -

- - - - - -
- -
- -

Popular Posts

- -
- -
    - -
  • - - Image - - Lorem
    - - Sed mattis nunc - -
  • - -
  • - - Image - - Ipsum
    - - Praes tinci sed - -
  • - -
  • - - Image - - Dorum
    - - Ultricies congue - -
  • - -
  • - - Image - - Mingsum
    - - Lorem ipsum dipsum - -
  • - -
- -
- -
- - - - - -
- -
- -

Tags

- -
- -
- -

Travel New York London - - IKEA NORWAY DIY - - Ideas Baby Family - - News Clothing Shopping - - Sports Games - -

- -
- -
- - - - - -
- - - - - -
- - - - - -
- - - - - - - - - - - - \ No newline at end of file diff --git a/posts/singlePost.js b/posts/singlePost.js index d5d8d57..cd71019 100644 --- a/posts/singlePost.js +++ b/posts/singlePost.js @@ -26,7 +26,7 @@ module.exports= res.write("
"); //include page content - utils.include(res, "../entries/" + post.url).then(function (value) { + utils.include(res, "../entries/" + post.url + ".html").then(function (value) { res.write("
"); resolve(); });