forked from STIPCommonsLab/ccsinventory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
498 lines (453 loc) · 20.2 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>Federal Crowdsourcing and Citizen Science Catalog</title>
<link rel="stylesheet" href="css/cartodb.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800">
<link rel="stylesheet" href="css/style.css" />
</head>
<body class="container-fluid">
<header>
<nav class="row">
<div class="col-md-6">
</div>
<div class="col-md-6">
<span><a class="current" href="about.html">About The Catalog</a></span>
<span><a class="current" href="add.html">Add A Project</a></span>
<span><a class="current" href="https://www.citizenscience.gov">CitizenScience.gov</a></span>
</div>
</nav>
<section id="hero-intro" class="row">
<a href="https://ccsinventory.wilsoncenter.org/">
<img src="img/Catalog-Gray.png"
style= "float: left" width="200" height="60" hspace="15" vspace="13"/> </a>
<h2>Federal Crowdsourcing and Citizen Science Catalog</h2>
</section>
</header>
<main class="main-content row">
<section id="project_panel" class="hidden">
<div id="project_data" class="row"></div>
</section>
<section id="filters" class="col-md-2">
<p><small>
FIND PROJECTS: <a href="#" data-toggle="tooltip" data-placement="right" title=""
data-original-title="Search by project name, description and keywords. Leave blank to show all">
<span class="glyphicon glyphicon-info-sign"></span></a>
</small></p>
<div class="input-group">
<input id="searchinput" class="form-control" placeholder="Search for..." value="" type="search"> <span id="searchclear" class="glyphicon glyphicon-remove-circle" style="display: none;"></span>
<span class="input-group-btn">
<button id="filter-btn" class="btn btn-default" type="button"><i class="glyphicon glyphicon-search"></i></button>
</span>
</div>
<p><small>
FILTER BY: <a href="#" data-toggle="tooltip" data-placement="right" title="" data-original-title="You may browse for projects with specific attributes including project topic, project status, intended age group, and many others."><span class="glyphicon glyphicon-info-sign"></span></a>
</small></p>
<div id="project_topic_filter" class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Project Topic
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
<div id="project_topic" class="panel-body">
</div>
</div>
</div>
<div id="agency_sponsor_filter" class="panel panel-default">
<div class="panel-heading" role="tab" id="headingThree">
<h4 class="panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
Agency Sponsor
</a>
</h4>
</div>
<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
<div id="agency_sponsor" class="panel-body">
</div>
</div>
</div>
<div id="agency_partner_filter" class="panel panel-default">
<div class="panel-heading" role="tab" id="headingFour">
<h4 class="panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
Agency Partner
</a>
</h4>
</div>
<div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
<div id="agency_partner" class="panel-body">
</div>
</div>
</div>
<div id="participant_age_filter" class="panel panel-default">
<div class="panel-heading" role="tab" id="headingSix">
<h4 class="panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseSix" aria-expanded="false" aria-controls="collapseSix">
Participant Age
</a>
</h4>
</div>
<div id="collapseSix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSix">
<div id="participant_age" class="panel-body">
</div>
</div>
</div>
<div id="intended_outcomes_filter" class="panel panel-default">
<div class="panel-heading" role="tab" id="headingSeven">
<h4 class="panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseSeven" aria-expanded="false" aria-controls="collapseSeven">
Intended Outcomes
</a>
</h4>
</div>
<div id="collapseSeven" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSeven">
<div id="intended_outcomes" class="panel-body">
</div>
</div>
</div>
</section>
<section id="projects" class="col-md-2">
<div class="row">
<div id="projects-summary" class="col-md-6 text-center">
<h5>PROJECTS</h5>
<h2><span class="project-num">0</span></h2>
</div>
<div id="agencies-summary" class="col-md-6 text-center">
<h5>AGENCIES</h5>
<h2><span class="agency-num">0</span></h2>
</div>
</div>
<ul id="project_list" class="list-unstyled">
</ul>
</section>
<section id="map-container" class="col-md-8">
<div id="map" class="row"></div>
</section>
</main>
<footer>
<div class="row footer-nav">
<div class="col-md-offset-2 col-md-2">
<ul class="list-unstyled">
<li><a href="index.html">Home</a></li>
<li><a href="add.html">Add project</a></li>
<li><a href="about.html">About</a></li>
<li><a href="data-policy.html">Data policy</a></li>
<li><a href="http://www.wilsoncenter.org/privacy-policy">Privacy policy</a></li>
</ul>
</div>
<div class="initiative-by col-md-offset-2 col-md-6">
<p >An initiative led by the Wilson Center in partnership with the General Services Administration (GSA)</p>
<image xlink:href="img/commons_logo.svg" src="img/commons_logo.png"
width="260" height="40" />
<image xlink:href="img/wilson_logo.svg" src="img/wilson_logo.png"
width="260" height="40" />
</div>
</div>
</footer>
<!-- templates -->
<script type="text/template" id="filter-checkbox-tmpl">
<div class="checkbox">
<label>
<input type="checkbox" name="<%- property_code %>" onchange="Javascript:applyQuery();return false;"/>
<%- property_name %>
</label>
</div>
</script>
<!-- templates -->
<script type="text/template" id="filter-checkbox-other-tmpl">
<div class="checkbox">
<label>
<input type="checkbox" name="other" onchange="Javascript:applyQuery();return false;"/>
Other
</label>
</div>
</script>
<script type="text/template" id="project-list-tmpl">
<li><a href="#projectId/<%- cartodb_id %>"><%- project_name %></a><br/>
<small style="color: grey; font-size: 75%"> by <%
var sponsors = [];
if (agency_sponsor) {
agency_sponsor.split(",").forEach(function (item) {
var property = properties.findWhere({property_code: item.replace(/\s/g, '')});
if (typeof(property) != "undefined") {
sponsors.push(property.get('property_name'));
}else if (item.replace(/\s/g, '') == 'other') {
sponsors.push('Other');
}
});
}else{
sponsors.push('n/a');
}
%>
<%= sponsors.join(', ') %>
</small></li>
</script>
<script type="text/template" id="project-data-tmpl">
<button type="button" id="close" class="close col-md-1 " onclick="Javascript:close_project_panel();return false;">×</button>
<h3 class="col-md-12"><%- project_name %></h3>
<% if (project_url != null && project_url != '' && project_url != 'n/a' && project_url != '0') { %>
<p class="col-md-12"><a href="<%- project_url %>" target="_blank"><%- project_url %></a></p>
<% } %>
<p class="col-md-12"><%- project_description %></p>
<p class="col-md-12"><strong>Keywords:</strong> <%- keywords %></p>
<p class="col-md-12"><strong>Fields of science:</strong><%
var topics = [];
if(project_topic) {
project_topic.split(",").forEach(function (item) {
var property = properties.findWhere({property_code: item.replace(/\s/g, '')});
if (typeof(property) != "undefined") {
topics.push(property.get('property_name'));
}else if (item.replace(/\s/g, '') == 'other') {
topics.push('Other');
}
});
} else {
topics.push('n/a');
}
%>
<%= topics.join(', ') %>
</p>
<p class="col-md-12"><span><strong>Status:</strong><%
var property = properties.findWhere({property_code: status});
%>
<%= property.get('property_name') || 'n/a' %>
</span></p>
<p class="col-md-12"><span><strong>Start date:</strong> <%- start_date || 'n/a' %></span></p>
<p class="col-md-12"><strong>Federal Government Sponsor:</strong><%
var sponsors = [];
if(agency_sponsor) {
agency_sponsor.split(",").forEach(function (item) {
var property = properties.findWhere({property_code: item.replace(/\s/g, '')});
if (typeof(property) != "undefined") {
sponsors.push(property.get('property_name'));
}else if (item.replace(/\s/g, '') == 'other') {
sponsors.push('Other');
}
});
} else {
sponsors.push('n/a');
}
%>
<%= sponsors.join(', ')
%></p>
<p class="col-md-12"><strong>Other Federal Government Sponsor:</strong> <%- agency_sponsor_other || 'n/a' %></p>
<p class="col-md-12"><strong>Type of Nonfederal Government Sponsor:</strong><%
var partners = [];
if(agency_partner) {
agency_partner.split(",").forEach(function (item) {
var property = properties.findWhere({property_code: item.replace(/\s/g, '')});
if (typeof(property) != "undefined") {
partners.push(property.get('property_name'));
}else if (item.replace(/\s/g, '') == 'other') {
partners.push('Other');
}
});
} else {
partners.push('n/a');
}
%>
<%= partners.join(', ') %>
</p>
<p class="col-md-12"><strong>Name of
Nonfederal Government Sponsors:</strong> <%- agency_partner_name || 'n/a' %></p>
<p class="col-md-12"><strong>Geographic scope:</strong> <%- geographic_scope %></p>
<p class="col-md-12"><strong>Intended outcomes:</strong><%
var outcomes = [];
if(intended_outcomes) {
intended_outcomes.split(",").forEach(function (item) {
var property = properties.findWhere({property_code: item.replace(/\s/g, '')});
if (typeof(property) != "undefined") {
outcomes.push(property.get('property_name'));
}else if (item.replace(/\s/g, '') == 'other') {
outcomes.push('Other');
}
});
} else {
outcomes.push('n/a');
}
%>
<%= outcomes.join(', ') %>
</p>
<p class="col-md-12"><strong>Participation tasks:</strong><%
var tasks = [];
if(participation_tasks) {
participation_tasks.split(",").forEach(function (item) {
var property = properties.findWhere({property_code: item.replace(/\s/g, '')});
if (typeof(property) != "undefined") {
tasks.push(property.get('property_name'));
}else if (item.replace(/\s/g, '') == 'other') {
tasks.push('Other');
}
});
} else {
tasks.push('n/a');
}
%>
<%= tasks.join(', ') %>
</p>
<p class="col-md-12"><strong>Participant age:</strong><%
var ages = [];
if(participant_age) {
participant_age.split(",").forEach(function (item) {
var property = properties.findWhere({property_code: item.replace(/\s/g, '')});
if (typeof(property) != "undefined") {
ages.push(property.get('property_name'));
}else if (item.replace(/\s/g, '') == 'other') {
ages.push('Other');
}
});
} else {
ages.push('n/a');
}
%>
<%= ages.join(', ') %>
</p>
<% if (((typeof recruiting === 'boolean') && recruiting) ||
((typeof recruiting === 'string') && ((recruiting === 'true') || (recruiting === 'True')))) { %>
<p class="col-md-12"><strong>Recruiting Volunteers:</strong> Yes, this project is recruiting</p>
<% } %>
<div class="col-md-12" id="contact_info">
<h4>Contact information</h4>
<div><span class="glyphicon glyphicon-user" aria-hidden="true"></span><span><%- project_contact %></span><span><%- affiliation? ' - ' + affiliation : '' %></span></div>
<div id="contact_address"><span class="glyphicon glyphicon-home" aria-hidden="true"></span><% if ((street_address != null && street_address != '' && street_address != 'n/a') ||
(street_address_2 != null && street_address_2 != '' && street_address_2 != 'n/a')) { %>
<span><%- street_address %> <%- street_address_2 %></span>
<% } %>
<span><%- city ? ' - ' + city + ', ' : ' - ' %><%- state %> <%- zip ? '(' + zip + ')' : '' %></span></div>
<% if (phone != null && phone != '' && phone != 'n/a' && phone != '0') { %>
<span><span class="glyphicon glyphicon-earphone" aria-hidden="true"></span><%- phone %></span><br>
<% } %>
<% if (email != null && email != '' && email.indexOf('@') != -1) { %>
<span><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span><a href="mailto:<%- email %>" target="_top"><%- email %></a></span>
<% } %>
</div>
</script>
<script type="infowindow/html" id="infowindow_template">
<div class="cartodb-popup v2">
<a href="#close" class="cartodb-popup-close-button close">x</a>
<div class="cartodb-popup-content-wrapper">
<div class="cartodb-popup-content">
<h3>{{project_name}}</h3>
<p><a href="{{project_url}}" target="_blank">{{project_url}}</a></p>
<p><strong style="color:#FE8433">Keywords</strong>: {{keywords}}</p>
<p><a href="#projectId/{{cartodb_id}}">Expand project</a></p>
</div>
</div>
<div class="cartodb-popup-tip-container"></div>
</div>
</script>
<script src="js/vendor/jquery-min-1.11.3.js"></script>
<script src="js/vendor/bootstrap.min.js"></script>
<script src="js/vendor/cartodb.js"></script>
<script src="js/vendor/json2.js"></script>
<script src="js/vendor/underscore-min-1.8.2.js"></script>
<script src="js/vendor/backbone-min-1.2.1.js"></script>
<!-- our own -->
<script src="js/config.js"></script>
<script src="js/CCSI.js"></script>
<script src="js/models/Property.js"></script>
<script src="js/models/Project.js"></script>
<script src="js/collections/Properties.js"></script>
<script src="js/collections/Projects.js"></script>
<script src="js/views/PropertyComponent.js"></script>
<script src="js/views/OtherFilterComponent.js"></script>
<script src="js/views/ProjectPanel.js"></script>
<script src="js/views/ProjectList.js"></script>
<script src="js/routers/Project.js"></script>
<script src="js/main.js"></script>
<script>
// Flag we use for identifying when both the map and project collection
// have been loaded
var ready = false;
var map;
var previous_zoom = 3;
var previous_center = [36, -97];
var layer;
var jsonViz = cdb_inventory_viz;
function main() {
cartodb.createVis('map', jsonViz, {
tiles_loader: true,
center_lat: 36,
center_lon: -97,
zoom: 3,
infowindow: false
}).done(function(vis, layers) {
// you can get the native map to work with it
map = vis.getNativeMap();
layer = layers[1];
// Hack needed in order to add the infowindow programmatically
map.viz = vis;
// Manually add our infowindow
cdb.vis.Vis.addInfowindow(map, layer.getSubLayer(0),
['cartodb_id', 'project_name', 'keywords', 'project_url'],
{
infowindowTemplate: $('#infowindow_template').html(),
templateType: 'mustache',
triggerEvent: 'featureClick',
cursorInteraction: true,
sanitizeTemplate: false
}
);
if (ready) {
Backbone.history.start();
}
ready = true;
}).error(function(err) {
console.log(err);
});
$("#searchinput").keyup(function(){
$("#searchclear").toggle(Boolean($(this).val()));
});
$("#searchclear").toggle(Boolean($("#searchinput").val()));
$("#searchclear").click(function(){
$("#searchinput").val('').focus();
$(this).hide();
applyQuery();
});
$("#filter-btn").click(function() {
applyQuery();
});
$('#searchinput').bind("keypress", function (e) {
if (e.keyCode == 13) {
applyQuery();
}
});
$("#searchclear").click(function(){
$("#searchinput").val('').focus();
$(this).hide();
applyQuery();
});
$('#searchinput').bind('notext', function () {
applyQuery();
});
// Detect Browser Back Button
$( document ).ready(function($) {
if (window.history && window.history.pushState) {
$(window).on('popstate', function() {
var hashLocation = location.hash;
var hashSplit = hashLocation.split("#!/");
var hashName = hashSplit[1];
if (hashName !== '') {
var hash = window.location.hash;
if (hash === '') {
// project view visible?
if ($('#project-list-tmpl').length > 0) {
close_project_panel();
}
}
}
});
}
});
}
window.onload = main;
</script>
</body>
</html>