cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject git commit: updated refs/heads/4.5 to e03a7e6
Date Thu, 06 Nov 2014 04:51:16 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5 d969364da -> e03a7e6fe


Sorting projects alphabetically in drop down menu

Signed-off-by: Rajani Karuturi <rajanikaruturi@gmail.com>


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

Branch: refs/heads/4.5
Commit: e03a7e6feaae2d024f2a53afd71e0230309b1085
Parents: d969364
Author: Daniel Vega <daniel.simoes@corp.globo.com>
Authored: Wed Nov 5 18:30:58 2014 -0200
Committer: Rajani Karuturi <rajanikaruturi@gmail.com>
Committed: Thu Nov 6 10:16:15 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/e03a7e6f/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