forked from jaiswaladi246/3-Tier-Full-Stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.ejs
72 lines (68 loc) · 3.35 KB
/
edit.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<% layout('layouts/boilerplate')%>
<div class="row">
<h1 class="text-center">Edit Campground</h1>
<div class="col-md-6 offset-md-3">
<form action="/campgrounds/<%=campground._id%>?_method=PUT" method="POST" novalidate class="validated-form"
enctype="multipart/form-data">
<div class="mb-3">
<label class="form-label" for="title">Title</label>
<input class="form-control" type="text" id="title" name="campground[title]"
value="<%=campground.title %>" required>
<div class="valid-feedback">
Looks good!
</div>
</div>
<div class="mb-3">
<label class="form-label" for="location">Location</label>
<input class="form-control" type="text" id="location" name="campground[location]"
value="<%=campground.location %>" required>
<div class="valid-feedback">
Looks good!
</div>
</div>
<div class="mb-3">
<label class="form-label" for="price">Campground Price</label>
<div class="input-group">
<span class="input-group-text" id="price-label">$</span>
<input type="text" class="form-control" id="price" placeholder="0.00" aria-label="price"
aria-describedby="price-label" name="campground[price]" value="<%=campground.price %>"
required>\<div class="valid-feedback">
Looks good!
</div>
</div>
</div>
<div class="mb-3">
<label class="form-label" for="description">Description</label>
<textarea class="form-control" type="text" id="description" name="campground[description]"
required><%= campground.description%></textarea>
<div class="valid-feedback">
Looks good!
</div>
</div>
<div class="mb-3">
<div class="form-file custom-file">
<input type="file" class="form-file-input" id="image" name="image" multiple>
<!-- multiple for upload multiple img -->
<label class="form-file-label" for="image">
<span class="form-file-text custom-file-label">Add more image(s)...</span>
<span class="form-file-button">Browse</span>
</label>
</div>
</div>
<div class="mb-3">
<% campground.images.forEach(function(img, i) { %>
<img src="<%=img.thumbnail %>" class="img-thumbnail" alt="">
<div class="form-check-inline">
<input type="checkbox" id="image-<%=i%>" name="deleteImages[]" value="<%=img.filename%>">
<!-- each time checkbox is selected, it add file name (as str) to deleteImages array -->
</div>
<label for="image-<%=i%>">Delete?</label>
<% })%>
</div>
<div class="mb-3">
<button class="btn btn-info">Update Campground</button>
</div>
</form>
<a href="/campgrounds/<%= campground._id%>">Back To Campground</a>
</div>
</div>