diff --git a/datacenterlight/cms_models.py b/datacenterlight/cms_models.py index dd6a165f..5a8d7ac8 100644 --- a/datacenterlight/cms_models.py +++ b/datacenterlight/cms_models.py @@ -26,6 +26,10 @@ class CMSIntegration(models.Model): navbar_placeholder = PlaceholderField( 'datacenterlight_navbar', related_name='dcl-navbar-placeholder+' ) + calculator_placeholder = PlaceholderField( + 'datacenterlight_calculator', + related_name='dcl-calculator-placeholder+' + ) domain = models.ForeignKey(Site, null=True, blank=True) class Meta: @@ -288,7 +292,7 @@ class DCLSectionPromoPluginModel(CMSPlugin): return extra_classes -class DCLCustomPricingModel(CMSPlugin): +class DCLCalculatorPluginModel(CMSPlugin): pricing = models.ForeignKey( VMPricing, related_name="dcl_custom_pricing_vm_pricing", diff --git a/datacenterlight/cms_plugins.py b/datacenterlight/cms_plugins.py index 19dc0b39..ecc0a355 100644 --- a/datacenterlight/cms_plugins.py +++ b/datacenterlight/cms_plugins.py @@ -6,9 +6,9 @@ from .cms_models import ( DCLFooterPluginModel, DCLLinkPluginModel, DCLNavbarDropdownPluginModel, DCLSectionIconPluginModel, DCLSectionImagePluginModel, DCLSectionPluginModel, DCLNavbarPluginModel, - DCLSectionPromoPluginModel, DCLCustomPricingModel + DCLSectionPromoPluginModel, DCLCalculatorPluginModel ) -from .models import VMTemplate, VMPricing +from .models import VMTemplate @plugin_pool.register_plugin @@ -21,7 +21,7 @@ class DCLSectionPlugin(CMSPluginBase): allow_children = True child_classes = [ 'DCLSectionIconPlugin', 'DCLSectionImagePlugin', - 'DCLSectionPromoPlugin', 'UngleichHTMLPlugin' + 'DCLSectionPromoPlugin', 'UngleichHTMLPlugin', 'DCLCalculatorPlugin' ] def render(self, context, instance, placeholder): @@ -30,14 +30,18 @@ class DCLSectionPlugin(CMSPluginBase): ) context['children_to_side'] = [] context['children_to_content'] = [] + context['children_calculator'] = [] if instance.child_plugin_instances is not None: right_children = [ 'DCLSectionImagePluginModel', - 'DCLSectionIconPluginModel' + 'DCLSectionIconPluginModel', ] for child in instance.child_plugin_instances: + print(child.__dict__) if child.__class__.__name__ in right_children: context['children_to_side'].append(child) + elif child.plugin_type == 'DCLCalculatorPlugin': + context['children_calculator'].append(child) else: context['children_to_content'].append(child) return context @@ -75,52 +79,20 @@ class DCLSectionPromoPlugin(CMSPluginBase): @plugin_pool.register_plugin class DCLCalculatorPlugin(CMSPluginBase): module = "Datacenterlight" - name = "DCL Calculator Section Plugin" - model = DCLSectionPluginModel + name = "DCL Calculator Plugin" + model = DCLCalculatorPluginModel render_template = "datacenterlight/cms/calculator.html" cache = False - allow_children = True - child_classes = [ - 'DCLSectionPromoPlugin', 'UngleichHTMLPlugin', 'DCLCustomPricingPlugin' - ] + require_parent = True def render(self, context, instance, placeholder): context = super(DCLCalculatorPlugin, self).render( context, instance, placeholder ) context['templates'] = VMTemplate.objects.all() - context['children_to_content'] = [] - pricing_plugin_model = None - if instance.child_plugin_instances is not None: - context['children_to_content'].extend( - instance.child_plugin_instances - ) - for child in instance.child_plugin_instances: - if child.__class__.__name__ == 'DCLCustomPricingModel': - # The second clause is just to make sure we pick up the - # most recent CustomPricing, if more than one is present - if (pricing_plugin_model is None or child.pricing_id > - pricing_plugin_model.model.pricing_id): - pricing_plugin_model = child - - if pricing_plugin_model: - context['vm_pricing'] = VMPricing.get_vm_pricing_by_name( - name=pricing_plugin_model.pricing.name - ) - else: - context['vm_pricing'] = VMPricing.get_default_pricing() - return context -@plugin_pool.register_plugin -class DCLCustomPricingPlugin(CMSPluginBase): - module = "Datacenterlight" - name = "DCL Custom Pricing Plugin" - model = DCLCustomPricingModel - render_plugin = False - - @plugin_pool.register_plugin class DCLBannerListPlugin(CMSPluginBase): module = "Datacenterlight" diff --git a/datacenterlight/migrations/0021_cmsintegration_calculator_placeholder.py b/datacenterlight/migrations/0021_cmsintegration_calculator_placeholder.py new file mode 100644 index 00000000..3ebbb469 --- /dev/null +++ b/datacenterlight/migrations/0021_cmsintegration_calculator_placeholder.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-04-25 09:20 +from __future__ import unicode_literals + +import cms.models.fields +from django.db import migrations +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('datacenterlight', '0020_merge'), + ('cms', '0014_auto_20160404_1908'), + ] + + operations = [ + migrations.AddField( + model_name='cmsintegration', + name='calculator_placeholder', + field=cms.models.fields.PlaceholderField(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, + related_name='dcl-calculator-placeholder+', slotname='datacenterlight_calculator', to='cms.Placeholder'), + ), + migrations.RenameModel( + old_name='DCLCustomPricingModel', + new_name='DCLCalculatorPluginModel', + ), + ] diff --git a/datacenterlight/static/datacenterlight/css/landing-page.css b/datacenterlight/static/datacenterlight/css/landing-page.css index 8e9f2c2d..f241ed71 100755 --- a/datacenterlight/static/datacenterlight/css/landing-page.css +++ b/datacenterlight/static/datacenterlight/css/landing-page.css @@ -776,7 +776,7 @@ textarea { width: 100%; margin: 0 auto; background: #fff; - box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); + box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 0 6px rgba(0, 0, 0, 0.15); padding-bottom: 40px; border-radius: 7px; text-align: center; @@ -929,7 +929,7 @@ textarea { } -@media(max-width:991px) { +@media(max-width:767px) { .section-sm-center .split-text, .section-sm-center .space { text-align: center !important; diff --git a/datacenterlight/static/datacenterlight/js/main.js b/datacenterlight/static/datacenterlight/js/main.js index 35f2b247..f6ba036b 100644 --- a/datacenterlight/static/datacenterlight/js/main.js +++ b/datacenterlight/static/datacenterlight/js/main.js @@ -175,7 +175,7 @@ window.coresUnitPrice = 5; } if(typeof window.ramUnitPrice === 'undefined'){ - window.coresUnitPrice = 2; + window.ramUnitPrice = 2; } if(typeof window.ssdUnitPrice === 'undefined'){ window.ssdUnitPrice = 0.6; diff --git a/datacenterlight/templates/datacenterlight/cms/base.html b/datacenterlight/templates/datacenterlight/cms/base.html index 942a0ad4..a614db67 100644 --- a/datacenterlight/templates/datacenterlight/cms/base.html +++ b/datacenterlight/templates/datacenterlight/cms/base.html @@ -61,6 +61,7 @@ {% endplaceholder %} + {% url 'datacenterlight:index' as calculator_form_url %} {% placeholder 'Datacenterlight Content' %} {% placeholder 'datacenterlight_footer'%} diff --git a/datacenterlight/templates/datacenterlight/cms/calculator.html b/datacenterlight/templates/datacenterlight/cms/calculator.html index 27d1f89c..7b123a72 100644 --- a/datacenterlight/templates/datacenterlight/cms/calculator.html +++ b/datacenterlight/templates/datacenterlight/cms/calculator.html @@ -1,16 +1,5 @@ -