Sort elements and element categories in element summary boxes.
authorCameron McCormack <cam@mcc.id.au>
Tue, 21 Aug 2012 16:05:19 +1000
changeset 60 d1a22842fc34
parent 59 6deaf3de95bd
child 61 6f7ca5478368
Sort elements and element categories in element summary boxes.
publish/processing.js
--- a/publish/processing.js	Tue Aug 21 15:34:52 2012 +1000
+++ b/publish/processing.js	Tue Aug 21 16:05:19 2012 +1000
@@ -417,7 +417,7 @@
   }
 
   var ul = utils.parse('<ul class="no-bullets"></ul>');
-  element.elementCategories.forEach(function(name) {
+  element.elementCategories.concat().sort().forEach(function(name) {
     var cat = conf.definitions.elementCategories[name];
     if (!cat) {
       return utils.parse('<li><a href="data:," style="background: red; color: white">@@ unknown element category "{{name}}"</a><li>', { name: name });
@@ -429,7 +429,7 @@
     ul.appendChild(li);
   });
 
-  element.elements.forEach(function(name) {
+  element.elements.concat().sort().forEach(function(name) {
     var e = conf.definitions.elements[name];
     if (!e) {
       return utils.parse('<li><a href="data:," style="background: red; color: white">@@ unknown element "{{name}}"</a><li>', { name: name });