Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA37DF9F5 for ; Thu, 21 Mar 2013 01:04:18 +0000 (UTC) Received: (qmail 83570 invoked by uid 500); 21 Mar 2013 01:04:17 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 83499 invoked by uid 500); 21 Mar 2013 01:04:17 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 83327 invoked by uid 99); 21 Mar 2013 01:04:17 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Mar 2013 01:04:17 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E03A23EA59; Thu, 21 Mar 2013 01:04:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mchen@apache.org To: cloudstack-commits@incubator.apache.org Date: Thu, 21 Mar 2013 01:04:35 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [21/25] git commit: refs/heads/api_entity - CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - set current region (whose end point matches current URL) to region button and region dropdown on top menu. CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - set current region (whose end point matches current URL) to region button and region dropdown on top menu. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/ae7e5b02 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/ae7e5b02 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/ae7e5b02 Branch: refs/heads/api_entity Commit: ae7e5b025e25e36bef8a8d9f2becfbfa5614196f Parents: 918a7c7 Author: Jessica Wang Authored: Wed Mar 20 14:34:37 2013 -0700 Committer: Jessica Wang Committed: Wed Mar 20 14:34:37 2013 -0700 ---------------------------------------------------------------------- ui/scripts/regions.js | 3 +-- ui/scripts/ui-custom/regions.js | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ae7e5b02/ui/scripts/regions.js ---------------------------------------------------------------------- diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 902d3f8..79557ad 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -29,8 +29,7 @@ data: regions ? regions : [ { id: -1, name: '(Default)' } ], - activeRegionID: cloudStack.context.users.regionid ? - cloudStack.context.users.regionid : 1 + activeRegionID: cloudStack.context.users[0].regionid }); } }); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ae7e5b02/ui/scripts/ui-custom/regions.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/regions.js b/ui/scripts/ui-custom/regions.js index 579cdce..354ecee 100644 --- a/ui/scripts/ui-custom/regions.js +++ b/ui/scripts/ui-custom/regions.js @@ -29,23 +29,28 @@ var data = args.data; var activeRegionID = args.activeRegionID; + var currentRegion; $(data).each(function() { var region = this; var regionName = region.name; var $li = $('
  • ').append($('').html(_s(region.name))); $li.data('region-data', region); - + + if(document.location.href == region.endpoint) { + currentRegion = region; + $li.addClass('active'); + } + /* if (region.id == activeRegionID) { $li.addClass('active'); } - - $regionSwitcherButton.find('.title') - .html(regionName) - .attr('title', regionName); - - $regionList.append($li); + */ + + $regionList.append($li); }); + + $regionSwitcherButton.find('.title').html(_s(currentRegion.name)).attr('title', _s(currentRegion.name)); } } });