-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
224 lines (220 loc) · 11 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ROR Typeahead Demos</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="https://ror.org/img/favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="./css/ror-widget.css">
</head>
<body>
<div class="container">
<div class="example">
<h1 class="title">ROR Typeahead Demos</h1>
<!--<ol class="table-of-contents">
<li><a href="#basic">Basic institution name typeahead</a></li>
</ol>-->
<p class="example-description">
This example queries the <a href="https://ror.readme.io/docs/rest-api#search-ror-records">ROR API</a> as the user types and generates suggestions based on the query results.
The URL for this query is:
<pre>https://api.ror.org/organizations?query=</pre>
This is example uses <a href="https://github.com/twitter/typeahead.js">Twitter typeahead.js</a> and <a href="https://jquery.com/">jQuery</a>, however, it can be created using a variety of typeahead plugins, including those for specific JS frameworks.
</p>
</div>
<hr>
<div class="example" id="basic">
<h2 class="example-name">Basic institution name typeahead</h2>
<div class="demo">
<div class="row text-left">
<div class="col-md-5">
<label for="insitution_name">
Institution name
</label><br>
<input class="typeahead" type="text" name="institution_name" id="name-01">
<small class="text-left form-text text-muted">
<em>Begin typing to activate a suggestion list. Please choose an institution from the list, if available. If your institution is not listed, continue typing to enter its name manually.</em>
</small>
</div>
<!--<div class="col-md-1">
<button type="button" class="btn btn-primary" aria-label="Add another affiliation">
<span class="glyphicon glyphicon-plus" aria-hidden="true" data-toggle="tooltip" data-placement="right" title="Add another affiliation"></span>
</button>
</div>-->
</div>
<div class="row text-left">
<div class="col-md-12">
<h3>Data returned from ROR API</h3>
<div><pre id="ror-id-01"></pre></div>
</div>
</div>
</div>
</div>
<hr>
<div class="example" id="basic-department">
<h2 class="example-name">Including department-level information</h2>
<p>Use ROR to capture the the “top level” organization (ex: University of Wisconsin-Madison). If you also need to capture department, college or other sub-unit information, provide a separate free-text field.</p>
<div class="demo">
<div class="row text-left">
<div class="col-md-5">
<label for="insitution_name">
Institution name
</label><br>
<input class="typeahead" type="text" name="institution_name" id="name-02">
<small class="text-left form-text text-muted">
<em>Begin typing to activate a suggestion list. Please choose an institution from the list, if available. If your institution is not listed, continue typing to enter its name manually.</em>
</small>
</div>
<div class="col-md-6">
<label for="department_subunit_name">
Department/Sub-unit
</label><br>
<input class="form-field" type="text" name="department_subunit_name" id="department-02">
</div>
<!--<div class="col-md-1">
<button type="button" class="btn btn-primary" aria-label="Add another affiliation">
<span class="glyphicon glyphicon-plus" aria-hidden="true" data-toggle="tooltip" data-placement="right" title="Add another affiliation"></span>
</button>
</div>-->
</div>
<div class="row text-left">
<div class="col-md-12">
<h3>Data returned from ROR API</h3>
<div><pre id="ror-id-02"></pre></div>
</div>
</div>
</div>
</div>
<hr>
<div class="example" id="addl-info">
<h2 class="example-name">Populating other fields with ROR data</h2>
<p>Consider populating other fields in your form automatically, using data from the ROR record selected by the user. See the list of ROR record fields in ROR data structure</p>
<div class="demo">
<div class="row text-left">
<div class="col-md-5">
<label for="insitution_name">
Institution name
</label><br>
<input class="typeahead" type="text" name="institution_name" id="name-03">
<small class="text-left form-text text-muted">
<em>Begin typing to activate a suggestion list. Please choose an institution from the list, if available. If your institution is not listed, continue typing to enter its name manually.</em>
</small>
</div>
<div class="col-md-6">
<label for="department_subunit_name">
Department/Sub-unit
</label><br>
<input class="form-field" type="text" name="department_subunit_name" id="department-03">
</div>
<!--<div class="col-md-1">
<button type="button" class="btn btn-primary" aria-label="Add another affiliation">
<span class="glyphicon glyphicon-plus" aria-hidden="true" data-toggle="tooltip" data-placement="right" title="Add another affiliation"></span>
</button>
</div>-->
</div>
<div class="row text-left">
<div class="col-md-5">
<label for="institution_city">
City
</label><br>
<input class="form-field" type="text" name="institution_city" id="city-03">
</div>
<div class="col-md-6">
<label for="institution_country">
Country
</label><br>
<input class="form-field" type="text" name="institution_country" id="country-03">
</div>
<!--<div class="col-md-1">
<button type="button" class="btn btn-primary" aria-label="Add another affiliation">
<span class="glyphicon glyphicon-plus" aria-hidden="true" data-toggle="tooltip" data-placement="right" title="Add another affiliation"></span>
</button>
</div>-->
</div>
<div class="row text-left">
<div class="col-md-12">
<h3>Data returned from ROR API</h3>
<div><pre id="ror-id-03"></pre></div>
</div>
</div>
</div>
</div>
<!--<div class="row">
<fieldset>
<legend class="text-left">Institutional affiliation</legend>
<div class="pull-left">
<div class="pull-left" style="width:45%;">
<div class="pull-left">
<label class="pull-left" for="insitution_name">
Institution name
</label><br>
<input class="typeahead" type="text" name="institution_name" id="name">
<small class="pull-left text-left form-text text-muted" style="margin-right: 1.5em;">
Begin typing to activate a suggestion list. Please choose an institution from the list, if available. If your institution is not listed, enter its name manually.
</small>
</div>
<div class="pull-left">
<label class="pull-left" for="institution_city">
City
</label><br>
<input class="form-field" id="city" name="institution_city" type="text">
</div>
<div class="pull-left">
<label class="pull-left" for="insitution_ror">
ROR identifier
</label><br>
<input class="form-field" id="ror-id-01" name="insitution_ror">
</div>
</div>
</fieldset>
</div>
<div class="pull-left">
<label class="pull-left" for="insitution_name">
Country
</label><br>
<input class="form-field" id="country" type="text">
</div>
<div class="pull-left"></div>
<div class="pull-left" style="width:45%;">
<div class="pull-left">
<label class="pull-left" for="insitution_name">
Institution name
</label><br>
<input class="typeahead" type="text" name="institution_name" id="name">
<small class="pull-left text-left form-text text-muted" style="margin-right: 1.5em;">
Begin typing to activate a suggestion list. Please choose an institution from the list, if available. If your institution is not listed, enter its name manually.
</small>
</div>
<div class="pull-left">
<label class="pull-left" for="insitution_name">
City
</label><br>
<input class="form-field" id="city" type="text">
</div>
<div class="pull-left">
<label class="pull-left" for="insitution_name">
ROR identifier
</label><br>
<input class="form-field" id="ror-id-01">
</div>
</div>
<div class="pull-left" style="width:45%;">
<label class="pull-left" for="department_subunit_name">
Department/sub-unit
</label><br>
<input class="form-field" type="text" name="department_subunit" id="department_subunit">
</div>
<button type="button" class="btn btn-primary" aria-label="Add another affiliation">
<span class="glyphicon glyphicon-plus" aria-hidden="true" data-toggle="tooltip" data-placement="right" title="Add another affiliation"></span>
</button>
</div>
</div>-->
</div>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="./js/typeahead.js"></script>
<script src="./js/ror-typeahead.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>