Skip to content

Commit

Permalink
feat: use text+datalist for "Add Ranger", rather than select
Browse files Browse the repository at this point in the history
This makes it a lot simpler to add Rangers than with the huge
select dropdown of before.
  • Loading branch information
srabraham committed Oct 2, 2024
1 parent 2a3268e commit 2ecb93b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/ims/element/incident/incident_template/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,16 @@
</ul>
<div>
<label class="control-label">Add:</label>
<select
<input
type="text"
id="ranger_add"
list="ranger_handles"
class="form-control input-sm auto-width"
onchange="addRanger()"
>
/>
<datalist id="ranger_handles">
<option value="" />
</select>
</datalist>
</div>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/ims/element/static/incident.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,16 +547,16 @@ function drawRangers() {


function drawRangersToAdd() {
var select = $("#ranger_add");
var datalist = $("#ranger_handles");

var handles = [];
for (var handle in personnel) {
handles.push(handle);
}
handles.sort((a, b) => a.localeCompare(b));

select.empty();
select.append($("<option />"));
datalist.empty();
datalist.append($("<option />"));

for (var i in handles) {
var handle = handles[i];
Expand All @@ -566,7 +566,7 @@ function drawRangersToAdd() {
option.val(handle);
option.text(rangerAsString(ranger));

select.append(option);
datalist.append(option);
}
}

Expand Down

0 comments on commit 2ecb93b

Please sign in to comment.