Simplify logic to set min_ram in the calculator form
This commit is contained in:
parent
da21699212
commit
12f139976d
2 changed files with 4 additions and 6 deletions
|
@ -97,8 +97,7 @@ class DCLCalculatorPlugin(CMSPluginBase):
|
|||
context['templates'] = VMTemplate.objects.filter(
|
||||
vm_type=instance.vm_type
|
||||
)
|
||||
if instance.enable_512mb_ram:
|
||||
context['enable_512mb_ram'] = True
|
||||
context['min_ram'] = 0.5 if instance.enable_512mb_ram else 1
|
||||
return context
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
window.ssdUnitPrice = {{vm_pricing.ssd_unit_price|default:0}};
|
||||
window.hddUnitPrice = {{vm_pricing.hdd_unit_price|default:0}};
|
||||
window.discountAmount = {{vm_pricing.discount_amount|default:0}};
|
||||
window.enable_512mb = {{vm_pricing.enable_512mb|default:false}};
|
||||
window.minRam = {{min_ram}};
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
|
@ -55,9 +55,8 @@
|
|||
<div class="form-group">
|
||||
<div class="description input">
|
||||
<i class="fa fa-minus-circle left" data-minus="ram" aria-hidden="true"></i>
|
||||
{% firstof if enable_512mb_ram "0.5" endif "1" as myvar %}
|
||||
<input id="ramValue" class="input-price select-number" type="number" min="{% if enable_512mb_ram %}0.5{% else %}1{% endif %}" max="200" name="ram"
|
||||
data-error="{% blocktrans %}Please enter a value in range {% if enable_512mb_ram %}0.5{% else %}1{% endif %} - 200.{% endblocktrans %}" required>
|
||||
<input id="ramValue" class="input-price select-number" type="number" min="{{min_ram}}" max="200" name="ram"
|
||||
data-error="{% blocktrans with min_ram=min_ram %}Please enter a value in range {{min_ram}} - 200.{% endblocktrans %}" required step="any">
|
||||
<span> GB RAM</span>
|
||||
<i class="fa fa-plus-circle right" data-plus="ram" aria-hidden="true"></i>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue