|
419 | 419 | }); |
420 | 420 | }); |
421 | 421 |
|
422 | | - originalValues(formData); |
423 | | - |
424 | 422 | var custom = args.customHidden({ |
425 | 423 | context: context, |
426 | 424 | data: args.data |
427 | 425 | }); |
428 | 426 |
|
429 | 427 | $step.find('.custom-size-label').remove(); |
430 | 428 |
|
431 | | - if (!custom) { |
432 | | - $step.find('.section.custom-size').show(); |
433 | | - $step.addClass('custom-disk-size'); |
434 | | - } else { |
| 429 | + if (custom) { |
435 | 430 | $step.find('.section.custom-size').hide(); |
436 | 431 | $step.removeClass('custom-disk-size'); |
437 | 432 | } |
| 433 | + |
| 434 | + $step.find('input[type=radio]').bind('change', function() { |
| 435 | + var $target = $(this); |
| 436 | + var val = $target.val(); |
| 437 | + var item = null; |
| 438 | + if (item == null) { |
| 439 | + item = $.grep(args.data.templates.featuredtemplates, function(elem) { |
| 440 | + return elem.id == val; |
| 441 | + })[0]; |
| 442 | + } |
| 443 | + if (item == null) { |
| 444 | + item = $.grep(args.data.templates.communitytemplates, function(elem) { |
| 445 | + return elem.id == val; |
| 446 | + })[0]; |
| 447 | + } |
| 448 | + if (item == null) { |
| 449 | + item = $.grep(args.data.templates.mytemplates, function(elem) { |
| 450 | + return elem.id == val; |
| 451 | + })[0]; |
| 452 | + } |
| 453 | + if (item == null) { |
| 454 | + item = $.grep(args.data.templates.sharedtemplates, function(elem) { |
| 455 | + return elem.id == val; |
| 456 | + })[0]; |
| 457 | + } |
| 458 | + |
| 459 | + if (!item) return true; |
| 460 | + |
| 461 | + var hypervisor = item['hypervisor']; |
| 462 | + if (hypervisor == 'KVM') { |
| 463 | + $step.find('.section.custom-size').show(); |
| 464 | + $step.addClass('custom-disk-size'); |
| 465 | + } else { |
| 466 | + $step.find('.section.custom-size').hide(); |
| 467 | + $step.removeClass('custom-disk-size'); |
| 468 | + } |
| 469 | + |
| 470 | + return true; |
| 471 | + }); |
| 472 | + |
| 473 | + originalValues(formData); |
| 474 | + |
438 | 475 | } |
439 | 476 | } |
440 | 477 | }; |
|
1271 | 1308 | args.maxDiskOfferingSize() : 100; |
1272 | 1309 |
|
1273 | 1310 | // Setup tabs and slider |
1274 | | - $wizard.find('.section.custom-size .size.min span').html(minCustomDiskSize); |
1275 | | - $wizard.find('.section.custom-size input[type=text]').val(minCustomDiskSize); |
1276 | | - $wizard.find('.section.custom-size .size.max span').html(maxCustomDiskSize); |
| 1311 | + $wizard.find('.section.custom-size.custom-disk-size .size.min span').html(minCustomDiskSize); |
| 1312 | + $wizard.find('.section.custom-size.custom-disk-size input[type=text]').val(minCustomDiskSize); |
| 1313 | + $wizard.find('.section.custom-size.custom-disk-size .size.max span').html(maxCustomDiskSize); |
1277 | 1314 | $wizard.find('.tab-view').tabs(); |
1278 | 1315 | $wizard.find('.slider').each(function() { |
1279 | 1316 | var $slider = $(this); |
|
0 commit comments