mirror of
https://github.com/sstent/expressmongotest.git
synced 2026-01-26 17:12:33 +00:00
refactored article to workout
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
extends ../layout
|
||||
block content
|
||||
h1= article.title
|
||||
|
||||
div!= article.body
|
||||
|
||||
hr
|
||||
|
||||
p
|
||||
span Author:
|
||||
|
||||
a(href="/users/" + encodeURIComponent(article.author.name))= article.author.name
|
||||
@@ -1,5 +0,0 @@
|
||||
ul
|
||||
- articles.forEach(function(article) {
|
||||
li
|
||||
a(href="/articles/" + encodeURIComponent(article._id))= article.title
|
||||
- });
|
||||
@@ -1,10 +1,10 @@
|
||||
extends ./layout
|
||||
|
||||
block content
|
||||
h1= title
|
||||
h1= #{title}
|
||||
p Welcome to #{title}
|
||||
|
||||
p
|
||||
a(href="/users") List Users
|
||||
p
|
||||
a(href="/articles") List Articles
|
||||
a(href="/workouts") List workouts
|
||||
|
||||
@@ -6,12 +6,12 @@ block content
|
||||
p
|
||||
a(href="/users/new") Create new profile
|
||||
p
|
||||
a(href="/articles/new") Create new article
|
||||
a(href="/workouts/new") Create new workout
|
||||
|
||||
p
|
||||
a(href="/users") List Users
|
||||
p
|
||||
a(href="/articles") List Articles
|
||||
a(href="/workouts") List workouts
|
||||
|
||||
|
||||
ul
|
||||
|
||||
@@ -10,9 +10,12 @@ block content
|
||||
- else
|
||||
h1 Public View
|
||||
|
||||
h2 Recent Articles:
|
||||
h2 Recent workouts:
|
||||
ul
|
||||
- recentArticles.forEach(function(article) {
|
||||
- recentworkouts.forEach(function(workout) {
|
||||
li
|
||||
a(href="/articles/" + encodeURIComponent(article._id))= article.title
|
||||
a(href="/workouts/" + encodeURIComponent(workout._id))= workout.title
|
||||
- });
|
||||
|
||||
- if (session.user.is_admin === true)
|
||||
a(href="/users/") Goto Admin Page
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
extends ../layout
|
||||
|
||||
block content
|
||||
h1 Articles
|
||||
h1 workouts
|
||||
|
||||
p
|
||||
a(href="/articles/new") Create new article
|
||||
a(href="/workouts/new") Create new workout
|
||||
p
|
||||
a(href="/users") List Users
|
||||
p
|
||||
a(href="/articles") List Articles
|
||||
a(href="/workouts") List workouts
|
||||
|
||||
|
||||
include list
|
||||
5
test/views/workouts/list.jade
Normal file
5
test/views/workouts/list.jade
Normal file
@@ -0,0 +1,5 @@
|
||||
ul
|
||||
- workouts.forEach(function(workout) {
|
||||
li
|
||||
a(href="/workouts/" + encodeURIComponent(workout._id))= workout.title
|
||||
- });
|
||||
@@ -1,9 +1,9 @@
|
||||
extends ../layout
|
||||
|
||||
block content
|
||||
h1 New Article
|
||||
h1 New workout
|
||||
|
||||
form(method="POST", action="/articles")
|
||||
form(method="POST", action="/workouts")
|
||||
p
|
||||
label(for="title") UserID<br />
|
||||
input#title(name="User_ID")
|
||||
12
test/views/workouts/workout.jade
Normal file
12
test/views/workouts/workout.jade
Normal file
@@ -0,0 +1,12 @@
|
||||
extends ../layout
|
||||
block content
|
||||
h1= workout.title
|
||||
|
||||
div!= workout.body
|
||||
|
||||
hr
|
||||
|
||||
p
|
||||
span Author:
|
||||
|
||||
a(href="/users/" + encodeURIComponent(workout.author.name))= workout.author.name
|
||||
Reference in New Issue
Block a user