Skip to content

Commit 3cbd481

Browse files
committed
lecture 13
1 parent 25d3d69 commit 3cbd481

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

Lecture13/express-todo-hbs/index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ app.set('view engine', 'hbs')
55

66
app.use(express.urlencoded({extended: true}))
77

8-
const bands = [{
8+
let bands = [{
99
id: 1,
1010
title: 'Nirvana',
1111
striked: false
@@ -35,6 +35,13 @@ app.post('/update/:id', (req, res) => {
3535
res.redirect('/')
3636
})
3737

38+
app.post('/delete', (req, res) => {
39+
bands = bands
40+
.filter(b => !b.striked)
41+
.map((el, index) => ({ ...el, id: index + 1}))
42+
res.redirect('/')
43+
})
44+
3845
app.listen(3000, function () {
3946
console.log("Listening on 30000")
4047
})

Lecture13/express-todo-hbs/views/index.hbs

+5
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,10 @@
3838
</li>
3939
{{/each}}
4040
</ul>
41+
42+
43+
<form action="/delete" method="POST">
44+
<button>BIN</button>
45+
</form>
4146
</body>
4247
</html>

Lecture13/jquery/index.html

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<style>
10+
.striked {
11+
text-decoration: line-through
12+
}
13+
</style>
14+
<body>
15+
<div class="head">
16+
<ul>
17+
<li>Item 1</li>
18+
<li>Item 2</li>
19+
<li>Item 3</li>
20+
</ul>
21+
</div>
22+
<p id="blah" data-special="secret">
23+
This is a para
24+
</p>
25+
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
26+
<script src="index.js"> </script>
27+
</body>
28+
</html>

Lecture13/jquery/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("hello world")

0 commit comments

Comments
 (0)