Skip to content

Commit 1b0eed1

Browse files
committed
Improve Home Page
1 parent d4dfa1a commit 1b0eed1

File tree

4 files changed

+59
-85
lines changed

4 files changed

+59
-85
lines changed

public/stylesheets/style.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
}
2424

2525
.hero-top {
26-
background: rgb(0,0,0);
27-
background: linear-gradient(90deg, rgba(0,0,0,1) 30%, rgba(40,13,38,1) 50%, rgba(0,0,0,1) 70%);
26+
background: rgb(18,15,15);
27+
background: linear-gradient(90deg, rgba(18,15,15,1) 30%, rgba(26,0,48,1) 50%, rgba(18,15,15,1) 70%);
2828
background-repeat: no-repeat;
2929
box-shadow: 0 2px 3px #000;
3030
}
@@ -116,4 +116,7 @@ a.nav-item:hover, a.nav-item:active, a.nav-item:link, a.nav-item:visited {
116116
.footer a.nav-item {
117117
color: #9a9a9a;
118118
}
119-
/* -------------------------------------------------------------------- */
119+
/* -------------------------------------------------------------------- */
120+
.has-text-dark {
121+
color: hsl(0, 0%, 21%);
122+
}

routes/blogs.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ router.get("/blogs/new", function(req, res) {
99

1010
//POST
1111
router.post("/blogs", function(req, res) {
12-
Blog.create(req.body.blog, function(err, newlyCreated){
12+
var title = req.body.title
13+
var image = req.body.image
14+
var body = req.body.body
15+
var author = {
16+
id: req.user._id,
17+
username: req.user.username
18+
}
19+
var newBlog = {title, image, body, author}
20+
Blog.create(newBlog, function(err, newlyCreated){
1321
if(err){
1422
console.log(err);
1523
res.render("blogs/new")

views/blogs/new.ejs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<center><h3 class="title is-3" style="padding: 50px;">CREATE A NEW BLOG</h3></center>
33
<form action="/blogs" method="POST" style="margin: auto; width: 40%;">
44
<div class="field">
5-
<input class="input is-info" type="text" name="blog[title]" placeholder="Title">
5+
<input class="input is-info" type="text" name="title" placeholder="Title">
66
</div>
77
<div class="field">
8-
<input class="input is-info" type="text" name="blog[image]" placeholder="Image URL">
8+
<input class="input is-info" type="text" name=image" placeholder="Image URL">
99
</div>
1010
<div class="field">
11-
<textarea class="textarea is-info" name="blog[body]" placeholder="Body"></textarea>
11+
<textarea class="textarea is-info" name="body" placeholder="Body"></textarea>
1212
</div>
1313
<button class="button is-primary is-outlined">Create</button>
1414
</form>

views/home.ejs

Lines changed: 41 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<form action="/register" method="POST">
99
<div class="card" style="padding-top: 20px; border-radius: 10px;">
1010
<div class="card-content">
11-
<!-- --EDIT CODE FOR SIGN UP FORM HERE--- -->
11+
<!-- --EDIT CODE FOR SIGN UP/LOGIN FORM HERE--- -->
1212
<div class="field">
1313
<label class="label">Username</label>
1414
<div class="control">
@@ -25,10 +25,10 @@
2525
</div>
2626
<footer class="card-footer">
2727
<p class="card-footer-item">
28-
<button class="button is-primary is-outlined" style="width: 100%;">Sign Up</button>
28+
<button formaction="/login" class="button is-primary is-outlined btn-grad" style="width: 100%;">Login</button>
2929
</p>
3030
<p class="card-footer-item">
31-
<button formaction="/login" class="button is-primary is-outlined" style="width: 100%;">Login</button>
31+
<button class="button is-primary is-outlined" style="width: 100%;">Sign Up</button>
3232
</p>
3333
</footer>
3434
</div>
@@ -47,7 +47,7 @@ HOMEPAGE COPIED FROM GITHUB-------------
4747
<div class="header-nav">
4848
<nav class="nav">
4949
<div class="nav-center">
50-
<a class="nav-item" href="index.html">
50+
<a class="nav-item" href="/">
5151
<b>Home</b>
5252
</a>
5353
<%if(!currentUser){%>
@@ -62,7 +62,7 @@ HOMEPAGE COPIED FROM GITHUB-------------
6262
<b>Sign Out</b>
6363
</a>
6464
<a class="nav-item -end">
65-
<b>Welcome </b>
65+
<b>Welcome <%=currentUser.username%></b>
6666
</a>
6767
<%}%>
6868
</div>
@@ -90,87 +90,50 @@ HOMEPAGE COPIED FROM GITHUB-------------
9090
<!-- main body content -->
9191
<div class="main-content">
9292
<div class="container">
93-
<div class="columns is-centered is-multiline has-text-centered">
94-
<div class="column is-8">
95-
<% blogs.forEach(function(blog) { %>
96-
<h3 class="title is-3"><b><a href="post.html"><%=blog.title%></a></b></h3>
97-
<h4 class="title is-4 is-spaced"><%=blog.body%></h4>
98-
<h6 class="subtitle is-6">Posted by <%=blog.author.username%>on April 7th 2017 at 9:33pm</h6>
99-
<hr/>
100-
<%})%>
101-
<div class="post">
102-
<div class="content">
103-
<div class="content-header">
104-
<h3 class="title is-3"><b><a href="post.html">Crawling Over Sand</a></b></h3>
105-
<h4 class="title is-4 is-spaced">Tricks to crawl correctly!</h4>
106-
<h6 class="subtitle is-6">Posted by Author on April 2nd 2017 at 10:41am</h6>
107-
<hr/>
108-
</div>
109-
</div>
110-
</div>
111-
112-
<div class="post">
113-
<!-- post content -->
114-
<div class="content">
115-
<div class="content-header">
116-
<h3 class="title is-3"><b><a href="post.html">Old People Work Hard</a></b></h3>
117-
<h4 class="title is-4 is-spaced">At least I believe they do</h4>
118-
<h6 class="subtitle is-6">Posted by Author on April 1st 2017 at 11:00pm</h6>
119-
<hr/>
120-
</div>
121-
</div>
122-
<!-- end of post content -->
123-
</div>
124-
125-
<div class="post">
126-
<!-- post content -->
127-
<div class="content">
128-
<div class="content-header">
129-
<h3 class="title is-3"><b><a href="post.html">Apples Are Real</a></b></h3>
130-
<h4 class="title is-4 is-spaced">Apples are born from apples</h4>
131-
<h6 class="subtitle is-6">Posted by Author on March 20th 2017 at 9:00am</h6>
132-
<hr/>
133-
</div>
93+
<div class="columns is-centered is-multiline has-text-centered">
94+
<div class="column is-8">
95+
<% blogs.forEach(function(blog) { %>
96+
<h3 class="title is-3"><b><a href="post.html" class="has-text-dark"><%=blog.title%></a></b></h3>
97+
<!-- <h4 class="title is-4 is-spaced"><%=blog.body%></h4> -->
98+
<h6 class="subtitle is-6">Posted by <b><em><%=blog.author.username%></em></b> on April 7th 2017 at 9:33pm</h6>
99+
<hr/>
100+
<%})%>
101+
<!-- pagingation -->
102+
<nav class="has-text-right">
103+
<a class="pagination-next" disabled>Newer Posts</a>
104+
<a class="pagination-previous">Older Posts</a>
105+
</nav>
106+
<!-- end of pagination -->
107+
</div>
134108
</div>
135-
<!-- end of post content -->
136-
</div>
137-
138-
<!-- pagingation -->
139-
<nav class="has-text-right">
140-
<a class="pagination-next" disabled>Newer Posts</a>
141-
<a class="pagination-previous">Older Posts</a>
142-
</nav>
143-
<!-- end of pagination -->
144-
</div>
145-
</div>
146109
</div>
147110
</div>
148111
<!-- end of main content -->
149112

150113
<!-- footer -->
151114
<div class="footer">
152115
<div class="container">
153-
<div class="has-text-centered">
154-
<!-- nav icons -->
155-
<div class="nav-center">
156-
<a class="nav-item">
157-
<span class="icon">
158-
<i class="fa fa-twitter"></i>
159-
</span>
160-
</a>
161-
<a class="nav-item">
162-
<span class="icon">
163-
<i class="fa fa-facebook"></i>
164-
</span>
165-
</a>
166-
<a class="nav-item">
167-
<span class="icon">
168-
<i class="fa fa-github"></i>
169-
</span>
170-
</a>
171-
</div>
172-
<!-- end of nav icons -->
173-
</div>
116+
<div class="has-text-centered">
117+
<!-- nav icons -->
118+
<div class="nav-center">
119+
<a class="nav-item">
120+
<span class="icon">
121+
<i class="fa fa-twitter"></i>
122+
</span>
123+
</a>
124+
<a class="nav-item">
125+
<span class="icon">
126+
<i class="fa fa-facebook"></i>
127+
</span>
128+
</a>
129+
<a class="nav-item">
130+
<span class="icon">
131+
<i class="fa fa-github"></i>
132+
</span>
133+
</a>
134+
</div>
135+
<!-- end of nav icons -->
136+
</div>
174137
</div>
175138
</div>
176139
<!-- -----------------------------------

0 commit comments

Comments
 (0)