-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
231 lines (226 loc) · 9.07 KB
/
index.html
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<meta name="theme-color" content="#FFFFFF">
<link rel="apple-touch-icon" href="icons/180x180.png">
<link rel="stylesheet" type="text/css" href="./css/styles.css"/>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js" defer></script>
<link rel="manifest" href="cw2_3145.webmanifest">
<script src="./js/vue.js" defer></script>
<script src="./js/userForm.js" defer></script>
<script src="img/data.js" defer></script>
<title>cw1_3145</title>
</head>
<body>
<div class="container">
<header>
<div id="userForm">
<div id="popup1" class="overlay">
<div class="popup">
<h2>Sign Up</h2>
<a class="close" href="#">×</a>
<div class="content">
<form id="signUp">
<p>type:</p>
<div>
<input
id="user"
type="radio"
name="userType"
value="user"
v-model="userType"
/>
<label for="user">User</label>
</div>
<div>
<input
id="provider"
type="radio"
name="userType"
value="provider"
v-model="userType"
/>
<label for="provider">Provider</label>
</div>
<br/><br/>
<label for="email">email: </label>
<input
required
type="email"
id="SignUpEmail"
v-model="email"
autocomplete="current-password"
/>
<br/><br/>
<label for="password">password: </label>
<input
required
type="password"
id="SignUpPassword"
v-model="password"
autocomplete="current-password"
/>
<br/><br/>
<button @click="signUp">submit</button>
</form>
</div>
</div>
</div>
<div id="popup2" class="overlay">
<div class="popup">
<h2>Log In</h2>
<a class="close" href="#">×</a>
<div class="content">
<form id="login" @submit="logIn" action="/index.html">
<label for="email">email: </label>
<input
required
type="email"
id="email"
v-model="email"
autocomplete="username"
/>
<br/><br/>
<label for="password">password: </label>
<input
required
type="password"
id="password"
v-model="password"
autocomplete="current-password"
/>
<br/><br/>
<button type="submit">submit</button>
</form>
</div>
</div>
</div>
</div>
<div id="header-template">
<page-header></page-header>
</div>
</header>
<aside>
<div id="searchFilter">
<!-- search -->
Search <input v-model='term'><br><br>
<!-- sort -->
<select v-model="selected">
<option disabled>Sort By:</option>
<optgroup label="Topic">
<option>A - Z</option>
<option>Z - A</option>
</optgroup>
<optgroup label="Price">
<option>Low - High</option>
<option>High - Low</option>
</optgroup>
<optgroup label="Reviews">
<option>5 & Others</option>
</optgroup>
</select>
<!-- filter -->
<select multiple v-model='userTopics'>
<option v-for='topic in topics'>
{{topic}}
</option>
</select>
<select multiple v-model="userPrices">
<option v-for="price in prices">
{{price}}
</option>
</select>
<button v-on:click='reset'>reset</button>
</div>
</aside>
<main>
<button id="notifications">Allow Notifications</button>
<div id="results">
<!-- results -->
<div v-for='course in results' class='course'>
<div>
<img :src="'img/'+ course.topic +'.png'" :alt="course.topic"
width="100x100">
</div>
<div>
<label>Topic</label>
<input v-model="course.topic" :disabled="!course.isEditing" :class="{view: !course.isEditing}">
</div>
<div>
<label>Price</label>
<input v-model="course.price" :disabled="!course.isEditing" :class="{view: !course.isEditing}">
</div>
<div>
<label>Location</label>
<input v-model="course.location" :disabled="!course.isEditing"
:class="{view: !course.isEditing}">
</div>
<div>
<label>About</label>
<input v-model="course.about" :disabled="!course.isEditing" :class="{view: !course.isEditing}">
</div>
<div>
<label>Provider</label>
<input v-model="course.email" disabled :class="{view: !course.isEditing}">
</div>
<div>
<label>Ratings</label>
<div v-if="course.email !== currentEmail">
<select v-model="selectedRating">
<option selected disabled value="">Rating:</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<button @click="rate(course._id, currentEmail, selectedRating)">Rate</button>
</div>
<div v-if="course.rating.length === 0">
<p>No Rating</p>
</div>
<div v-else>
<select>
<option v-for="userScore in course.rating">{{userScore.user}}: {{userScore.score}}</option>
</select>
</div>
<button @click="resetRating(course._id)">Reset</button>
</div>
</div>
</div>
</main>
</div>
</body>
<script src="app.js" defer></script>
<script>
// Loading on demand
let imagesToLoad = document.querySelectorAll('img[data-src]');
console.log(imagesToLoad);
const loadImages = (image) => {
image.setAttribute('src', image.getAttribute('data-src'));
image.onload = () => {
image.removeAttribute('data-src');
};
};
if ('IntersectionObserver' in window) {
const observer = new IntersectionObserver((items, observer) => {
items.forEach((item) => {
if (item.isIntersecting) {
loadImages(item.target);
observer.unobserve(item.target);
}
});
});
imagesToLoad.forEach((img) => {
observer.observe(img);
});
} else {
imagesToLoad.forEach((img) => {
loadImages(img);
});
}
</script>
</html>