You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/11/13 23:57:47 UTC
[27/44] git commit: [#6865] sort categories on template and as added
by JS
[#6865] sort categories on template and as added by JS
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1989f48e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1989f48e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1989f48e
Branch: refs/heads/cj/6815
Commit: 1989f48e2aa05b117b42c414a13fecc97df991b3
Parents: 0ec51d7
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Nov 11 19:54:36 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Nov 13 19:13:38 2013 +0000
----------------------------------------------------------------------
.../allura/ext/admin/templates/project_trove.html | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1989f48e/Allura/allura/ext/admin/templates/project_trove.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_trove.html b/Allura/allura/ext/admin/templates/project_trove.html
index bcd557d..fb799da 100644
--- a/Allura/allura/ext/admin/templates/project_trove.html
+++ b/Allura/allura/ext/admin/templates/project_trove.html
@@ -25,7 +25,7 @@
{% macro show_trove_base_cat(base) %}
<h3>{{base.fullname}}</h3>
<div id="trove_existing_{{base.shortname}}" class="trove_existing grid-19">
- {% for cat in c.project.troves_by_type(base.shortname) %}
+ {% for cat in c.project.troves_by_type(base.shortname)|sort(attribute='fullpath') %}
<div style="clear: both">
<span class="trove_fullpath">{{cat.fullpath}}</span>
<form id="delete_trove_{{base.shortname}}_{{cat.trove_cat_id}}"
@@ -97,8 +97,20 @@
});
}
else{
- $('#trove_existing_'+type).find('span.empty_msg').remove();
- $('#trove_existing_'+type).prepend('<div><span class="trove_fullpath">'+resp.trove_full_path+'</span> <form class="trove_deleter"><input type="hidden" name="type" value="'+type+'"><input type="hidden" name="trove" value="'+new_id+'">'+del_btn+'</form></div>');
+ var $existing = $('#trove_existing_'+type);
+ $existing.find('span.empty_msg').remove();
+ var insertAfter = null;
+ $existing.children().each(function() {
+ if($('.trove_fullpath', this).text() < resp.trove_full_path) {
+ insertAfter = this;
+ }
+ });
+ var $newItem = $('<div><span class="trove_fullpath">'+resp.trove_full_path+'</span> <form class="trove_deleter"><input type="hidden" name="type" value="'+type+'"><input type="hidden" name="trove" value="'+new_id+'">'+del_btn+'</form></div>');
+ if (insertAfter) {
+ $newItem.insertAfter(insertAfter);
+ } else {
+ $newItem.prependTo($existing);
+ }
}
});
});