Skip to content

Commit eb4dd09

Browse files
committed
fix: positioning of optgroup
1 parent 9bf46f6 commit eb4dd09

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/assets/v2/js/grants/_new.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,9 @@ if (document.getElementById('gc-new-grant')) {
482482
return this.submitted && this.step === this.currentSteps.length && Object.keys(this.errors).length === 0;
483483
},
484484
grantTagOptions() {
485-
const all_tags = this.grant_tags.sort((a, b) => b.is_eligibility_tag - a.is_eligibility_tag);
486485
const sorted_tags = this.grant_tags.sort((a, b) => a.id - b.id);
486+
const next_id = sorted_tags[sorted_tags.length-1].id + 1;
487+
const all_tags = this.grant_tags.sort((a, b) => b.is_eligibility_tag - a.is_eligibility_tag);
487488
const first_discovery = (tag) => tag.is_eligibility_tag === 0;
488489

489490
all_tags.unshift({
@@ -493,7 +494,7 @@ if (document.getElementById('gc-new-grant')) {
493494
});
494495

495496
all_tags.splice(all_tags.findIndex(first_discovery), 0, {
496-
id: sorted_tags[sorted_tags.length-1].id + 1,
497+
id: next_id,
497498
name: 'discovery tags'.toUpperCase(),
498499
is_eligibility_tag: 'label'
499500
});

0 commit comments

Comments
 (0)