-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
94 lines (85 loc) · 2.38 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
<title>Filter Builder</title>
<style type="text/css">
#clauses li { list-style: none; }
span { line-height: 30px; vertical-align: top; }
.icon-remove { vertical-align: top; margin-top: 8px; }
</style>
</head>
<body>
<div id="filterbuilder">
<p id="description">Items with all of the conditions will be returned</p>
<div id="clauses">
<!-- clauses go here -->
</div>
<button id="clause-add" class="btn">Add</button>
</div>
<script type="text/javascript" charset="utf-8">
var json_fields = [
{
fieldName: "Title",
fieldType: "string"
},
{
fieldName: "PublishDate",
fieldType: "date"
},
{
fieldName: "PageCount",
fieldType: "number"
}
];
var json_clauses = [
{
fieldName: 'Title',
comparator: 'contains',
values: ['poop']
},
{
fieldName: 'PageCount',
comparator: '>',
values: ['100']
},
{
fieldName: 'PageCount',
comparator: 'between',
values: ['0','100']
}
] ;
</script>
<script src="js/jquery-1.10.0.js" type="text/javascript"></script>
<script src="js/underscore.js" type="text/javascript"></script>
<script src="js/backbone.js" type="text/javascript"></script>
<script src="js/backbone.localStorage.js" type="text/javascript"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
<script src="js/filterbuilder.js" type="text/javascript"></script>
<script type="text/template" id="clause-template">
<select class="clause-field input-medium">
<% _.each(fields, function(f) { %>
<option <%= field.fieldName == f.fieldName ? 'selected' : '' %>>
<%= f.fieldName %>
</option>
<% }); %>
</select>
<select class="clause-comparator input-medium">
<% _.each(COMPARATORS[field.fieldType], function(c) { %>
<option <%= c == comparator ? 'selected' : '' %>>
<%= c %>
</option>
<% }); %>
</select>
<% if(comparator == 'between'){ %>
<input type="text" value="<%= values[0] %>" class="input-medium"/>
<span>and</span>
<input type="text" value="<%= values[1] %>" class="input-medium"/>
<% } else { %>
<input type="text" value="<%= values[0] %>" class="input-medium"/>
<% } %>
<a href="#" class="destroy"><i class="icon-remove"/></a>
</script>
</body>
</html>