-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
125 lines (97 loc) · 4.39 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
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="js/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="js/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="js/chosen/chosen.css" rel="stylesheet">
<script src="js/jquery.183.min.js"></script>
</head>
<body>
<div class="container">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="#">Country List</a>
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
</ul>
</div>
</div>
<div id="filterList" class="row-fluid">
<div class="well">
<div class="row-fluid">
<div class="span2"><input type="text" name="search_all" class="search span12" placeholder="Search..." data-operator="in" data-type="string"></div>
<form id="search_form" data-persist="garlic">
<div class="span2 hide"><button class="sort btn btn-inverse span12" data-sort="caption">Sort by caption</button></div>
<div class="span2">
<select name="relevance" multiple="multiple" onchange="list.searchFilter()" class="span12" data-placeholder="Relevance" operator="in">
<option value="0.5">0.5</option>
<option value="1">1</option>
<option value="1.5">1.5</option>
<option value="2">2</option>
</select>
</div>
<div class="span3">
<select name="region" multiple="multiple" onchange="list.searchFilter()" class="span12" data-placeholder="Region" operator="in">
<option value="Africa">Africa</option>
<option value="Americas">Americas</option>
<option value="Asia">Asia</option>
<option value="Europe">Europe</option>
<option value="Oceania">Oceania</option>
</select>
</div>
</form>
</div>
</div>
<div class="pagination pull-right">
<ul class="pagingTop"></ul>
</div><br><br><br>
<ul class="list media-list"></ul>
<div class="pagination pull-right">
<ul class="pagingBottom"></ul>
</div>
</div>
<div id="myelm" class="hide">
<!-- A template element is needed when list is empty, TODO: needs a better solution -->
<li id="item" class="media">
<a class="pull-left" href="#">
<img class="media-object" src="data/flags/{name|concat}.png">
</a>
<div class="media-body">
<h4 class="media-heading">{name}</h4>
<p>Currency: {currency}</p>
<p>Region: {region}</p>
</div>
</li>
</div>
</div>
<script src="js/functions.js"></script>
<script src="js/hash.min.js"></script>
<script src="js/list/filterList.js"></script>
<script src="js/dust/dust-full-0.3.0.min.js"></script>
<script src="js/list/list.js"></script>
<script src="js/list/list.template.dust.js"></script>
<script src="js/list/list.paging.min.js"></script>
<script src="js/chosen/chosen.jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
var list;
$(document).ready(function() {
$("select[name=region]").chosen({ allow_single_deselect: 1 });
$("select[name=relevance]").chosen({ allow_single_deselect: 1 });
// a function to use as filter in Dust.js
// to concatenate for example Puerto Rico as Puerto_Rico
// because the flag for this country is called Puerto_Rico.png
// we have to use a function because we cannot include any logic in the template
var concat = function (value) {
if ( (typeof value != 'undefined') && (value.length > 0) ) {
return value.split(" ").join("_");
}
return value;
}
$.extend(dust.filters, {"concat": concat});
var o = { list: "filterList", pagingTop: "pagingTop", pagingBottom: "pagingBottom", searchForm: "search_form", engine: "dustjs", template: {name: "template", element: "#myelm"}, data: [], url: "data/countries.full.json" };
list = new filterList(o, $);
});
</script>
</body>
</html>