mirror of
https://github.com/sstent/expressmongotest.git
synced 2026-01-26 17:12:33 +00:00
added article
This commit is contained in:
13
test/views/articles/article.jade
Normal file
13
test/views/articles/article.jade
Normal file
@@ -0,0 +1,13 @@
|
||||
h1= article.title
|
||||
|
||||
div!= article.body
|
||||
|
||||
hr
|
||||
|
||||
p
|
||||
span Author:
|
||||
|
||||
a(href="/users/" + encodeURIComponent(article.author.username))= article.author.full_name
|
||||
|
||||
p
|
||||
a(href="/articles") Back to all articles
|
||||
15
test/views/articles/index.jade
Normal file
15
test/views/articles/index.jade
Normal file
@@ -0,0 +1,15 @@
|
||||
h1 Articles
|
||||
|
||||
p
|
||||
a(href="/articles/new") Create new article
|
||||
|
||||
p!= partial('articles/list', {articles: articles})
|
||||
|
||||
- if (page > 0) {
|
||||
a(href="?page=" + (page - 1)) Previous
|
||||
|
||||
- }
|
||||
|
||||
- if (! lastPage) {
|
||||
a(href="?page=" + (page + 1)) Next
|
||||
- }
|
||||
5
test/views/articles/list.jade
Normal file
5
test/views/articles/list.jade
Normal file
@@ -0,0 +1,5 @@
|
||||
ul
|
||||
- articles.forEach(function(article) {
|
||||
li
|
||||
a(href="/articles/" + encodeURIComponent(article.title))= article.title
|
||||
- });
|
||||
11
test/views/articles/new.jade
Normal file
11
test/views/articles/new.jade
Normal file
@@ -0,0 +1,11 @@
|
||||
h1 New Article
|
||||
|
||||
form(method="POST", action="/articles")
|
||||
p
|
||||
label(for="title") Title<br />
|
||||
input#title(name="title")
|
||||
p
|
||||
label(for="body") Body<br />
|
||||
textarea#body(name="body")
|
||||
p
|
||||
input(type="submit", value="Create")
|
||||
@@ -1,2 +1,7 @@
|
||||
h1= title
|
||||
p Welcome to #{title}
|
||||
p Welcome to #{title}
|
||||
|
||||
p
|
||||
a(href="/users") List Users
|
||||
p
|
||||
a(href="/articles") List Articles
|
||||
|
||||
@@ -2,6 +2,8 @@ h1 Users
|
||||
|
||||
p
|
||||
a(href="/users/new") Create new profile
|
||||
p
|
||||
a(href="/articles/new") Create new article
|
||||
|
||||
ul
|
||||
- users.forEach(function(user) {
|
||||
|
||||
@@ -10,8 +10,5 @@ form(method="POST", action="/users")
|
||||
p
|
||||
label(for="password") Password<br />
|
||||
input#password(type="password", name="password")
|
||||
p
|
||||
label(for="bio") Bio<br />
|
||||
textarea#bio(name="bio")
|
||||
p
|
||||
input(type="submit", value="Create")
|
||||
@@ -1,7 +1,8 @@
|
||||
h1= user.name
|
||||
|
||||
h2 Bio
|
||||
p= user.bio
|
||||
h2 Recent Articles:
|
||||
p!= partial('articles/list', {articles: recentArticles })
|
||||
|
||||
|
||||
form(action="/users/" + encodeURIComponent(user.username), method="POST")
|
||||
input(name="_method", type="hidden", value="DELETE")
|
||||
|
||||
Reference in New Issue
Block a user