cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [06/18] git commit: updated refs/heads/4.3 to b8a28df
Date Tue, 25 Nov 2014 14:51:42 GMT
CLOUDSTACK-7849: Sorting projects alphabetically in drop down menu

Signed-off-by: Rajani Karuturi <rajanikaruturi@gmail.com>
(cherry picked from commit e03a7e6feaae2d024f2a53afd71e0230309b1085)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c6e21668
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c6e21668
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c6e21668

Branch: refs/heads/4.3
Commit: c6e2166876462e6f80bc27cddd9437de6b6012b9
Parents: f0a81ed
Author: Daniel Vega <daniel.simoes@corp.globo.com>
Authored: Wed Nov 5 18:30:58 2014 -0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Tue Nov 25 18:33:32 2014 +0530

----------------------------------------------------------------------
 ui/scripts/ui-custom/projectSelect.js | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6e21668/ui/scripts/ui-custom/projectSelect.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/projectSelect.js b/ui/scripts/ui-custom/projectSelect.js
index ba4c7c7..5cb4449 100644
--- a/ui/scripts/ui-custom/projectSelect.js
+++ b/ui/scripts/ui-custom/projectSelect.js
@@ -30,11 +30,21 @@
             response: {
                 success: function(args) {
                     var projects = args.data;
+                    var arrayOfProjs = [];
 
                     $(projects).map(function(index, project) {
+                        var proj = {id: _s(project.id), html: _s(project.displaytext ? project.displaytext
: project.name)};
+                        arrayOfProjs.push(proj);
+                    });
+
+                    arrayOfProjs.sort(function(a,b) {
+                        return a.html.localeCompare(b.html);
+                    });
+
+                    $(arrayOfProjs).map(function(index, project) {
                         var $option = $('<option>').val(_s(project.id));
 
-                        $option.html(_s(project.displaytext ? project.displaytext : project.name));
+                        $option.html(_s(project.html));
                         $option.appendTo($projectSelect);
                     });
                 },


Mime
View raw message