Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1766 from MeasureAuthoringTool/feature/MAT-2214_s…
Browse files Browse the repository at this point in the history
…orting

MAT-2214 Sort Bonnie Dropdown's Alphabetically
  • Loading branch information
Serhii Ilin authored Feb 9, 2021
2 parents cf08a91 + ea83e16 commit 53bb47d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<label class="sr-only" for="codesystem_{{@cid}}">Select code system dropdown</label>
<select id="codesystem_{{@cid}}" name="codesystem" class="form-control">
<option value="">Code System</option>
<option value="custom">Custom</option>
{{#each codeSystems}}
<option>{{this}}</option>
{{/each}}
<option value="custom">Custom</option>
</select>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ class Thorax.Views.EditCodeSelectionView extends Thorax.Views.BuilderChildView
updateCodeSystems: ->
# Maps code system name to code system uri
@codeSystemMap = @measure.codeSystemMap() unless @codeSystemMap
@codeSystems = _((@codeSystemMap[concept.system] || concept.system) for concept in @concepts || []).uniq()
@codeSystems = _((@codeSystemMap[concept.system] || concept.system) for concept in @concepts || []).uniq().sort()
@render()
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ class Thorax.Views.InputCodeView extends Thorax.Views.BonnieView
@valueSetCodesByCodeSystem.push codeSystemList
codeSystemList.codes.push { code: code, display_name: displayName }

# Sort code systems by name
@valueSetCodesByCodeSystem.sort( (a, b) -> a.name?.localeCompare(b.name) )
# wipeout code system selection and replace options
codeSystemSelect = @$('select[name="vs_codesystem"]').empty()
@valueSetCodesByCodeSystem.forEach (codeSystem) =>
Expand All @@ -138,6 +140,9 @@ class Thorax.Views.InputCodeView extends Thorax.Views.BonnieView
_populateValueSetCodeDropdown: ->
# wipeout code system selection and replace options
codeSelect = @$('select[name="vs_code"]').empty()

# Sort codes
@selectedCodeSystem.codes.sort( (a, b) -> a.code?.localeCompare(b.code) )
@selectedCodeSystem.codes.forEach (code) =>
$("<option value=\"#{code.code}\">#{code.code} - #{code.display_name}</option>").appendTo(codeSelect)
codeSelect.find('option:first').prop('selected', true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ class Thorax.Views.InputCodingView extends Thorax.Views.BonnieView
@valueSetCodesByCodeSystem.push codeSystemList
codeSystemList.codes.push { code: code, display_name: displayName }

# Sort code systems by name
@valueSetCodesByCodeSystem.sort( (a, b) -> a.name?.localeCompare(b.name) )
# wipeout code system selection and replace options
codeSystemSelect = @$('select[name="vs_codesystem"]').empty()
@valueSetCodesByCodeSystem.forEach (codeSystem) =>
Expand All @@ -181,6 +183,9 @@ class Thorax.Views.InputCodingView extends Thorax.Views.BonnieView
_populateValueSetCodeDropdown: ->
# wipeout code system selection and replace options
codeSelect = @$('select[name="vs_code"]').empty()

# Sort codes
@selectedCodeSystem.codes.sort( (a, b) -> a.code?.localeCompare(b.code) )
@selectedCodeSystem.codes.forEach (code) =>
$("<option value=\"#{code.code}\">#{code.code} - #{code.display_name}</option>").appendTo(codeSelect)
codeSelect.find('option:first').prop('selected', true)
Expand Down

0 comments on commit 53bb47d

Please sign in to comment.