diff --git a/Changelog b/Changelog index b85dd4ff..190a7af8 100644 --- a/Changelog +++ b/Changelog @@ -1,13 +1,3 @@ -Next: - * bugfix: Use correct version of django-multisite (MR #676) -2.4.1: 2018-10-18 - * bugfix: Update pycryptodome module from 3.4 to 3.6.6 (PR #674) -2.4: 2018-10-18 - * #5681: [hosting,dcl] Allow admin to lower minimum RAM to 512 MB (PR #672) -2.3.1: 2018-10-17 - * bugfix: [hosting, dcl] Show VAT percent rounded to 2 decimal places in the order confirmation page (PR #673) -2.3: 2018-10-08 - * #5690: Generic payment page - allow admin to add a onetime/monthly product and the frontend for user to pay for this product (PR #666) 2.2.2: 2018-09-28 * #5721: Set calculator OS list in alphabetical order and set `Devuan Ascii` as the default (PR #668) * bugfix: Fix some typos and correct DE translations (PR #667) diff --git a/datacenterlight/cms_models.py b/datacenterlight/cms_models.py index 2d1a98b5..7b0e81f4 100644 --- a/datacenterlight/cms_models.py +++ b/datacenterlight/cms_models.py @@ -361,4 +361,3 @@ class DCLCalculatorPluginModel(CMSPlugin): help_text="Write the name of the template that you need selected as" " default when the calculator loads" ) - enable_512mb_ram = models.BooleanField(default=False) diff --git a/datacenterlight/cms_plugins.py b/datacenterlight/cms_plugins.py index c3ec974f..b7841de8 100644 --- a/datacenterlight/cms_plugins.py +++ b/datacenterlight/cms_plugins.py @@ -9,7 +9,6 @@ from .cms_models import ( DCLSectionPromoPluginModel, DCLCalculatorPluginModel ) from .models import VMTemplate -from datacenterlight.utils import clear_all_session_vars @plugin_pool.register_plugin @@ -86,7 +85,6 @@ class DCLCalculatorPlugin(CMSPluginBase): require_parent = True def render(self, context, instance, placeholder): - clear_all_session_vars(context['request']) context = super(DCLCalculatorPlugin, self).render( context, instance, placeholder ) @@ -99,8 +97,9 @@ class DCLCalculatorPlugin(CMSPluginBase): context['templates'] = VMTemplate.objects.filter( vm_type=instance.vm_type ).order_by('name') - context['instance'] = instance - context['min_ram'] = 0.5 if instance.enable_512mb_ram else 1 + context['default_selected_template'] = ( + instance.default_selected_template + ) return context diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po index d43e91ea..1b66b640 100644 --- a/datacenterlight/locale/de/LC_MESSAGES/django.po +++ b/datacenterlight/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-26 20:44+0000\n" +"POT-Creation-Date: 2018-07-05 23:11+0000\n" "PO-Revision-Date: 2018-03-30 23:22+0000\n" "Last-Translator: b'Anonymous User '\n" "Language-Team: LANGUAGE \n" @@ -293,9 +293,6 @@ msgstr "Registrieren" msgid "Billing Address" msgstr "Rechnungsadresse" -msgid "Make a payment" -msgstr "" - msgid "Your Order" msgstr "Deine Bestellung" @@ -339,9 +336,9 @@ msgid "" "database." msgstr "" "Bitte wähle eine der zuvor genutzten Kreditkarten oder gib Deine " -"Kreditkartendetails unten an. Die Bezahlung wird über Stripe abgewickelt. Wir speichern Deine " -"Kreditkartendetails nicht in unserer Datenbank." +"Kreditkartendetails unten an. Die Bezahlung wird über " +"Stripe abgewickelt. " +"Wir speichern Deine Kreditkartendetails nicht in unserer Datenbank." msgid "" "Please fill in your credit card information below. We are using cardPricing[data].min) { - if(data === 'ram' && String(cardPricing[data].value) === "1" && minRam === 0.5){ - cardPricing[data].value = 0.5; - $('#ramValue').val('0.5'); - $("#ramValue").attr('step', 0.5); - } else { - cardPricing[data].value = Number(cardPricing[data].value) - cardPricing[data].interval; - } + cardPricing[data].value = Number(cardPricing[data].value) - cardPricing[data].interval; } _fetchPricing(); - $('#ramValue').data('old-value', $('#ramValue').val()); }); $('.fa-plus-circle.right').click(function(event) { var data = $(this).data('plus'); if (cardPricing[data].value < cardPricing[data].max) { - if(data === 'ram' && String(cardPricing[data].value) === "0.5" && minRam === 0.5){ - cardPricing[data].value = 1; - $('#ramValue').val('1'); - $("#ramValue").attr('step', 1); - } else { - cardPricing[data].value = Number(cardPricing[data].value) + cardPricing[data].interval; - } + cardPricing[data].value = Number(cardPricing[data].value) + cardPricing[data].interval; } _fetchPricing(); - $('#ramValue').data('old-value', $('#ramValue').val()); }); $('.input-price').change(function() { var data = $(this).attr("name"); - var input = $('input[name=' + data + ']'); - var inputValue = input.val(); - - if(data === 'ram') { - var ramInput = $('#ramValue'); - if ($('#ramValue').data('old-value') < $('#ramValue').val()) { - if($('#ramValue').val() === '1' && minRam === 0.5) { - $("#ramValue").attr('step', 1); - $('#ramValue').val('1'); - } - } else { - if($('#ramValue').val() === '0' && minRam === 0.5) { - $("#ramValue").attr('step', 0.5); - $('#ramValue').val('0.5'); - } - } - inputValue = $('#ramValue').val(); - $('#ramValue').data('old-value', $('#ramValue').val()); - } - cardPricing[data].value = inputValue; + cardPricing[data].value = $('input[name=' + data + ']').val(); _fetchPricing(); }); } diff --git a/datacenterlight/templates/datacenterlight/includes/_calculator_form.html b/datacenterlight/templates/datacenterlight/includes/_calculator_form.html index f9896f17..0a35e2ad 100644 --- a/datacenterlight/templates/datacenterlight/includes/_calculator_form.html +++ b/datacenterlight/templates/datacenterlight/includes/_calculator_form.html @@ -9,14 +9,11 @@ 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.minRam = {{min_ram}}; - window.minRamErr = '{% blocktrans with min_ram=min_ram %}Please enter a value in range {{min_ram}} - 200.{% endblocktrans %}'; {% endif %}
{% csrf_token %} -

{% trans "VM hosting" %}

@@ -57,8 +54,8 @@
- + GB RAM
@@ -95,11 +92,11 @@
-
+ \ No newline at end of file diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html index fb6d51b0..4c43f41c 100644 --- a/datacenterlight/templates/datacenterlight/landing_payment.html +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -67,49 +67,36 @@
- {% if generic_payment_form %} -

{%trans "Make a payment" %}

-
-
- {% csrf_token %} - - {% for field in generic_payment_form %} - {% bootstrap_field field type='fields'%} - {% endfor %} -

{{generic_payment_form.non_field_errors|striptags}}

-
- {% else %} -

{%trans "Your Order" %}

-
-
-

{% trans "Cores"%} {{request.session.specs.cpu|floatformat}}

-
-

{% trans "Memory"%} {{request.session.specs.memory|floatformat}} GB

-
-

{% trans "Disk space"%} {{request.session.specs.disk_size|floatformat}} GB

-
-

{% trans "Configuration"%} {{request.session.template.name}}

-
-

- {%trans "Total" %}   - - ({% if vm_pricing.vat_inclusive %}{%trans "including VAT" %}{% else %}{%trans "excluding VAT" %}{% endif %}) - - {{request.session.specs.price|intcomma}} CHF/{% trans "Month" %} -

-
- {% if vm_pricing.discount_amount %} -

- {%trans "Discount" as discount_name %} - {{ vm_pricing.discount_name|default:discount_name }}   - - {{ vm_pricing.discount_amount }} CHF/{% trans "Month" %} -

-

- ({% trans "Will be applied at checkout" %}) -

- {% endif %} -
- {% endif %} +

{%trans "Your Order" %}

+
+
+

{% trans "Cores"%} {{request.session.specs.cpu|floatformat}}

+
+

{% trans "Memory"%} {{request.session.specs.memory|floatformat}} GB

+
+

{% trans "Disk space"%} {{request.session.specs.disk_size|floatformat}} GB

+
+

{% trans "Configuration"%} {{request.session.template.name}}

+
+

+ {%trans "Total" %}   + + ({% if vm_pricing.vat_inclusive %}{%trans "including VAT" %}{% else %}{%trans "excluding VAT" %}{% endif %}) + + {{request.session.specs.price|intcomma}} CHF/{% trans "Month" %} +

+
+ {% if vm_pricing.discount_amount %} +

+ {%trans "Discount" as discount_name %} + {{ vm_pricing.discount_name|default:discount_name }}   + - {{ vm_pricing.discount_amount }} CHF/{% trans "Month" %} +

+

+ ({% trans "Will be applied at checkout" %}) +

+ {% endif %} +
diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 31933e12..49347ba2 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -47,88 +47,61 @@

{% trans "Order summary" %}

- {% if generic_payment_details %} +

+ {% trans "Product" %}:  + {{ request.session.template.name }} +

+
+

- {% trans "Product" %}:  - {{ generic_payment_details.product_name }} + {% trans "Cores" %}: + {{vm.cpu|floatformat}}

-
-
-

- {% trans "Amount" %}: - CHF {{generic_payment_details.amount|floatformat:2|intcomma}} -

- {% if generic_payment_details.description %} +

+ {% trans "Memory" %}: + {{vm.memory|intcomma}} GB +

+

+ {% trans "Disk space" %}: + {{vm.disk_size|intcomma}} GB +

+
+
+
+
+ {% if vm.vat > 0 or vm.discount.amount > 0 %} +
+
+ {% if vm.vat > 0 %}

- {% trans "Description" %}: - {{generic_payment_details.description}} + {% trans "Subtotal" %} + {{vm.price|floatformat:2|intcomma}} CHF +

+

+ {% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) + {{vm.vat|floatformat:2|intcomma}} CHF

{% endif %} - {% if generic_payment_details.recurring %} -

- {% trans "Recurring" %}: - Yes + {% if vm.discount.amount > 0 %} +

+ {%trans "Discount" as discount_name %} + {{ vm.discount.name|default:discount_name }} + - {{ vm.discount.amount }} CHF

{% endif %}
- {% else %} -

- {% trans "Product" %}:  - {{ request.session.template.name }} -

-
-
-

- {% trans "Cores" %}: - {{vm.cpu|floatformat}} -

-

- {% trans "Memory" %}: - {{vm.memory|intcomma}} GB -

-

- {% trans "Disk space" %}: - {{vm.disk_size|intcomma}} GB -

-
-
-
-
- {% if vm.vat > 0 or vm.discount.amount > 0 %} -
-
- {% if vm.vat > 0 %} -

- {% trans "Subtotal" %} - {{vm.price|floatformat:2|intcomma}} CHF -

-

- {% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) - {{vm.vat|floatformat:2|intcomma}} CHF -

- {% endif %} - {% if vm.discount.amount > 0 %} -

- {%trans "Discount" as discount_name %} - {{ vm.discount.name|default:discount_name }} - - {{ vm.discount.amount }} CHF -

- {% endif %} -
-
-
-
-
- {% endif %} -
-

- {% trans "Total" %} - {{vm.total_price|floatformat:2|intcomma}} CHF -

-
+
+
{% endif %} +
+

+ {% trans "Total" %} + {{vm.total_price|floatformat:2|intcomma}} CHF +

+
+

@@ -136,15 +109,7 @@ {% csrf_token %}
- {% if generic_payment_details %} - {% if generic_payment_details.recurring %} -
{% blocktrans with total_price=generic_payment_details.amount|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{total_price}} CHF/month{% endblocktrans %}.
- {% else %} -
{% blocktrans with total_price=generic_payment_details.amount|floatformat:2|intcomma %}By clicking "Place order" this payment will charge your credit card account with a one time amount of {{total_price}} CHF{% endblocktrans %}.
- {% endif %} - {% else %} -
{% blocktrans with vm_total_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{vm_total_price}} CHF/month{% endblocktrans %}.
- {% endif %} +
{% blocktrans with vm_total_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{vm_total_price}} CHF/month{% endblocktrans %}.