-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathHomePageV2.html
531 lines (482 loc) · 19.3 KB
/
HomePageV2.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
<!DOCTYPE html>
<html lang="en">
<head>
<!--firebase-->
<script src='https://cdn.firebase.com/js/client/2.4.1/firebase.js'></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SwapMySkills</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link href="modalworking.css" rel="stylesheet">
</head>
<body>
<script>
var myDataRef = new Firebase('https://sizzling-inferno-5934.firebaseio.com/');
var userRef = myDataRef.child("users");
function submit(){
//check if passwords match before creating user
if($('#passwordinput').val() == $('#re-enterpasswordinput').val()){
// create account with username and password
if($('#firstnameinput').val()!= "" && $('#lastnameinput').val() != "" && $('#phoneinput').val() != ""){
myDataRef.createUser({
email : $('#emailinput').val(),
password : $('#passwordinput').val()
}, function(error, userData) {
if (error) {
alert(error);
} else {
// generated user authentication key used as primary key
var userKey = userData.uid;
// add user details to database
userRef.child(userKey).set(
{
email: $('#emailinput').val(),
fname: $('#firstnameinput').val(),
lname: $('#lastnameinput').val(),
county: $('#countyinput').val(),
telephone: $('#phoneinput').val(),
town: $('#towninput').val(),
userdescription: ""
}
);
alert("Successfully created user account");
// clear fields when user account created
$('#emailinput').val("");
$('#firstnameinput').val("");
$('#lastnameinput').val("");
$('#countyinput').val("");
$('#phoneinput').val("");
$('#towninput').val("");
$('#re-enterpasswordinput').val("");
$('#passwordinput').val("");
}
});
}
else{
alert("Please fill in *required fields");
}
}else{
alert("Passwords do not match");
}
return;
}
function login(){
// log in with email and password
var auth = myDataRef.getAuth();
if (auth) {
alert("User is already logged in");
} else {
myDataRef.authWithPassword({
email : $('#inputSuccess2').val(),
password : $('#inputSuccess3').val()
}, function(error, authData) {
if (error) {
alert(error);
} else {
$('#inputSuccess2').val("");
$('#inputSuccess3').val("");
$('#loginbtn').hide();
$('#signupbtn').hide();
$('#viewprofile').show();
$('#logoutbtn').show();
alert("user logged in");
}},{ remember: "sessionOnly"
});
}
return;
}
function GoToProfile(){
location.href = "PersonalProfile.html";
}
function Logout(){
myDataRef.unauth();
var auth = myDataRef.getAuth();
if (auth) {
alert("error logging user out")
}else{
alert("user logged out");
}
$('#loginbtn').show();
$('#signupbtn').show();
$('#viewprofile').hide();
$('#logoutbtn').hide();
}
function ArtsAndCrafts(){
sessionStorage.setItem('label', 'Arts and Crafts');
}
function Coding(){
sessionStorage.setItem('label', 'Coding');
}
function Cooking(){
sessionStorage.setItem('label', 'Cooking');
}
function Construction(){
sessionStorage.setItem('label', 'Construction');
}
function Carpentry(){
sessionStorage.setItem('label', 'Carpentry');
}
function Farming(){
sessionStorage.setItem('label', 'Farming');
}
function Languages(){
sessionStorage.setItem('label', 'Languages');
}
function Mechanics(){
sessionStorage.setItem('label', 'Mechanics');
}
function Painting(){
sessionStorage.setItem('label', 'Painting');
}
function Sports(){
sessionStorage.setItem('label', 'Sports');
}
function WebDesign(){
sessionStorage.setItem('label', 'Web Design');
}
function Other(){
sessionStorage.setItem('label', 'Other');
}
</script>
<!--FIXED MAIN NAVBAR-->
<div class="navbar navbar-default navbar-fixed-top navbar-custom" role="navigation">
<div class="container">
<div class="navbar-header">
<!--MOBILE AND TABLET MENU ICON-->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse" id="toggleButton">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!--END MOBILE AND TABLET MENU ICON-->
<a class="navbar-brand" href="#">SwapMySkills</a>
</div>
<div class="navbar-collapse collapse">
<!--NAVIGATION LINKS-->
<ul class="nav navbar-nav navbar-center">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<!--SAMPLE DROPDOWN-->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown<span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Admin & Dashboard</li>
<li><a href="#">Admin 1</a></li>
<li><a href="#">Admin 2</a></li>
<li class="divider"></li>
<li class="dropdown-header">Portfolio</li>
<li><a href="#">Portfolio 1</a></li>
<li><a href="#">Portfolio 2</a></li>
</ul>
</li>
<!--END SAMPLE DROPDOWN-->
<li><a href="#contact" data-toggle="modal">Contact</a></li>
</ul>
<!--NAVIGATION LINKS-->
<!--SEARCH BAR-->
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Search Listings by Skill<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="SearchResult.html" onclick="ArtsAndCrafts()">Arts and Crafts</a></li>
<li><a href="SearchResult.html" onclick="Coding()">Coding</a></li>
<li><a href="SearchResult.html" onclick="Cooking()">Cooking</a></li>
<li><a href="SearchResult.html" onclick="Construction()">Construction</a></li>
<li><a href="SearchResult.html" onclick="Carpentry()">Carpentry</a></li>
<li><a href="SearchResult.html" onclick="Farming()">Farming</a></li>
<li><a href="SearchResult.html" onclick="Languages()">Languages</a></li>
<li><a href="SearchResult.html" onclick="Mechanics()">Mechanics</a></li>
<li><a href="SearchResult.html" onclick="Painting()">Painting</a></li>
<li><a href="SearchResult.html" onclick="Sports()">Sports</a></li>
<li><a href="SearchResult.html" onclick="WebDesign()">Web Design</a></li>
<li><a href="SearchResult.html" onclick="Other()">Other</a></li>
</ul>
</li>
<!--<div class="row">
<div id="custom-search-input">
<div class="input-group">
<input type="text" class=" search-query form-control" placeholder="Search" />
<span class="input-group-btn"><button class="btn btn-danger" type="button"><span class=" glyphicon glyphicon-search"></span>
</button></span>
</div>
</div>
</div>-->
</ul>
<!--END SEARCHBAR-->
</div>
</div>
</div>
<!--END MAIN NAVBAR-->
<!--JUMBOTRON-->
<div class="jumbotron text-center" id="homejumbo">
<h1>SwapMySkills</h1>
<p>If everyone is moving forward together, then success takes care of itself.</p>
<a href="#" id="loginbtn" class="btn btn-primary" data-toggle="modal" data-target="#login">Log In</a>
<a href="#" id="signupbtn" class="btn btn-success" data-toggle="modal" data-target="#signup">Sign Up</a>
<a href="#" id="viewprofile" class="btn btn-primary" onclick="GoToProfile()">View Profile</a>
<a href="#" id="logoutbtn" class="btn btn-success" onclick="Logout()">Log Out</a>
<!--<form>
<div class="input-group input-group-lg" id="homeSearch">
<input type="text" class="form-control" placeholder="SEARCH">
</div>
</form>-->
</div>
<!--END JUMBOTRON-->
<!--GRID FOR LISTINGS-->
<div class="container-fluid" id="homegrid">
<div class="row"> <!--ROW 1-->
<div class="col-md-4">
<a href="#">
<img class="img-rounded" src="img/mechanic.jpg" alt="mechanic">
</a>
<h3>Listing 1</h3>
<p>The text brief for the first listing can go here.
The text brief for the first listing can go here.
The text brief for the first listing can go here.
The text brief for the first listing can go here.
The text brief for the first listing can go here.
The text brief for the first listing can go here.
The text brief for the first listing can go here.
The text brief for the first listing can go here.
The text brief for the first listing can go here. </p>
<a href="#" class="btn btn-danger">View Listing</a>
</div>
<div class="col-md-4">
<a href="#">
<img class="img-rounded" src="img/chef.jpg" alt="chef">
</a>
<h3>Listing 2</h3>
<p>The text brief for the second listing can go here.
The text brief for the second listing can go here.
The text brief for the second listing can go here.
The text brief for the second listing can go here.
The text brief for the second listing can go here.
The text brief for the second listing can go here.
The text brief for the second listing can go here.
The text brief for the second listing can go here.
The text brief for the second listing can go here. </p>
<a href="#" class="btn btn-danger">View Listing</a>
</div>
<div class="col-md-4">
<a href="#">
<img class="img-rounded" src="img/painter.jpg" alt="painter">
</a>
<h3>Listing 3</h3>
<p>The text brief for the third listing can go here.
The text brief for the third listing can go here.
The text brief for the third listing can go here.
The text brief for the third listing can go here.
The text brief for the third listing can go here.
The text brief for the third listing can go here.
The text brief for the third listing can go here.
The text brief for the third listing can go here.
The text brief for the third listing can go here. </p>
<a href="#" class="btn btn-danger">View Listing</a>
</div>
</div>
<div class="row"> <!--ROW 2-->
<div class="col-md-4">
<a href="#">
<img class="img-rounded" src="img/painter.jpg" alt="painter">
</a>
<h3>Listing 4</h3>
<p>The text brief for the fourth listing can go here.
The text brief for the fourth listing can go here.
The text brief for the fourth listing can go here.
The text brief for the fourth listing can go here.
The text brief for the fourth listing can go here.
The text brief for the fourth listing can go here.
The text brief for the fourth listing can go here.
The text brief for the fourth listing can go here.
The text brief for the fourth listing can go here.
</p>
<a href="#" class="btn btn-danger">View Listing</a>
</div>
<div class="col-md-4">
<a href="#">
<img class="img-rounded" src="img/chef.jpg" alt="chef">
</a>
<h3>Listing 5</h3>
<p>The text brief for the fifth listing can go here.
The text brief for the fifth listing can go here.
The text brief for the fifth listing can go here.
The text brief for the fifth listing can go here.
The text brief for the fifth listing can go here.
The text brief for the fifth listing can go here.
The text brief for the fifth listing can go here.
The text brief for the fifth listing can go here.
The text brief for the fifth listing can go here. </p>
<a href="#" class="btn btn-danger">View Listing</a>
</div>
<div class="col-md-4">
<a href="#">
<img class="img-rounded" src="img/mechanic.jpg" alt="mechanic">
</a>
<h3>Listing 6</h3>
<p>The text brief for the sixth listing can go here.
The text brief for the sixth listing can go here.
The text brief for the sixth listing can go here.
The text brief for the sixth listing can go here.
The text brief for the sixth listing can go here.
The text brief for the sixth listing can go here.
The text brief for the sixth listing can go here.
The text brief for the sixth listing can go here.
The text brief for the sixth listing can go here.</p>
<a href="#" class="btn btn-danger">View Listing</a>
</div>
</div>
</div>
<!--END GRID FOR LISTINGS-->
<!--FIXED FOOTER NAVBAR-->
<div class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container">
<div class="navbar-text pull-left" id="footerText">
<p>2016 Software Project</p>
</div>
<div class="navbar-text pull-right">
<a href="#"><i class="fa fa-facebook-square fa-2x"></i></a>
<a href="#"><i class="fa fa-twitter fa-2x"></i></a>
<a href="#"><i class="fa fa-google-plus fa-2x"></i></a>
</div>
</div>
</div>
<!--END FIXED FOOTER NAVBAR-->
<!--CONTACT MODAL-->
<div class="modal fade" id="contact" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<!--MODAL HEADER-->
<div class="modal-header">
<h4>Contact</h4>
</div>
<!--END MODAL HEADER-->
<!--MODAL BODY-->
<div class="modal-body">
<p>For general inquiries please email ___@______.__</p>
</div>
<!--END MODAL BODY-->
<!--MODAL FOOTER-->
<div class="modal-footer"> <!-- Button to close modal -->
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
</div>
<!--END MODAL FOOTER-->
</div>
</div>
</div>
<!--END CONTACT MODAL-->
<!-- SIGN UP MODAL -->
<div class="modal fade" id="signup" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<!--MODAL HEADER-->
<div class="modal-header"> <!-- Button to close modal -->
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">Sign Up</h4>
</div>
<!--END MODAL HEADER-->
<!--SIGN UP FORM-->
<div class="modal-body form-inline">
<div class="form-group has-feedback"> <!-- FirstName -->
<label class="control-label" for="firstnamelabel">* First name</label>
<input type="text" class="form-control" id="firstnameinput" aria-describedby="firstnameinput" required="">
</div>
<div class="form-group has-feedback"> <!-- LastName -->
<label class="control-label" for="lastnamelabel">* Last name</label>
<input type="text" class="form-control" id="lastnameinput" aria-describedby="lastnameinput" required="">
</div>
<div class="form-group has-feedback"> <!-- Email -->
<label class="control-label" for="emaillabel">* Email address</label>
<input type="email" class="form-control" id="emailinput" aria-describedby="emailinput" required="">
</div>
<div class="form-group has-feedback"> <!-- Telephone -->
<label class="control-label" for="phonelabel">* Telephone</label>
<input type="tel" class="form-control" id="phoneinput" aria-describedby="phoneinput" required="">
</div>
<div class="form-group has-feedback"> <!-- Password -->
<label class="control-label" for="passwordlabel">* Password</label>
<input type="password" class="form-control" id="passwordinput" aria-describedby="passwordinput" required="">
</div>
<div class="form-group has-feedback"> <!-- Password Repeat -->
<label class="control-label" for="re-enterpasswordlabel">* Re-enter password</label>
<input type="password" class="form-control" id="re-enterpasswordinput" aria-describedby="re-enterpasswordinput" required="">
</div>
<div class="form-group has-feedback"> <!-- Town -->
<label class="control-label" for="townlabel">Town/City</label>
<input type="text" class="form-control" id="towninput" aria-describedby="towninput">
</div>
<div class="form-group has-feedback"> <!-- County -->
<label class="control-label" for="countylabel">County</label>
<input type="text" class="form-control" id="countyinput" aria-describedby="countyinput">
</div>
<br/>
<!--SUBMIT BUTTON-->
<div class="form-group">
<button type="button" class="btn btn-success" onclick="submit()" data-dismiss="modal">Sign up</button>
</div>
<!--END SUBMIT BUTTON->
<!--MODAL FOOTER-->
<div class="modal-footer"> <!-- Link to Log In modal -->
If you are an existing member of this site you can <a data-toggle="modal" data-target="#login" data-dismiss="modal"> log in here</a>
</div>
<!--END MODAL FOOTER-->
</div>
<!--END SIGN UP FORM-->
</div>
</div>
</div>
<!--END SIGN UP MODAL-->
<!--LOG IN MODAL-->
<div class="modal fade" id="login" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<!--MODAL HEADER-->
<div class="modal-header"> <!-- Button to close modal -->
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Log In</h4>
</div>
<!--END MODAL HEADER-->
<!--MODAL BODY-->
<div class="modal-body">
<div class="form-group has-feedback"> <!-- Email Address -->
<label class="control-label">Email Address</label>
<input type="email" class="form-control" id="inputSuccess2" aria-describedby="inputSuccess2Status" placeholder="Email">
</div>
<div class="form-group has-feedback"> <!-- Password -->
<label class="control-label">Password</label>
<input type="password" class="form-control" id="inputSuccess3" aria-describedby="inputSuccess2Status" placeholder="Password">
</div>
<button type="button" onclick="login()" class="btn btn-primary" data-dismiss="modal">Login</button>
<input type="checkbox" value="rememberme" id="rememberme">Remember me <br/><br/>
<a href="#">Forgot your password?</a>
</div>
<!--END MODAL BODY-->
<!--MODAL FOOTER-->
<div class="modal-footer">
<h4 class="modal-title" id="myModalLabel">Register</h4> <!-- redirect to sign up -->
If you are not an existing member of this site you can <a data-toggle="modal" data-target="#signup" data-dismiss="modal"> register here</a>
</div>
<!--END MODAL FOOTER-->
</div>
</div>
</div>
<!--END LOG IN MODAL-->
<script>
var ref = new Firebase('https://sizzling-inferno-5934.firebaseio.com/');
var authData = ref.getAuth();
if(authData == null){
document.getElementById("viewprofile").style.display = "none";
document.getElementById("logoutbtn").style.display = "none";
}else{
document.getElementById("signupbtn").style.display = "none";
document.getElementById("loginbtn").style.display = "none";
}
</script>
</script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>