EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #04910
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] Re: sort order of contributors.Contribution for other languages
- To: eprints-tech@ecs.soton.ac.uk
- Subject: [EP-tech] Re: sort order of contributors.Contribution for other languages
- From: Gilles Fournié <gilles.fournie@cirad.fr>
- Date: Mon, 12 Oct 2015 16:17:41 +0200
@Gilles: Your idea sounds nice. What static part should I change in order to make it work? (eg default.xml?)
I think it's better to add a javascript file in .../archives/YOURID/cfg/static/javascript/auto/
We use jQuery, so I am not very comfortable with plain javascript and even less with prototype. But with jQuery, you could use something like the following and adapt it to your content.
// To prevent problems between Prototype and jQuery jQuery.noConflict(); // To run the code after the browser has finished loaded the DOM jQuery(document).ready(function($){ // Code from http://stackoverflow.com/questions/12073270/sorting-options-elements-alphabetically-using-jquery // ***NOT FULLY TESTED***| | var options = $('select[id$="pays_publication"] option'); var arr = options.map(function(_, o) { return { t: $(o).text(), v: o.value, s: $(o).attr('selected') }; }).get(); arr.sort(function(o1, o2) { return o1.t > o2.t ? 1 : o1.t < o2.t ? -1 : 0; }); options.each(function(i, o) { o.value = arr[i].v; $(o).text(arr[i].t); $(o).attr('selected', arr[i].s); }); }); Of course you'll also need to load the jQuery library.If you don't use jQuery, it would be better to find the corresponding code for Prototype so you will not have to load another library just for this functionality.
Regards GF
- References:
- [EP-tech] Errors from event queue
- From: "Alan.Stiles" <alan.stiles@open.ac.uk>
- [EP-tech] Re: How to set a field to be multilang (search)
- From: George Mamalakis <mamalos@eng.auth.gr>
- [EP-tech] Re: How to set a field to be multilang (search)
- From: "Field A.N." <af05v@ecs.soton.ac.uk>
- [EP-tech] Re: [SOLVED] Re: How to set a field to be multilang (search)
- From: George Mamalakis <mamalos@eng.auth.gr>
- [EP-tech] sort order of contributors.Contribution for other languages
- From: George Mamalakis <mamalos@eng.auth.gr>
- [EP-tech] Re: sort order of contributors.Contribution for other languages
- From: "Field A.N." <af05v@ecs.soton.ac.uk>
- [EP-tech] Re: sort order of contributors.Contribution for other languages
- From: Gilles Fournié <gilles.fournie@cirad.fr>
- [EP-tech] Re: sort order of contributors.Contribution for other languages
- From: George Mamalakis <mamalos@eng.auth.gr>
- [EP-tech] Errors from event queue
- Prev by Date: [EP-tech] Re: sort order of contributors.Contribution for other languages
- Next by Date: [EP-tech] Re: sort order of contributors.Contribution for other languages
- Previous by thread: [EP-tech] Re: sort order of contributors.Contribution for other languages
- Next by thread: [EP-tech] Re: sort order of contributors.Contribution for other languages
- Index(es):