Browse Source

Started to refactor to change css library from w3 to bootstrap

pull/4/head
jrtechs 6 years ago
parent
commit
660a3d82c1
7 changed files with 19 additions and 17 deletions
  1. +1
    -1
      includes/footer.html
  2. +2
    -1
      includes/header.html
  3. +1
    -0
      posts/homePage.js
  4. +6
    -6
      posts/singlePost.js
  5. +3
    -3
      sidebar/categoriesSideBar.js
  6. +5
    -5
      sidebar/recentPosts.js
  7. +1
    -1
      sidebar/sidebar.js

+ 1
- 1
includes/footer.html View File

@ -1,6 +1,6 @@
<!-- Close section --> <!-- Close section -->
</div>
</div></div>
<!-- Footer --> <!-- Footer -->
<!-- Footer --> <!-- Footer -->

+ 2
- 1
includes/header.html View File

@ -69,4 +69,5 @@
</div> </div>
</div> </div>
<br><br><br> <br><br><br>
<div class="container">
<div class="container">
<div class="row">

+ 1
- 0
posts/homePage.js View File

@ -61,6 +61,7 @@ module.exports=
{ {
return new Promise(function(resolve, reject) return new Promise(function(resolve, reject)
{ {
renderRecentPosts(result).then(function() renderRecentPosts(result).then(function()
{ {
return require("../sidebar/sidebar.js").main(result); return require("../sidebar/sidebar.js").main(result);

+ 6
- 6
posts/singlePost.js View File

@ -48,7 +48,7 @@ module.exports=
if(!(post.picture_url === "n/a")) if(!(post.picture_url === "n/a"))
{ {
html +="<img src=\"/img/posts/" + post.picture_url + html +="<img src=\"/img/posts/" + post.picture_url +
"\" alt=\"\" style=\"width:100%\">";
"\" alt=\"\" style=\"width:100%; height:10%\">";
} }
html += "<div class=\"container\">"; html += "<div class=\"container\">";
@ -78,7 +78,7 @@ module.exports=
html+= "<p>" + htmlPost[i]; html+= "<p>" + htmlPost[i];
} }
html = html.split("<img").join("<img style=\"max-width: 100%;\" ");
html = html.split("<img").join("<img style=\"width: 100%; height:10%\" ");
html += " <div class=\"row\">\n" + html += " <div class=\"row\">\n" +
" <p class='w3-center'><button class=\"w3-button " + " <p class='w3-center'><button class=\"w3-button " +
@ -116,15 +116,15 @@ module.exports=
{ {
return new Promise(function (resolve, reject) return new Promise(function (resolve, reject)
{ {
var html = "<div class=\"container\">";
var html = "<div class=\"\">";
//image //image
if(!(post.picture_url === "n/a")) if(!(post.picture_url === "n/a"))
{ {
html +="<img src=\"/img/posts/" + post.picture_url + html +="<img src=\"/img/posts/" + post.picture_url +
"\" alt=\"\" style=\"width:100%\">";
"\" alt=\"\" class=\"w-100\">";
} }
html += "<div class=\"container\">";
html += "<div class=\"\">";
//title //title
html += "<h3><b>" + post.name + "</b></h3>"; html += "<h3><b>" + post.name + "</b></h3>";
//date //date
@ -132,7 +132,7 @@ module.exports=
post.published.toDateString() + "</span></h5>"; post.published.toDateString() + "</span></h5>";
html +="</div>"; html +="</div>";
html += "<div class=\"container\">";
html += "<div class=\"\">";
try try
{ {
sql.getCategory(post.category_id).then(function(category) sql.getCategory(post.category_id).then(function(category)

+ 3
- 3
sidebar/categoriesSideBar.js View File

@ -18,17 +18,17 @@ module.exports=
//res.write("<div class=\"w3-container w3-padding w3-gray\"><h4>Categories</h4></div>"); //res.write("<div class=\"w3-container w3-padding w3-gray\"><h4>Categories</h4></div>");
res.write("<div class=\"container\"><h4>Categories</h4></div>");
res.write("<div class=\"container\"><h4 class=\"align-content-center\">Categories</h4></div>");
//res.write("<div class=\"w3-bar-block w3-white\">"); //res.write("<div class=\"w3-bar-block w3-white\">");
res.write("<div class=\"\">");
res.write("<div class=\"list-group\">");
sql.getCategories().then(function(categories) sql.getCategories().then(function(categories)
{ {
categories.forEach(function(cat) categories.forEach(function(cat)
{ {
//res.write(cat.name); //res.write(cat.name);
res.write("<a class=\"btn-lg\" href='/category/" + cat.url + "'>" + cat.name + "<br></a>");
res.write("<a class=\"list-group-item\" href='/category/" + cat.url + "'>" + cat.name + "<br></a>");
}); });
res.write("</div></div>"); res.write("</div></div>");
resolve(); resolve();

+ 5
- 5
sidebar/recentPosts.js View File

@ -13,19 +13,19 @@ module.exports=
return new Promise(function(resolve, reject) return new Promise(function(resolve, reject)
{ {
res.write("<div class=\"w3-card w3-margin\">");
res.write("<div class=\"container\">");
res.write("<div class=\"w3-container w3-padding w3-gray\">" +
"<h4>Recent Posts</h4></div>");
res.write("<div class=\"\">" +
"<h4 class=\"align-content-center\">Recent Posts</h4></div>");
res.write("<div class=\"w3-bar-block w3-white\">");
res.write("<div class=\"list-group\">");
sql.getRecentPosts().then(function(posts) sql.getRecentPosts().then(function(posts)
{ {
posts.forEach(function(p) posts.forEach(function(p)
{ {
var url = '/' + p.category + '/' + p.url; var url = '/' + p.category + '/' + p.url;
res.write("<a class=\"w3-bar-item w3-button\" href='"
res.write("<a class=\"list-group-item\" href='"
+ url + "'>" + p.name + "<br></a>"); + url + "'>" + p.name + "<br></a>");
}); });
res.write("</div></div>"); res.write("</div></div>");

+ 1
- 1
sidebar/sidebar.js View File

@ -13,7 +13,7 @@ module.exports=
{ {
return new Promise(function(resolve, reject) return new Promise(function(resolve, reject)
{ {
res.write("<div class=\"w3-col l4\">");
res.write("<div class=\"col-md-4\">");
utils.include(res,"sidebar/sidebar.html").then(function() utils.include(res,"sidebar/sidebar.html").then(function()
{ {

Loading…
Cancel
Save