diff --git a/Changelog b/Changelog index 538a862d..b85dd4ff 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,25 @@ 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) +2.2.1: 2018-09-25 + * feature: Change DCLNavbarPlugin to show login option only if set (PR #665) + * bugfix: Log opennebula errors and send proper message when vm terminate is not completed in the stipulated time (PR #648) +2.2: 2018-09-06 + * bugfix: Include price in the Stripe plan name to make it distinct and to correct pricing since version 1.9 +2.1.2: 2018-08-30 + * bugfix: [blog, comic] Set blog rss feed for all blog templates +2.1.1: 2018-08-24 + * #5487: [hosting] Add explicit warning message for teminating VM (PR #656) * bugfix: [dg] Send email to admin on dg subscription and increase cc_brand field to 128 characters (PR #652) * #5458: [admin] Make hostingorder more readable (PR #657) * bugfix: [CMS templates] Set description meta field of ungleich template (was missing before) and set ungleich glarus ag uniformly as author of various CMS pages (PR #653) diff --git a/datacenterlight/cms_models.py b/datacenterlight/cms_models.py index 62a7b312..2d1a98b5 100644 --- a/datacenterlight/cms_models.py +++ b/datacenterlight/cms_models.py @@ -180,6 +180,10 @@ class DCLNavbarPluginModel(CMSPlugin): default=True, help_text='Select to include the language selection dropdown.' ) + show_login_option = models.BooleanField( + default=True, + help_text='Uncheck this if you do not want to show login/dashboard.' + ) def get_logo_dark(self): # used only if atleast one logo exists @@ -350,3 +354,11 @@ class DCLCalculatorPluginModel(CMSPlugin): "in the backend to be automatically listed in this " "calculator instance." ) + default_selected_template = models.CharField( + default="Devuan Ascii", + null=True, + max_length=128, + 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 95a496d8..c3ec974f 100644 --- a/datacenterlight/cms_plugins.py +++ b/datacenterlight/cms_plugins.py @@ -9,6 +9,7 @@ from .cms_models import ( DCLSectionPromoPluginModel, DCLCalculatorPluginModel ) from .models import VMTemplate +from datacenterlight.utils import clear_all_session_vars @plugin_pool.register_plugin @@ -85,6 +86,7 @@ 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 ) @@ -92,11 +94,13 @@ class DCLCalculatorPlugin(CMSPluginBase): if ids: context['templates'] = VMTemplate.objects.filter( vm_type=instance.vm_type - ).filter(opennebula_vm_template_id__in=ids) + ).filter(opennebula_vm_template_id__in=ids).order_by('name') else: 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 return context diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po index 1b66b640..d43e91ea 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-07-05 23:11+0000\n" +"POT-Creation-Date: 2018-09-26 20:44+0000\n" "PO-Revision-Date: 2018-03-30 23:22+0000\n" "Last-Translator: b'Anonymous User '\n" "Language-Team: LANGUAGE \n" @@ -293,6 +293,9 @@ msgstr "Registrieren" msgid "Billing Address" msgstr "Rechnungsadresse" +msgid "Make a payment" +msgstr "" + msgid "Your Order" msgstr "Deine Bestellung" @@ -336,9 +339,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) { - cardPricing[data].value = Number(cardPricing[data].value) - cardPricing[data].interval; + 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; + } } _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) { - cardPricing[data].value = Number(cardPricing[data].value) + cardPricing[data].interval; + 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; + } } _fetchPricing(); + $('#ramValue').data('old-value', $('#ramValue').val()); }); $('.input-price').change(function() { var data = $(this).attr("name"); - cardPricing[data].value = $('input[name=' + data + ']').val(); + 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; _fetchPricing(); }); } diff --git a/datacenterlight/templates/datacenterlight/cms/navbar.html b/datacenterlight/templates/datacenterlight/cms/navbar.html index ae6643aa..886a5009 100644 --- a/datacenterlight/templates/datacenterlight/cms/navbar.html +++ b/datacenterlight/templates/datacenterlight/cms/navbar.html @@ -35,14 +35,16 @@ {% endif %} {% endif %} - {% if not request.user.is_authenticated %} -
  • - {% trans "Login" %}   -
  • - {% else %} -
  • - {% trans "Dashboard" %} -
  • + {% if instance.show_login_option %} + {% if not request.user.is_authenticated %} +
  • + {% trans "Login" %}   +
  • + {% else %} +
  • + {% trans "Dashboard" %} +
  • + {% endif %} {% endif %} {% comment %} diff --git a/datacenterlight/templates/datacenterlight/includes/_calculator_form.html b/datacenterlight/templates/datacenterlight/includes/_calculator_form.html index 72ca5a05..f9896f17 100644 --- a/datacenterlight/templates/datacenterlight/includes/_calculator_form.html +++ b/datacenterlight/templates/datacenterlight/includes/_calculator_form.html @@ -9,11 +9,14 @@ 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" %}

    @@ -54,8 +57,8 @@
    - + GB RAM
    @@ -91,11 +94,12 @@
    -
    \ No newline at end of file + diff --git a/datacenterlight/templates/datacenterlight/landing_payment.html b/datacenterlight/templates/datacenterlight/landing_payment.html index 4c43f41c..fb6d51b0 100644 --- a/datacenterlight/templates/datacenterlight/landing_payment.html +++ b/datacenterlight/templates/datacenterlight/landing_payment.html @@ -67,36 +67,49 @@
    -

    {%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 %} -
    + {% 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 %}
    diff --git a/datacenterlight/templates/datacenterlight/order_detail.html b/datacenterlight/templates/datacenterlight/order_detail.html index 49347ba2..31933e12 100644 --- a/datacenterlight/templates/datacenterlight/order_detail.html +++ b/datacenterlight/templates/datacenterlight/order_detail.html @@ -47,61 +47,88 @@

    {% trans "Order summary" %}

    -

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

    -
    -
    + {% if generic_payment_details %}

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

    -

    - {% 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 "Amount" %}: + CHF {{generic_payment_details.amount|floatformat:2|intcomma}} +

    + {% if 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 + {% trans "Description" %}: + {{generic_payment_details.description}}

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

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

    + {% trans "Recurring" %}: + Yes

    {% 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 -

    -
    -

    @@ -109,7 +136,15 @@ {% csrf_token %}
    -
    {% 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 %}.
    + {% 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 %}