Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F25510839 for ; Wed, 23 Oct 2013 16:59:35 +0000 (UTC) Received: (qmail 9325 invoked by uid 500); 23 Oct 2013 16:59:33 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 9230 invoked by uid 500); 23 Oct 2013 16:59:32 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 9182 invoked by uid 99); 23 Oct 2013 16:59:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Oct 2013 16:59:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E63823199DF; Wed, 23 Oct 2013 16:59:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bfederle@apache.org To: commits@cloudstack.apache.org Message-Id: <8e2fee30a8634f36bbff69c200560c61@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to 1f0dd7c Date: Wed, 23 Oct 2013 16:59:30 +0000 (UTC) Updated Branches: refs/heads/master 69b131fa1 -> 1f0dd7cc3 CLOUDSTACK-4931: Instance wizard: use fn to hide/show template root size Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1f0dd7cc Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1f0dd7cc Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1f0dd7cc Branch: refs/heads/master Commit: 1f0dd7cc369e4ebbe45d398e2249dd129d91b526 Parents: 69b131f Author: Brian Federle Authored: Wed Oct 23 09:58:38 2013 -0700 Committer: Brian Federle Committed: Wed Oct 23 09:58:38 2013 -0700 ---------------------------------------------------------------------- ui/scripts/instanceWizard.js | 4 +- ui/scripts/ui-custom/instanceWizard.js | 76 +++++------------------------ 2 files changed, 15 insertions(+), 65 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f0dd7cc/ui/scripts/instanceWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index 2d6d66b..40832ae 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -238,7 +238,9 @@ templates: templatesObj, hypervisors: hypervisorObjs }, - customFlag: 'isdynamicallyscalable', // Field determines if custom slider is shown + customHidden: function(args) { + return true; + } }); }, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f0dd7cc/ui/scripts/ui-custom/instanceWizard.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index c6d6201..a246051 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -383,72 +383,20 @@ originalValues(formData); - $step.find('input[type=radio]').bind('change', function() { - var $target = $(this); - var val = $target.val(); - var item; - - $.map(args.data.templates, function(v, k) { - if (!v) { - return true; - } - - var target = $.grep(v, function(elem) { - return elem.id == val; - }); - - if (target.length) { - item = target[0]; - - return false; - } - - return true; - }); - - if (!item) return true; - - var custom = item[args.customFlag]; - - $step.find('.custom-size-label').remove(); - - if (custom) { - $target.parent().find('.name') - .append( - $('').addClass('custom-size-label') - .append(': ') - .append( - $('').addClass('custom-disk-size').html( - $step.find('.custom-size input[name=size]').val() - ) - ) - .append(' GB') - ); - $target.parent().find('.select-desc .desc') - .append( - $('').addClass('custom-size-label') - .append(', ') - .append( - $('').addClass('custom-disk-size').html( - $step.find('.custom-size input[name=size]').val() - ) - ) - .append(' GB') - ); - $step.find('.section.custom-size').show(); - $step.addClass('custom-disk-size'); - $target.closest('.select-container').scrollTop( - $target.position().top - ); - } else { - $step.find('.section.custom-size').hide(); - $step.removeClass('custom-disk-size'); - } - - return true; + var custom = args.customHidden({ + context: context, + data: args.data }); - $step.find('input[type=radio]:first').trigger('change'); + $step.find('.custom-size-label').remove(); + + if (!custom) { + $step.find('.section.custom-size').show(); + $step.addClass('custom-disk-size'); + } else { + $step.find('.section.custom-size').hide(); + $step.removeClass('custom-disk-size'); + } } } };