This repository has been archived by the owner on May 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy-forms.html
101 lines (82 loc) · 2.81 KB
/
my-forms.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
---
title: My Forms
layout: default
permalink: /my-forms/
---
<script>
savedFormsText = localStorage.getItem('myYukonForms');
if (!savedFormsText) {
savedForms = [];
} else {
savedForms = JSON.parse(savedFormsText)
}
headings = JSON.parse(localStorage.getItem('formHeadings'))
if (!headings){
headings = ['Home', 'Business', 'Education'];
}
$(document).ready(function() {
console.log(savedForms);
function addHeading(heading_text) {
var container = $('.heading'),
heading = $('<h4>').addClass('col-12 mt-4').text(heading_text);
container.append(heading);
}
var container = $('.heading');
$.each(savedForms,function(i,form){
if (i % 3 == 0) {
addHeading(headings[i/3])
}
// Let's create the DOM
var item = $('<div>').addClass('col-sm-6 col-md-4 my-3'),
link = $('<a>').addClass('card h-100'),
body = $('<div>').addClass('card-body'),
title = $('<h5>').addClass('card-title'),
href = '/view-form/' + '?form=' + form.href;
console.log(href);
// Add content to the DOM
title.text(form.page_title);
body.append(title)
link.attr('href',href).append(body);
item.append(link);
// Append the item to the container
item.appendTo(container);
});
});
// $.each(savedForms,function(i,form){
// // Let's create the DOM
// var item = $('<div>').addClass('col-sm-6 col-md-4 my-3'),
// link = $('<a>').addClass('card h-100'),
// body = $('<div>').addClass('card-body'),
// title = $('<h5>').addClass('card-title');
// // Add content to the DOM
// title.text(form.page_title);
// body.append(title)
// link.attr('href',form.href).append(body);
// item.append(link);
// // Append the item to the container
// item.appendTo(container);
// });
</script>
<div class="py-5 text-center">
<h2>Saved Forms</h2>
<form
class="mt-4 mx-auto"
id="searchForm"
style="max-width: 24rem"
action="https://yukon.ca/en/search"
method="get"
target="_blank"
>
<label class="sr-only" for="search">Search for Forms</label>
<div class="input-group mb-3">
<input type="search" name="query" class="form-control" placeholder="Search for forms…" id="search" autocomplete=false>
<div class="input-group-append">
<button class="btn btn-primary" type="submit" id="button-addon2"><i class="fas fa-search"></i></button>
</div>
</div>
</form>
</div>
<div class='forms heading row'></div>
<a href="{{ '/' | absolute_url }}">
<img class="aurora" src="http://localhost:4000/images/Aurora-main.svg" alt=""></div>
</a>