Add enable_512mb_ram option in model/plugin
This commit is contained in:
parent
d7be223fcb
commit
76efc35324
4 changed files with 12 additions and 3 deletions
|
@ -350,3 +350,4 @@ class DCLCalculatorPluginModel(CMSPlugin):
|
||||||
"in the backend to be automatically listed in this "
|
"in the backend to be automatically listed in this "
|
||||||
"calculator instance."
|
"calculator instance."
|
||||||
)
|
)
|
||||||
|
enable_512mb_ram = models.BooleanField(default=False)
|
||||||
|
|
|
@ -97,6 +97,8 @@ class DCLCalculatorPlugin(CMSPluginBase):
|
||||||
context['templates'] = VMTemplate.objects.filter(
|
context['templates'] = VMTemplate.objects.filter(
|
||||||
vm_type=instance.vm_type
|
vm_type=instance.vm_type
|
||||||
)
|
)
|
||||||
|
if instance.enable_512mb_ram:
|
||||||
|
context['enable_512mb_ram'] = True
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
/* ---------------------------------------------
|
/* ---------------------------------------------
|
||||||
Scripts initialization
|
Scripts initialization
|
||||||
--------------------------------------------- */
|
--------------------------------------------- */
|
||||||
|
var minRam = 1;
|
||||||
|
if(window.enable_512mb){
|
||||||
|
minRam = 0.5;
|
||||||
|
}
|
||||||
var cardPricing = {
|
var cardPricing = {
|
||||||
'cpu': {
|
'cpu': {
|
||||||
'id': 'coreValue',
|
'id': 'coreValue',
|
||||||
|
@ -16,7 +20,7 @@
|
||||||
'ram': {
|
'ram': {
|
||||||
'id': 'ramValue',
|
'id': 'ramValue',
|
||||||
'value': 2,
|
'value': 2,
|
||||||
'min': 1,
|
'min': minRam,
|
||||||
'max': 200,
|
'max': 200,
|
||||||
'interval': 1
|
'interval': 1
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
window.ssdUnitPrice = {{vm_pricing.ssd_unit_price|default:0}};
|
window.ssdUnitPrice = {{vm_pricing.ssd_unit_price|default:0}};
|
||||||
window.hddUnitPrice = {{vm_pricing.hdd_unit_price|default:0}};
|
window.hddUnitPrice = {{vm_pricing.hdd_unit_price|default:0}};
|
||||||
window.discountAmount = {{vm_pricing.discount_amount|default:0}};
|
window.discountAmount = {{vm_pricing.discount_amount|default:0}};
|
||||||
|
window.enable_512mb = {{vm_pricing.enable_512mb|default:false}};
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -54,8 +55,9 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="description input">
|
<div class="description input">
|
||||||
<i class="fa fa-minus-circle left" data-minus="ram" aria-hidden="true"></i>
|
<i class="fa fa-minus-circle left" data-minus="ram" aria-hidden="true"></i>
|
||||||
<input id="ramValue" class="input-price select-number" type="number" min="1" max="200" name="ram"
|
{% firstof if enable_512mb_ram "0.5" endif "1" as myvar %}
|
||||||
data-error="{% trans 'Please enter a value in range 1 - 200.' %}" required>
|
<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>
|
||||||
<span> GB RAM</span>
|
<span> GB RAM</span>
|
||||||
<i class="fa fa-plus-circle right" data-plus="ram" aria-hidden="true"></i>
|
<i class="fa fa-plus-circle right" data-plus="ram" aria-hidden="true"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue