-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
188 lines (183 loc) · 7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Research page mockup</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css"
/>
<link
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
rel="stylesheet"
/>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<style>
a {
color: #2445bd;
}
body {
font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.btn-info,
.badge-info {
background-color: #2445bd;
}
.btn-sm {
font-size: 0.8em;
}
.btn {
border-radius: 0;
}
.card {
border-radius: 0;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="text/x-template" id="search-results-item">
<div class="row my-3">
<div class="col-12">
<div class="card">
<div class="card-body">
<p class="badge badge-info rounded-0 text-light text-uppercase">{{kindLabel(item.kind)}}</p>
<h5><a :href="item.url || ''" target="_blank">{{item.title}}</a></h5>
<p class="font-italic"><span v-if="item.author">{{item.author}}</span> </p>
<p class="text-muted">{{item.summary}}</p>
<p class="font-weight-lighter"><span v-if="item.publication">{{item.publication}}</span>, <span v-if="item.published">{{item.published}}</span></p>
<div class="row">
<div class="col" v-if="item.url">
<a :href="item.url" target="_blank">{{item.url}}</a>
</div>
<div class="col text-right" v-if="item.attachment">
<a :href="item.attachment" target="_blank">Download</a>
</div>
</div>
</div>
</div>
<!--card-->
</div>
</div>
</script>
<script type="text/x-template" id="search-results-header">
<div class="row my-3">
<div class="col-12">
<h3>{{title}}</h3>
</div>
</div>
</script>
<script type="text/x-template" id="search-results">
<div class="results">
<div v-if=error class="alert alert-light" role="alert">Some error occurred. Please try again later.</div>
<div v-else>
<search-results-item v-bind:item="item" v-for="item,idx in searchResults" v-bind:key="idx"/>
</div>
</div>
</script>
<script type="text/x-template" id="search-filter-template">
<div class="card bg-light text-dark my-3">
<div class="card-body">
<div v-if="loading">
<h6>Loading...</h6>
</div>
<div class="row" v-else>
<div class="col">
<h6>{{keywords}}</h6>
</div>
<div class="col-auto">
<button class="btn btn-secondary btn-sm text-uppercase" type="reset" @click="reset">Reset filter</button>
</form>
</div>
</div>
</div>
</div>
</div>
</script>
<script type="text/x-template" id="sortbox-template">
<div class="row">
<div class="col"><span class="ml-2">{{count}} results found</span></div>
<div class="col-auto">
<form class="form-inline">
<div class="mr-2 my-1"><small>Sort by</small></div>
<select name="sort_by" id="sort_by" class="custom-select custom-select-sm mr-2 my-1" v-model="sort_by">
<option value="created_date">Date added</option>
<option value="kind">Resource type</option>
</select>
<select name="sort_dir" id="sort_dir" class="custom-select custom-select-sm my-1" v-model="sort_dir">
<option value="-">Desc</option>
<option value="">Asc</option>
</select>
</form>
</div>
</div>
</script>
<script type="text/x-template" id="searchbox-template">
<div class="card bg-light">
<div class="card-body">
<form class="form-row" v-on:submit="submitForm">
<div class="col"><input
type="text"
class="form-control my-1 mr-sm-2 form-control-sm"
id="search_input"
v-model="searchText"
required
placeholder="Search"
/>
<div v-if="message" class="small"><span>{{message}}</span></div>
</div>
<div class="col-auto">
<select class="my-1 mr-sm-2 custom-select custom-select-sm" id="geo_area" v-model="region">
<option v-if="loading">Loading...</option>
<option :value="r.slug" v-for="r in regions" :key="r.id">{{r.name}}</option>
</select>
</div>
<div class="col-auto my-1">
<button type="submit" class="btn btn-info btn-sm text-uppercase">
Search
</button>
</div>
</form>
</div>
</div>
<!-- card end-->
</script>
<script type="text/x-template" id="topic-list-template">
<div>
<div class="row">
<div class="col-12 mt-2">
<h5 class="text-muted">TOPICS</h5>
</div>
</div>
<div class="row text-center">
<topic-item v-bind:topic="topic" v-for="topic,idx in topics" v-bind:key="idx" @click="selectTopic(topic)"/>
</div>
</div>
</script>
<script type="text/x-template" id="topic-item-template">
<div class="col-3 my-3">
<div class="card text-white" style="min-height: 150px; background-color:#2445bd" @click="$emit('click')">
<div class="card-body">
<h5 class="card-title text-uppercase" style=" font-size: 0.8em; padding-top: 40px"><a @click="$emit('click')" class="text-white" href="#">{{topic.title}}</a></h5>
</div>
</div>
</div>
</script>
<script type="text/x-template" id="app-template">
<div class="container-fluid">
<div class="row my-3">
<div class="col-12"><search-box v-on:search="searchSubmit"/></div>
</div>
<topic-list @topic="selectTopic" v-if="showTopics && !loadingTopics" :topics="topics"/>
<div v-if="loadingTopics" class="small">Loading..</div>
<search-filter v-if="hasSearchCriteria" :keywords="searchCriteria" :reset="resetFilter" :loading="loading" />
<sortbox :count="searchResults.length" :by="sort_by" :dir="sort_dir" v-if="hasSearchCriteria && !loading" />
<div v-if="hasSearchCriteria && !loading">
<search-results :searchResults="searchResults" :error="error" />
</div>
</div>
</script>
<script src="main.js"></script>
</body>
</html>