+[% USE Dumper %]
[%- # This is the bib and authority combined record browser.
PROCESS "opac/parts/header.tt2";
# get_authority_fields is fast and cache-y.
acs = ctx.get_authority_fields(a.control_set);
- FOR field_group IN a.headings;
+ FOR field_group IN a.headings.sort('field_group.values.0.headings.heading');
field_id = field_group.keys.0;
field = acs.$field_id;
headings = field_group.values.0;
# get_authority_fields is fast and cache-y.
acs = ctx.get_authority_fields(a.control_set);
- FOR field_group IN a.headings;
+ FOR field_group IN a.headings.sort;
field_id = field_group.keys.0;
field = acs.$field_id;
headings = field_group.values.0;
[% END;
END; # end of BLOCK authority_notes %]
<script>
+ function sortList(ul){
+ var new_ul = ul.cloneNode(false);
+
+ // Add all lis to an array
+ var lis = [];
+ for(var i = ul.childNodes.length; i--;){
+ if(ul.childNodes[i].nodeName === 'LI')
+ lis.push(ul.childNodes[i]);
+ }
+ // Sort the lis in descending order
+ lis.sort(function(a, b){
+ return ((b.textContent.trim()) < (a.textContent.trim())) ? 1 : -1;
+ });
+
+ // Add them into the ul in order
+ for(var i = 0; i < lis.length; i++)
+ new_ul.appendChild(lis[i]);
+ ul.parentNode.replaceChild(new_ul, ul);
+ }
+ for (var i = 0; i < document.getElementsByClassName('browse-result-authority-headings').length; i++) {
+ sortList(document.getElementsByClassName('browse-result-authority-headings')[i]);
+ }
+ </script>
+ <script>
replaceContentInContainer('staff-client-link');
replaceContentInContainer('see-reference-no-link');
</script>