Compare commits

..

No commits in common. "master" and "1.5.5" have entirely different histories.

128 changed files with 1854 additions and 5415 deletions

3
.gitignore vendored
View file

@ -41,5 +41,4 @@ secret-key
/utils/optimize/ /utils/optimize/
# to keep empty dirs # to keep empty dirs
!.gitkeep !.gitkeep
*.orig

View file

@ -9,7 +9,6 @@ env:
install: "pip install -r requirements.txt" install: "pip install -r requirements.txt"
script: script:
- flake8 - flake8
- python manage.py compilemessages
- python manage.py test -v 3 - python manage.py test -v 3
# - coverage run --source='.' manage.py test dynamicweb -v 3 # - coverage run --source='.' manage.py test dynamicweb -v 3
# - coverage report # - coverage report

View file

@ -1,96 +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)
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)
* #5473: Ping a VM before saving ssh key of the user (PR #655)
2.1: 2018-08-21
* Bugfix: Increase CC brand name fields from 10 to 128 characters (PR #654)
2.0.5: 2018-08-08
* Fix IPv6 VM name in the billing invoice
2.0.4: 2018-08-07
* Add RSS feed link to the footer of the blog template (PR #651)
* #5308: [ipv6only] Fix - when creating a VM, the name begins with v6only (PR #649)
* #5293: Use `terminate-hard` action instead of `terminate` in the opennebula call to terminate a vm (PR #650)
2.0.3: 2018-07-18
* Remove unused /comic url (PR #644)
* #5126: Allow dynamicweb sites to be iframed on other by setting `X_FRAME_OPTIONS_ALLOW_FROM_URI` (PR #645)
2.0.2: 2018-07-14
* bugfix: [blog] Add missing content block in the blog_ungleich.html template file
2.0.1: 2018-07-14
* bugfix: [blog] Enable content/structure mode in blog page
2.0: 2018-07-07
* #3747: [dcl,hosting] Add multiple cards support (PR #530)
* #3934: [dcl,hosting] Create HostingOrder outside celery task and add and associate OrderDetail with HostingOrder (PR #624)
* #4890: [hosting] Manage SSH keys using IPv6 of the VM (PR #640)
* bugfix: Fix flake8 error that was ignored in release 1.9.1
1.9.1: 2018-06-24
* #4799: [dcl] Show selected vm templates only in calculator (PR #638)
* #4847: [comic] Add google analytics code for comic.ungleich.ch (PR #639)
* feature: add vm_type option to vm_template and dcl calculator to distinguish between public and ipv6only templates (PR #635)
1.9: 2018-05-16
* #4559: [cms] enable discount on cms calculator
1.8: 2018-05-01
* #4527: [hosting] cms calculator on non-cms pages for the hosting app
* bgfix: [dcl] navbar dropdown target fix
* bgfix: [hosting] login/signup pages footer link fix
1.7.2: 2018-04-30
* bgfix: [cms] add favicon extension to ungleich cms pages
* #4474: [cms] reduce heading slider side padding
1.7.1: 2018-04-21
* #4481: [blog] fix de blog pages 500 error
* #4370: [comic] new url /comic to show only comic blogs
1.7: 2018-04-20
* bgfix: [all] Make /blog available on all domains
* #4367: [dcl] email logo resolution fix
* #4376: [cms] dcl promo section plugin link color changed to brighter shade
* #4379: [dcl] pricing without VAT
* bgfix: [blog] fix top menu items to show only one item
* #4297: [cms] favicon as a page attribute for dcl template
1.6.5: 2018-04-08
* #4396: [ungleich] add favicon to ungleich blog
* #4327: [dcl] fix navbar logo repeat
* bgfix: [hosting] fix broken footer links
* bgfix: [dcl] remove ghost migrations from squashed migration
* bgfix: [cms] redirect multi-tenant urls to /cms also
1.6.4: 2018-04-06
* #4362: [cms] Fix the need of dummy home page for different CMS-based sites
1.6.3: 2018-04-05
* #4377: [cms] header btn external link fix
* #4378: [dcl cms] update CMS Integration to have different content for different domains
1.6.2: 2018-04-01
* bgfix: [dcl] Fix user activation email style; add/correct some DE text
* #4373: [dcl] update footer menu for pw reset/login/signup/activation request pages
1.6.1: 2018-03-28
* bgfix: fix header slider interval issue
* #4315: [cms] navbar consistency from cms page to static page
* #4313: [hosting] footer style fix
1.6: 2018-03-25
* #4266: [dcl cms] add promotional section plugin
* #3842: [dcl, hosting] change number formatting for all the numbers from german to english locale
1.5.5: 2018-03-22
* #4278: [dcl cms] edit options for cms navbar and header plugins
* bgfix: [dcl cms] fix link plugin issues and section image alignment
1.5.4: 2018-03-17 1.5.4: 2018-03-17
* bgfix: [dcl cms] update DCLNavbarPlugin to allow change of brand logo and url * bgfix: [dcl cms] update DCLNavbarPlugin to allow change of brand logo and url
1.5.3: 2018-03-16 1.5.3: 2018-03-16
@ -150,7 +57,7 @@ Next:
* [cms] Introduce UngleichHeaderBackgroundImageAndTextSliderPlugin that allows to have scrolling images and texts * [cms] Introduce UngleichHeaderBackgroundImageAndTextSliderPlugin that allows to have scrolling images and texts
* [cms] Remove <p> tag for ungleich cms customer item template * [cms] Remove <p> tag for ungleich cms customer item template
1.2.12: 2017-12-09 1.2.12: 2017-12-09
* #3594: [digitalglarus] Remove white scroll bar on the right in mobile * #3594: [digitalglarus] Remove white scroll bar on the right in mobile
* #3905: [ungleich] Update ungleich.ch header into a slider * #3905: [ungleich] Update ungleich.ch header into a slider
* #3968: [ungleich] Fix navbar logo alignment * #3968: [ungleich] Fix navbar logo alignment
* [all] Enable logging custom modules * [all] Enable logging custom modules

View file

@ -1,19 +0,0 @@
from django.contrib import admin
from cms.admin.placeholderadmin import PlaceholderAdminMixin
from cms.extensions import PageExtensionAdmin
from .cms_models import CMSIntegration, CMSFaviconExtension
from .models import VMPricing, VMTemplate
class CMSIntegrationAdmin(PlaceholderAdminMixin, admin.ModelAdmin):
list_display = ('name', 'domain')
class CMSFaviconExtensionAdmin(PageExtensionAdmin):
pass
admin.site.register(CMSIntegration, CMSIntegrationAdmin)
admin.site.register(CMSFaviconExtension, CMSFaviconExtensionAdmin)
admin.site.register(VMPricing)
admin.site.register(VMTemplate)

View file

@ -1,56 +1,12 @@
from cms.extensions import PageExtension from djangocms_text_ckeditor.fields import HTMLField
from cms.extensions.extension_pool import extension_pool
from cms.models.fields import PlaceholderField
from cms.models.pluginmodel import CMSPlugin from cms.models.pluginmodel import CMSPlugin
from django import forms
from django.conf import settings
from django.contrib.postgres.fields import ArrayField
from django.contrib.sites.models import Site
from django.db import models from django.db import models
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from djangocms_text_ckeditor.fields import HTMLField
from filer.fields.file import FilerFileField
from filer.fields.image import FilerImageField from filer.fields.image import FilerImageField
from datacenterlight.models import VMPricing, VMTemplate
class CMSIntegration(models.Model):
name = models.CharField(
max_length=100, default='default',
help_text=(
'A unique name for the Integration. This name will be used to '
'fetch the Integration into pages'
)
)
footer_placeholder = PlaceholderField(
'datacenterlight_footer', related_name='dcl-footer-placeholder+'
)
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:
unique_together = ('name', 'domain')
def __str__(self):
return self.name
class CMSFaviconExtension(PageExtension):
favicon = FilerFileField(related_name="cms_favicon_image")
extension_pool.register(CMSFaviconExtension)
# Models for CMS Plugins # Models for CMS Plugins
class DCLSectionPluginModel(CMSPlugin): class DCLSectionPluginModel(CMSPlugin):
heading = models.CharField( heading = models.CharField(
blank=True, null=True, max_length=100, blank=True, null=True, max_length=100,
@ -176,14 +132,6 @@ class DCLNavbarPluginModel(CMSPlugin):
related_name="dcl_navbar_logo_dark", related_name="dcl_navbar_logo_dark",
) )
logo_url = models.URLField(max_length=300, null=True, blank=True) logo_url = models.URLField(max_length=300, null=True, blank=True)
language_dropdown = models.BooleanField(
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): def get_logo_dark(self):
# used only if atleast one logo exists # used only if atleast one logo exists
@ -208,7 +156,7 @@ class DCLNavbarDropdownPluginModel(CMSPlugin):
class DCLContactPluginModel(CMSPlugin): class DCLContactPluginModel(CMSPlugin):
heading = models.CharField(max_length=100, default="Contact", blank=True) heading = models.CharField(max_length=100, default="Contact", blank=True)
organization_name = models.CharField( organization_name = models.CharField(
max_length=100, default="ungleich glarus ag", blank=True max_length=100, default="ungleich GmbH", blank=True
) )
email = models.EmailField(max_length=200, default="info@ungleich.ch") email = models.EmailField(max_length=200, default="info@ungleich.ch")
address = models.CharField( address = models.CharField(
@ -224,7 +172,7 @@ class DCLContactPluginModel(CMSPlugin):
class DCLFooterPluginModel(CMSPlugin): class DCLFooterPluginModel(CMSPlugin):
copyright_label = models.CharField( copyright_label = models.CharField(
max_length=100, default='ungleich glarus ag', blank=True, max_length=100, default='ungleich GmbH', blank=True,
help_text='Name of the company alongside the copyright year' help_text='Name of the company alongside the copyright year'
) )
@ -252,113 +200,3 @@ class DCLSectionImagePluginModel(CMSPlugin):
max_length=100, null=True, blank=True, max_length=100, null=True, blank=True,
help_text='Optional caption for the image.' help_text='Optional caption for the image.'
) )
class DCLSectionPromoPluginModel(CMSPlugin):
background_image = FilerImageField(
on_delete=models.CASCADE, null=True, blank=True,
help_text=('Optional background image for the Promo Section'),
related_name="dcl_section_promo_promo",
)
heading = models.CharField(
blank=True, null=True, max_length=100,
help_text='An optional heading for the Promo Section',
)
subheading = models.CharField(
blank=True, null=True, max_length=200,
help_text='An optional subheading for the Promo Section',
)
content = HTMLField()
html_id = models.SlugField(
blank=True, null=True,
help_text=(
'An optional html id for the Section. Required to set as target '
'of a link on page'
)
)
plain_heading = models.BooleanField(
default=False,
help_text='Select to keep the heading style simpler.'
)
text_center = models.BooleanField(
default=False,
help_text='Select to center align content on small screens.'
)
def __str__(self):
return '#' + self.html_id if self.html_id else str(self.pk)
def get_extra_classes(self):
extra_classes = ''
if self.text_center:
extra_classes += ' text-center'
if self.plain_heading:
extra_classes += ' promo-section-plain'
if self.background_image:
extra_classes += ' promo-with-bg'
return extra_classes
class MultipleChoiceArrayField(ArrayField):
"""
A field that allows us to store an array of choices.
Uses Django's Postgres ArrayField
and a MultipleChoiceField for its formfield.
"""
VMTemplateChoices = []
if settings.OPENNEBULA_DOMAIN != 'test_domain':
VMTemplateChoices = list(
(
str(obj.opennebula_vm_template_id),
(obj.name + ' - ' + VMTemplate.IPV6.title()
if obj.vm_type == VMTemplate.IPV6 else obj.name
)
)
for obj in VMTemplate.objects.all()
)
def formfield(self, **kwargs):
defaults = {
'form_class': forms.MultipleChoiceField,
'choices': self.VMTemplateChoices,
}
defaults.update(kwargs)
# Skip our parent's formfield implementation completely as we don't
# care for it.
# pylint:disable=bad-super-call
return super(ArrayField, self).formfield(**defaults)
class DCLCalculatorPluginModel(CMSPlugin):
pricing = models.ForeignKey(
VMPricing,
related_name="dcl_custom_pricing_vm_pricing",
help_text='Choose a pricing that will be associated with this '
'Calculator'
)
vm_type = models.CharField(
max_length=50, choices=VMTemplate.VM_TYPE_CHOICES,
default=VMTemplate.PUBLIC
)
vm_templates_to_show = MultipleChoiceArrayField(
base_field=models.CharField(
blank=True,
max_length=256,
),
default=list,
blank=True,
help_text="Recommended: If you wish to show all templates of the "
"corresponding VM Type (public/ipv6only), please do not "
"select any of the items in the above field. "
"This will allow any new template(s) added "
"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)

View file

@ -5,11 +5,9 @@ from .cms_models import (
DCLBannerItemPluginModel, DCLBannerListPluginModel, DCLContactPluginModel, DCLBannerItemPluginModel, DCLBannerListPluginModel, DCLContactPluginModel,
DCLFooterPluginModel, DCLLinkPluginModel, DCLNavbarDropdownPluginModel, DCLFooterPluginModel, DCLLinkPluginModel, DCLNavbarDropdownPluginModel,
DCLSectionIconPluginModel, DCLSectionImagePluginModel, DCLSectionIconPluginModel, DCLSectionImagePluginModel,
DCLSectionPluginModel, DCLNavbarPluginModel, DCLSectionPluginModel, DCLNavbarPluginModel
DCLSectionPromoPluginModel, DCLCalculatorPluginModel
) )
from .models import VMTemplate from .models import VMTemplate
from datacenterlight.utils import clear_all_session_vars
@plugin_pool.register_plugin @plugin_pool.register_plugin
@ -20,31 +18,7 @@ class DCLSectionPlugin(CMSPluginBase):
render_template = "datacenterlight/cms/section.html" render_template = "datacenterlight/cms/section.html"
cache = False cache = False
allow_children = True allow_children = True
child_classes = [ child_classes = ['DCLSectionIconPlugin', 'DCLSectionImagePlugin']
'DCLSectionIconPlugin', 'DCLSectionImagePlugin',
'DCLSectionPromoPlugin', 'UngleichHTMLPlugin', 'DCLCalculatorPlugin'
]
def render(self, context, instance, placeholder):
context = super(DCLSectionPlugin, self).render(
context, instance, placeholder
)
context['children_to_side'] = []
context['children_to_content'] = []
context['children_calculator'] = []
if instance.child_plugin_instances is not None:
right_children = [
'DCLSectionImagePluginModel',
'DCLSectionIconPluginModel',
]
for child in instance.child_plugin_instances:
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
@plugin_pool.register_plugin @plugin_pool.register_plugin
@ -67,40 +41,19 @@ class DCLSectionImagePlugin(CMSPluginBase):
require_parent = True require_parent = True
@plugin_pool.register_plugin
class DCLSectionPromoPlugin(CMSPluginBase):
module = "Datacenterlight"
name = "DCL Section Promo Plugin"
model = DCLSectionPromoPluginModel
render_template = "datacenterlight/cms/section_promo.html"
cache = False
@plugin_pool.register_plugin @plugin_pool.register_plugin
class DCLCalculatorPlugin(CMSPluginBase): class DCLCalculatorPlugin(CMSPluginBase):
module = "Datacenterlight" module = "Datacenterlight"
name = "DCL Calculator Plugin" name = "DCL Calculator Plugin"
model = DCLCalculatorPluginModel model = DCLSectionPluginModel
render_template = "datacenterlight/cms/calculator.html" render_template = "datacenterlight/cms/calculator.html"
cache = False cache = False
require_parent = True
def render(self, context, instance, placeholder): def render(self, context, instance, placeholder):
clear_all_session_vars(context['request'])
context = super(DCLCalculatorPlugin, self).render( context = super(DCLCalculatorPlugin, self).render(
context, instance, placeholder context, instance, placeholder
) )
ids = instance.vm_templates_to_show context['templates'] = VMTemplate.objects.all()
if ids:
context['templates'] = VMTemplate.objects.filter(
vm_type=instance.vm_type
).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 return context

View file

@ -1,24 +0,0 @@
from cms.extensions.toolbar import ExtensionToolbar
from cms.toolbar_pool import toolbar_pool
from django.utils.translation import ugettext_lazy as _
from .cms_models import CMSFaviconExtension
@toolbar_pool.register
class CMSFaviconExtensionToolbar(ExtensionToolbar):
# defineds the model for the current toolbar
model = CMSFaviconExtension
def populate(self):
# setup the extension toolbar with permissions and sanity checks
current_page_menu = self._setup_extension_toolbar()
# if it's all ok
if current_page_menu:
# retrieves the instance of the current extension (if any) and the toolbar item url
page_extension, url = self.get_page_extension_admin()
if url:
# adds a toolbar item
current_page_menu.add_modal_item(
_('CMS Favicon'), url=url, disabled=not self.toolbar.edit_mode
)

View file

@ -8,35 +8,65 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-26 20:44+0000\n" "POT-Creation-Date: 2018-01-15 23:12+0000\n"
"PO-Revision-Date: 2018-03-30 23:22+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: b'Anonymous User <coder.purple+25@gmail.com>'\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Translated-Using: django-rosetta 0.8.1\n"
msgid "CMS Favicon"
msgstr ""
#, python-format #, python-format
msgid "Your New VM %(vm_name)s at Data Center Light" msgid "Your New VM %(vm_name)s at Data Center Light"
msgstr "Deine neue VM %(vm_name)s bei Data Center Light" msgstr "Deine neue VM %(vm_name)s bei Data Center Light"
msgid "All Rights Reserved" msgid "Enter name"
msgstr "Alle Rechte vorbehalten" msgstr "Name"
msgid "Toggle navigation" msgid "Enter email"
msgstr "Umschalten" msgstr "E-Mail-Adresse"
msgid "Login" msgid "Request Beta Access"
msgstr "Anmelden" msgstr "Beantrage Beta-Zugang"
msgid "Dashboard" msgid "Request Sent"
msgstr "Anfrage verschickt"
msgid ""
"Thank you for your subscription! You will receive a confirmation mail from "
"our team"
msgstr "" msgstr ""
"Vielen dank für Ihre Anmeldung. Sie erhalten in kürze eine Bestätigungsmail "
"von unserem Team"
msgid "VM hosting"
msgstr ""
msgid "month"
msgstr "Monat"
msgid "VAT included"
msgstr "MwSt. inklusive"
msgid "Hosted in Switzerland"
msgstr "Standort: Schweiz"
msgid "Please enter a value in range 1 - 48."
msgstr "Bitte gib einen Wert von 1 bis 48 ein."
msgid "Please enter a value in range 1 - 200."
msgstr "Bitte gib einen Wert von 1 bis 200 ein."
msgid "Please enter a value in range 10 - 2000."
msgstr "Bitte gib einen Wert von 10 bis 2000 ein."
msgid "GB Storage (SSD)"
msgstr "GB Storage (SSD)"
msgid "Continue"
msgstr "Weiter"
msgid "Thank you for contacting us." msgid "Thank you for contacting us."
msgstr "Nachricht gesendet." msgstr "Nachricht gesendet."
@ -70,6 +100,32 @@ msgstr ""
msgid "SUBMIT" msgid "SUBMIT"
msgstr "ABSENDEN" msgstr "ABSENDEN"
msgid "Your Data Center Light Team"
msgstr "Dein Data Center Light Team"
msgid "Thank you for your request."
msgstr "Vielen Dank für Deine Anfrage."
msgid "You are one step away from being our beta tester!"
msgstr ""
"Sie sind nur noch einen Schritt davon entfernt, unser Beta-Tester zu werden!"
msgid ""
"Currently we are running our tests to make sure everything runs perfectly."
msgstr ""
"Momentan testen wir die Beta-Umgebung um sie für Ihren Gebrauch "
"sicherzustellen."
msgid ""
"In the meantime, we would like to ask you a little patience<br/> until our "
"team contacts you with beta access."
msgstr ""
"Wir werden dann sobald als möglich Ihren Beta-Zugang erstellen und Sie "
"daraufhin kontaktieren.Bis dahin bitten wir Sie um etwas Geduld."
msgid "Thank you!"
msgstr "Vielen Dank!"
msgid "Data Center Light Account Activation" msgid "Data Center Light Account Activation"
msgstr "Data Center Light Account Aktivierung" msgstr "Data Center Light Account Aktivierung"
@ -80,7 +136,7 @@ msgid ""
"#4382c8; font-weight: 400;\">here</a>." "#4382c8; font-weight: 400;\">here</a>."
msgstr "" msgstr ""
"Klicke <a href=\"%(base_url)s%(activation_link)s\"style=\"text-decoration: " "Klicke <a href=\"%(base_url)s%(activation_link)s\"style=\"text-decoration: "
"none; color: #4382c8; font-weight: 400;\">hier</a> um deinen Data Center " "none; color: #4382c8; font-weight: 400;\">here</a> um deinen Data Center "
"Light Account zu aktivieren." "Light Account zu aktivieren."
msgid "" msgid ""
@ -100,26 +156,14 @@ msgstr "Deine E-Mail-Adresse"
msgid "Password" msgid "Password"
msgstr "Passwort" msgstr "Passwort"
#, python-format msgid "You can reset your password here"
msgid "" msgstr "Du kannst dein Passwort hier zurück setzen"
"You can reset your password <a href=\"%(base_url)s%(reset_password_url)s\" "
"style=\"text-decoration: none; color: #4382c8; font-weight: 400;\">here</a>."
msgstr ""
"Du kannst dein Passwort <a href=\"%(base_url)s%(reset_password_url)s\" style="
"\"text-decoration: none; color: #4382c8; font-weight: 400;\">hier</a> "
"zurücksetzen."
msgid "Your Data Center Light Team"
msgstr "Dein Data Center Light Team"
msgid "" msgid ""
"You can copy and paste the following link into the address bar of your " "You can copy and paste the following link into the address bar of your "
"browser to activate your Data Center Light account." "browser to activate your Data Center Light account."
msgstr "Kopiere den folgenden Link in die Adressleiste deines Browsers." msgstr "Kopiere den folgenden Link in die Adressleiste deines Browsers."
msgid "You can reset your password here"
msgstr "Du kannst dein Passwort hier zurücksetzen"
msgid "Welcome to Data Center Light!" msgid "Welcome to Data Center Light!"
msgstr "Willkommen beim Data Center Light!" msgstr "Willkommen beim Data Center Light!"
@ -134,51 +178,48 @@ msgstr "Unser Angebot beginnt bei 15 CHF pro Monat. Probier's jetzt aus!"
msgid "ORDER VM" msgid "ORDER VM"
msgstr "VM BESTELLEN" msgstr "VM BESTELLEN"
msgid "VM hosting"
msgstr ""
msgid "month"
msgstr "Monat"
msgid "VAT included"
msgstr "MwSt. inklusive"
msgid "You save"
msgstr "Du sparst"
msgid "Hosted in Switzerland"
msgstr "Standort: Schweiz"
msgid "Please enter a value in range 1 - 48."
msgstr "Bitte gib einen Wert von 1 bis 48 ein."
msgid "Please enter a value in range 1 - 200."
msgstr "Bitte gib einen Wert von 1 bis 200 ein."
msgid "Please enter a value in range 10 - 2000."
msgstr "Bitte gib einen Wert von 10 bis 2000 ein."
msgid "GB Storage (SSD)"
msgstr "GB Storage (SSD)"
msgid "Continue"
msgstr "Weiter"
msgid "Home" msgid "Home"
msgstr "Home" msgstr "Home"
msgid "Highlights"
msgstr ""
msgid "Scale out"
msgstr "Skalierung"
msgid "Reliable and light"
msgstr "Zuverlässig und leicht"
msgid "Pricing"
msgstr "Preise"
msgid "Order VM"
msgstr "VM bestellen"
msgid "Contact" msgid "Contact"
msgstr "Kontakt" msgstr "Kontakt"
msgid "Terms of Service" msgid "Terms of Service"
msgstr "Nutzungsbedingungen" msgstr "Nutzungsbedingungen"
msgid "All Rights Reserved"
msgstr "Alle Rechte vorbehalten"
msgid "Toggle navigation"
msgstr "Umschalten"
msgid "Why Data Center Light?"
msgstr "Warum Data Center Light?"
msgid "Login"
msgstr "Anmelden"
msgid "Dashboard"
msgstr ""
msgid "Finally, an affordable VM hosting in Switzerland!" msgid "Finally, an affordable VM hosting in Switzerland!"
msgstr "Endlich: bezahlbares VM Hosting in der Schweiz" msgstr "Endlich: bezahlbares VM Hosting in der Schweiz"
msgid "Highlights"
msgstr ""
msgid "I want it!" msgid "I want it!"
msgstr "Das will ich haben!" msgstr "Das will ich haben!"
@ -209,9 +250,6 @@ msgstr ""
"mit FOSS (Free Open Source Software) arbeitet und wir daher auf " "mit FOSS (Free Open Source Software) arbeitet und wir daher auf "
"Lizenzgebühren verzichten können." "Lizenzgebühren verzichten können."
msgid "Scale out"
msgstr "Skalierung"
msgid "" msgid ""
"We don't use special hardware. We use commodity hardware: we buy computers " "We don't use special hardware. We use commodity hardware: we buy computers "
"that you buy. Just many more and put them in a cozy home for computers " "that you buy. Just many more and put them in a cozy home for computers "
@ -221,9 +259,6 @@ msgstr ""
"erschwingliche Systeme. Bei grösserer Auslastung werden mehr " "erschwingliche Systeme. Bei grösserer Auslastung werden mehr "
"Standardkomponenten hinzugekauft und skalieren so das Datencenter." "Standardkomponenten hinzugekauft und skalieren so das Datencenter."
msgid "Reliable and light"
msgstr "Zuverlässig und leicht"
msgid "" msgid ""
"Our VMs are located in Switzerland, with reliable power supply and fast " "Our VMs are located in Switzerland, with reliable power supply and fast "
"internet connection. Our VM costs less thanks to our featherlight " "internet connection. Our VM costs less thanks to our featherlight "
@ -293,9 +328,6 @@ msgstr "Registrieren"
msgid "Billing Address" msgid "Billing Address"
msgstr "Rechnungsadresse" msgstr "Rechnungsadresse"
msgid "Make a payment"
msgstr ""
msgid "Your Order" msgid "Your Order"
msgstr "Deine Bestellung" msgstr "Deine Bestellung"
@ -317,32 +349,12 @@ msgstr "Gesamt"
msgid "including VAT" msgid "including VAT"
msgstr "inkl. Mehrwertsteuer" msgstr "inkl. Mehrwertsteuer"
msgid "excluding VAT"
msgstr "exkl. Mehrwertsteuer"
msgid "Month" msgid "Month"
msgstr "Monat" msgstr "Monat"
msgid "Discount"
msgstr "Rabatt"
msgid "Will be applied at checkout"
msgstr "wird an der Kasse angewendet"
msgid "Credit Card" msgid "Credit Card"
msgstr "Kreditkarte" msgstr "Kreditkarte"
msgid ""
"Please select one of the cards that you used before or fill in your credit "
"card information below. We are using <a href=\"https://stripe.com\" target="
"\"_blank\">Stripe</a> for payment and do not store your information in our "
"database."
msgstr ""
"Bitte wähle eine der zuvor genutzten Kreditkarten oder gib Deine "
"Kreditkartendetails unten an. Die Bezahlung wird über <a href=\"https://"
"stripe.com\" target=\"_blank\">Stripe</a> abgewickelt. Wir speichern Deine "
"Kreditkartendetails nicht in unserer Datenbank."
msgid "" msgid ""
"Please fill in your credit card information below. We are using <a href=" "Please fill in your credit card information below. We are using <a href="
"\"https://stripe.com\" target=\"_blank\">Stripe</a> for payment and do not " "\"https://stripe.com\" target=\"_blank\">Stripe</a> for payment and do not "
@ -352,23 +364,31 @@ msgstr ""
"\"https://stripe.com\" target=\"_blank\">Stripe</a> für die Bezahlung und " "\"https://stripe.com\" target=\"_blank\">Stripe</a> für die Bezahlung und "
"speichern keine Informationen in unserer Datenbank." "speichern keine Informationen in unserer Datenbank."
msgid "Last" msgid ""
msgstr "Letzten" "You are not making any payment yet. After submitting your card information, "
"you will be taken to the Confirm Order Page."
msgstr ""
"Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst ausgelöst, "
"nachdem Du die Bestellung auf der nächsten Seite bestätigt hast."
msgid "Type" msgid "Card Number"
msgstr "Typ" msgstr "Kreditkartennummer"
msgid "SELECT" msgid "Expiry Date"
msgstr "AUSWÄHLEN" msgstr "Ablaufdatum"
msgid "Add a new credit card" msgid "CVC"
msgstr "Eine neue Kreditkarte hinzufügen" msgstr ""
msgid "NEW CARD" msgid "Card Type"
msgstr "NEUE KARTE" msgstr "Kartentyp"
msgid "New Credit Card" msgid ""
msgstr "Neue Kreditkarte" "You are not making any payment yet. After placing your order, you will be "
"taken to the Submit Payment Page."
msgstr ""
"Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst ausgelöst, "
"nachdem Du die Bestellung auf der nächsten Seite bestätigt hast."
msgid "Processing" msgid "Processing"
msgstr "Weiter" msgstr "Weiter"
@ -377,85 +397,24 @@ msgid "Enter your credit card number"
msgstr "Deine Kreditkartennummer" msgstr "Deine Kreditkartennummer"
#, python-format #, python-format
msgid "%(page_header_text)s"
msgstr ""
msgid "Date"
msgstr "Datum"
msgid "Billed to"
msgstr "Rechnungsadresse"
msgid "Payment method"
msgstr "Bezahlmethode"
msgid "ending in"
msgstr "endend in"
msgid "Order summary"
msgstr "Bestellungsübersicht"
msgid "Product"
msgstr "Produkt"
msgid "Amount"
msgstr ""
msgid "Description"
msgstr ""
msgid "Recurring"
msgstr ""
msgid "Subtotal"
msgstr "Zwischensumme"
msgid "VAT"
msgstr "Mehrwertsteuer"
msgid "" msgid ""
"By clicking \"Place order\" this plan will charge your credit card account " "By clicking \"Place order\" this plan will charge your credit card account "
"with %(total_price)s CHF/month" "with the fee of %(vm_price)sCHF/month"
msgstr "" msgstr ""
"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit " "Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit %(vm_price)sCHF "
"%(vm_total_price)s CHF pro Monat belastet" "pro Monat belastet"
msgid ""
"By clicking \"Place order\" this payment will charge your credit card "
"account with a one time amount of %(total_price)s CHF"
msgstr ""
"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit "
"%(vm_total_price)s CHF pro Monat belastet"
#, python-format
msgid ""
"By clicking \"Place order\" this plan will charge your credit card account "
"with %(vm_total_price)s CHF/month"
msgstr ""
"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit "
"%(vm_total_price)s CHF pro Monat belastet"
msgid "Place order" msgid "Place order"
msgstr "Bestellen" msgstr "Bestellen"
msgid "Processing..." msgid "Thank you for order! Our team will contact you via email"
msgstr "Abarbeitung..."
msgid "Hold tight, we are processing your request"
msgstr "Bitte warten - wir verarbeiten Deine Anfrage gerade"
msgid "OK"
msgstr "" msgstr ""
"Vielen Dank für die Bestellung. Unser Team setzt sich sobald wie möglich mit "
"Dir via E-Mail in Verbindung."
msgid "Close" msgid "as soon as possible!"
msgstr "" msgstr ""
msgid "Some problem encountered. Please try again later."
msgstr "Ein Problem ist aufgetreten. Bitte versuche es später noch einmal."
msgid "Why Data Center Light?"
msgstr "Warum Data Center Light?"
msgid "Tech Stack" msgid "Tech Stack"
msgstr "Tech Stack" msgstr "Tech Stack"
@ -541,17 +500,6 @@ msgstr "Ungültige RAM-Grösse"
msgid "Invalid storage size" msgid "Invalid storage size"
msgstr "Ungültige Speicher-Grösse" msgstr "Ungültige Speicher-Grösse"
#, python-brace-format
msgid "Incorrect pricing name. Please contact support{support_email}"
msgstr ""
#, python-brace-format
msgid "{user} does not have permission to access the card"
msgstr "{user} hat keine Erlaubnis auf diese Karte zuzugreifen"
msgid "An error occurred. Details: {}"
msgstr "Ein Fehler ist aufgetreten. Details: {}"
msgid "Confirm Order" msgid "Confirm Order"
msgstr "Bestellung Bestätigen" msgstr "Bestellung Bestätigen"
@ -565,36 +513,6 @@ msgstr ""
"Es ist ein Fehler bei der Zahlung betreten. Du wirst nach dem Schliessen vom " "Es ist ein Fehler bei der Zahlung betreten. Du wirst nach dem Schliessen vom "
"Popup zur Bezahlseite weitergeleitet." "Popup zur Bezahlseite weitergeleitet."
#, python-brace-format
msgid "An error occurred while associating the card. Details: {details}"
msgstr ""
"Beim Verbinden der Karte ist ein Fehler aufgetreten. Details: {details}"
msgid "Confirmation of your payment"
msgstr ""
msgid " This is a monthly recurring plan."
msgstr ""
#, python-brace-format
msgid ""
"Hi {name},\n"
"\n"
"thank you for your order!\n"
"We have just received a payment of CHF {amount:.2f} from you.{recurring}\n"
"\n"
"Cheers,\n"
"Your Data Center Light team"
msgstr ""
msgid "Thank you for the payment."
msgstr "Danke für Deine Bestellung."
msgid ""
"You will soon receive a confirmation email of the payment. You can always "
"contact us at info@ungleich.ch for any question that you may have."
msgstr ""
msgid "Thank you for the order." msgid "Thank you for the order."
msgstr "Danke für Deine Bestellung." msgstr "Danke für Deine Bestellung."
@ -605,88 +523,36 @@ msgstr ""
"Deine VM ist gleich bereit. Wir senden Dir eine Bestätigungsemail, sobald Du " "Deine VM ist gleich bereit. Wir senden Dir eine Bestätigungsemail, sobald Du "
"auf sie zugreifen kannst." "auf sie zugreifen kannst."
#~ msgid ""
#~ "You are not making any payment yet. After submitting your card "
#~ "information, you will be taken to the Confirm Order Page."
#~ msgstr ""
#~ "Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst "
#~ "ausgelöst, nachdem Du die Bestellung auf der nächsten Seite bestätigt "
#~ "hast."
#~ msgid "Card Number"
#~ msgstr "Kreditkartennummer"
#~ msgid "Expiry Date"
#~ msgstr "Ablaufdatum"
#~ msgid ""
#~ "You are not making any payment yet. After placing your order, you will be "
#~ "taken to the Submit Payment Page."
#~ msgstr ""
#~ "Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst "
#~ "ausgelöst, nachdem Du die Bestellung auf der nächsten Seite bestätigt "
#~ "hast."
#~ msgid "Pricing"
#~ msgstr "Preise"
#~ msgid "Order VM"
#~ msgstr "VM bestellen"
#~ msgid "Enter name"
#~ msgstr "Name"
#~ msgid "Enter email"
#~ msgstr "E-Mail-Adresse"
#~ msgid "Request Beta Access"
#~ msgstr "Beantrage Beta-Zugang"
#~ msgid "Request Sent"
#~ msgstr "Anfrage verschickt"
#~ msgid ""
#~ "Thank you for your subscription! You will receive a confirmation mail "
#~ "from our team"
#~ msgstr ""
#~ "Vielen dank für Ihre Anmeldung. Sie erhalten in kürze eine "
#~ "Bestätigungsmail von unserem Team"
#~ msgid "Thank you for your request."
#~ msgstr "Vielen Dank für Deine Anfrage."
#~ msgid "You are one step away from being our beta tester!"
#~ msgstr ""
#~ "Sie sind nur noch einen Schritt davon entfernt, unser Beta-Tester zu "
#~ "werden!"
#~ msgid ""
#~ "Currently we are running our tests to make sure everything runs perfectly."
#~ msgstr ""
#~ "Momentan testen wir die Beta-Umgebung um sie für Ihren Gebrauch "
#~ "sicherzustellen."
#~ msgid ""
#~ "In the meantime, we would like to ask you a little patience<br/> until "
#~ "our team contacts you with beta access."
#~ msgstr ""
#~ "Wir werden dann sobald als möglich Ihren Beta-Zugang erstellen und Sie "
#~ "daraufhin kontaktieren.Bis dahin bitten wir Sie um etwas Geduld."
#~ msgid "Thank you!"
#~ msgstr "Vielen Dank!"
#~ msgid "Thank you for order! Our team will contact you via email"
#~ msgstr ""
#~ "Vielen Dank für die Bestellung. Unser Team setzt sich sobald wie möglich "
#~ "mit Dir via E-Mail in Verbindung."
#~ msgid "Affordable VM hosting based in Switzerland" #~ msgid "Affordable VM hosting based in Switzerland"
#~ msgstr "Bezahlbares VM Hosting in der Schweiz" #~ msgstr "Bezahlbares VM Hosting in der Schweiz"
#~ msgid "Processing..."
#~ msgstr "Abarbeitung..."
#~ msgid "Hold tight, we are processing your request"
#~ msgstr "Bitte warten - wir verbeiten Deine Anfrage gerade"
#~ msgid "Some problem encountered. Please try again later."
#~ msgstr "Ein Problem ist aufgetreten. Bitte versuche es später noch einmal."
#~ msgid "Submit" #~ msgid "Submit"
#~ msgstr "Absenden" #~ msgstr "Absenden"
#~ msgid "Date"
#~ msgstr "Datum"
#~ msgid "Billed To:"
#~ msgstr "Rechnungsadresse"
#~ msgid "Payment Method:"
#~ msgstr "Bezahlmethode"
#~ msgid "ending in"
#~ msgstr "endend in"
#~ msgid "Order summary"
#~ msgstr "Bestellungsübersicht"
#~ msgid "We are cutting down the costs significantly!" #~ msgid "We are cutting down the costs significantly!"
#~ msgstr "Wir sorgen dafür, dass die Kosten für Dich signifikant abnehmen" #~ msgstr "Wir sorgen dafür, dass die Kosten für Dich signifikant abnehmen"

View file

@ -1,21 +0,0 @@
from django.core.management.base import BaseCommand
from datacenterlight.cms_models import CMSIntegration
class Command(BaseCommand):
help = '''Creates cms integration objects for datacenterlight'''
def handle(self, *args, **options):
self.create_cms_integration()
def create_cms_integration(self, site=None):
obj, created = CMSIntegration.objects.get_or_create(
name='default', domain=site
)
domain_name = site.domain if site else 'All Sites'
if created:
print('created the default CMSIntegration object for', domain_name)
else:
print(
'default CMSIntegration object already exists for', domain_name
)

View file

@ -1,36 +0,0 @@
from django.core.management.base import BaseCommand
from datacenterlight.models import VMPricing
class Command(BaseCommand):
help = '''Creates default VMPricing object'''
DEFAULT_VMPRICING_NAME = 'default'
def handle(self, *args, **options):
self.create_default_vm_pricing()
def create_default_vm_pricing(self):
obj, created = VMPricing.objects.get_or_create(
name=self.DEFAULT_VMPRICING_NAME,
defaults={
"vat_inclusive": True,
"cores_unit_price": 5,
"ram_unit_price": 2,
"ssd_unit_price": 0.6,
"hdd_unit_price": 0.01
}
)
if created:
print(
'Successfully created {} VMPricing object'.format(
self.DEFAULT_VMPRICING_NAME
)
)
else:
print(
'{} VMPricing exists already.'.format(
self.DEFAULT_VMPRICING_NAME
)
)

View file

@ -10,28 +10,16 @@ class Command(BaseCommand):
help = '''Fetches the VM templates from OpenNebula and populates the dcl help = '''Fetches the VM templates from OpenNebula and populates the dcl
VMTemplate model''' VMTemplate model'''
def get_templates(self, manager, prefix):
templates = manager.get_templates('%s-' % prefix)
dcl_vm_templates = []
for template in templates:
template_name = template.name.lstrip('%s-' % prefix)
template_id = template.id
dcl_vm_template = VMTemplate.create(
template_name, template_id, prefix
)
dcl_vm_templates.append(dcl_vm_template)
return dcl_vm_templates
def handle(self, *args, **options): def handle(self, *args, **options):
try: try:
manager = OpenNebulaManager() manager = OpenNebulaManager()
templates = manager.get_templates()
dcl_vm_templates = [] dcl_vm_templates = []
dcl_vm_templates.extend( for template in templates:
self.get_templates(manager, VMTemplate.PUBLIC) template_name = template.name.lstrip('public-')
) template_id = template.id
dcl_vm_templates.extend( dcl_vm_template = VMTemplate.create(template_name, template_id)
self.get_templates(manager, VMTemplate.IPV6) dcl_vm_templates.append(dcl_vm_template)
)
old_vm_templates = VMTemplate.objects.all() old_vm_templates = VMTemplate.objects.all()
old_vm_templates.delete() old_vm_templates.delete()

View file

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-03-19 20:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0013_dclnavbarpluginmodel'),
]
operations = [
migrations.AddField(
model_name='dclnavbarpluginmodel',
name='language_dropdown',
field=models.BooleanField(
default=True, help_text='Select to include the language selection dropdown.'),
),
]

View file

@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-03-21 19:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import djangocms_text_ckeditor.fields
import filer.fields.image
class Migration(migrations.Migration):
dependencies = [
('cms', '0014_auto_20160404_1908'),
('datacenterlight', '0013_dclnavbarpluginmodel'),
]
operations = [
migrations.CreateModel(
name='DCLSectionPromoPluginModel',
fields=[
('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE,
parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
('heading', models.CharField(
blank=True, help_text='An optional heading for the Promo Section', max_length=100, null=True)),
('subheading', models.CharField(
blank=True, help_text='An optional subheading for the Promo Section', max_length=200, null=True)),
('content', djangocms_text_ckeditor.fields.HTMLField()),
('html_id', models.SlugField(
blank=True, help_text='An optional html id for the Section. Required to set as target of a link on page', null=True)),
('plain_heading', models.BooleanField(default=False,
help_text='Select to keep the heading style simpler.')),
('center_on_mobile', models.BooleanField(default=False,
help_text='Select to center align content on small screens.')),
('background_image', filer.fields.image.FilerImageField(blank=True, help_text='Optional background image for the Promo Section',
null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dcl_section_promo_promo', to='filer.Image')),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]

View file

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-03-22 19:22
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0014_dclsectionpromopluginmodel'),
('datacenterlight', '0014_dclnavbarpluginmodel_language_dropdown'),
]
operations = [
migrations.RenameField(
model_name='dclsectionpromopluginmodel',
old_name='center_on_mobile',
new_name='text_center',
),
]

View file

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-03-27 15:31
from __future__ import unicode_literals
import cms.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0015_auto_20180323_0011'),
('cms', '0014_auto_20160404_1908'),
]
operations = [
migrations.CreateModel(
name='CMSIntegration',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('navbar_placeholder', cms.models.fields.PlaceholderField(editable=False, null=True,
on_delete=django.db.models.deletion.CASCADE, slotname='datacenterlight_navbar', to='cms.Placeholder')),
('footer_placeholder', cms.models.fields.PlaceholderField(editable=False, null=True,
on_delete=django.db.models.deletion.CASCADE, slotname='datacenterlight_footer', to='cms.Placeholder')),
('name', models.CharField(default='default',
help_text='A unique name for the Integration. This name will be used to fetch the Integration into pages', max_length=100, unique=True)),
],
),
]

View file

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-03-28 19:26
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', '0016_cmsintegration'),
]
operations = [
migrations.AlterField(
model_name='cmsintegration',
name='footer_placeholder',
field=cms.models.fields.PlaceholderField(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dcl-footer-placeholder+', slotname='datacenterlight_footer', to='cms.Placeholder'),
),
migrations.AlterField(
model_name='cmsintegration',
name='navbar_placeholder',
field=cms.models.fields.PlaceholderField(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dcl-navbar-placeholder+', slotname='datacenterlight_navbar', to='cms.Placeholder'),
),
]

View file

@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-04-03 17:08
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0017_auto_20180329_0056'),
('sites', '0002_alter_domain_unique'),
]
operations = [
migrations.AlterField(
model_name='dclcontactpluginmodel',
name='organization_name',
field=models.CharField(blank=True, default='ungleich glarus ag', max_length=100),
),
migrations.AlterField(
model_name='dclfooterpluginmodel',
name='copyright_label',
field=models.CharField(blank=True, default='ungleich glarus ag', help_text='Name of the company alongside the copyright year', max_length=100),
),
migrations.AddField(
model_name='cmsintegration',
name='domain',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
),
migrations.AlterField(
model_name='cmsintegration',
name='name',
field=models.CharField(default='default', help_text='A unique name for the Integration. This name will be used to fetch the Integration into pages', max_length=100),
),
migrations.AlterUniqueTogether(
name='cmsintegration',
unique_together=set([('name', 'domain')]),
),
]

View file

@ -1,45 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-04-15 22:36
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cms', '0014_auto_20160404_1908'),
('datacenterlight', '0018_auto_20180403_1930'),
]
operations = [
migrations.CreateModel(
name='DCLCustomPricingModel',
fields=[
('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
migrations.CreateModel(
name='VMPricing',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, unique=True)),
('vat_inclusive', models.BooleanField(default=True)),
('vat_percentage', models.DecimalField(blank=True, decimal_places=5, default=0, max_digits=7)),
('cores_unit_price', models.DecimalField(decimal_places=5, default=0, max_digits=7)),
('ram_unit_price', models.DecimalField(decimal_places=5, default=0, max_digits=7)),
('ssd_unit_price', models.DecimalField(decimal_places=5, default=0, max_digits=7)),
('hdd_unit_price', models.DecimalField(decimal_places=6, default=0, max_digits=7)),
],
),
migrations.AddField(
model_name='dclcustompricingmodel',
name='pricing',
field=models.ForeignKey(help_text='Choose a pricing that will be associated with this Calculator', on_delete=django.db.models.deletion.CASCADE, related_name='dcl_custom_pricing_vm_pricing', to='datacenterlight.VMPricing'),
),
]

View file

@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-04-12 03:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.file
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0018_auto_20180403_1930'),
]
operations = [
migrations.CreateModel(
name='CMSFaviconExtension',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extended_object', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='cms.Page')),
('favicon', filer.fields.file.FilerFileField(on_delete=django.db.models.deletion.CASCADE, related_name='cms_favicon_image', to='filer.File')),
('public_extension', models.OneToOneField(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='draft_extension', to='datacenterlight.CMSFaviconExtension')),
],
options={
'abstract': False,
},
),
]

View file

@ -1,16 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-04-20 15:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0019_auto_20180415_2236'),
('datacenterlight', '0019_cmsfaviconextension'),
]
operations = [
]

View file

@ -1,28 +0,0 @@
# -*- 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',
),
]

View file

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-05-07 02:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0021_cmsintegration_calculator_placeholder'),
]
operations = [
migrations.AddField(
model_name='vmpricing',
name='discount_amount',
field=models.DecimalField(
decimal_places=2, default=0, max_digits=6),
),
migrations.AddField(
model_name='vmpricing',
name='discount_name',
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View file

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-05-23 22:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0022_auto_20180506_1950'),
]
operations = [
migrations.AddField(
model_name='dclcalculatorpluginmodel',
name='vm_type',
field=models.CharField(choices=[('public', 'Public'), ('ipv6only', 'Ipv6Only')], default='public', max_length=50),
),
migrations.AddField(
model_name='vmtemplate',
name='vm_type',
field=models.CharField(choices=[('public', 'Public'), ('ipv6only', 'Ipv6Only')], default='public', max_length=50),
),
]

View file

@ -1,21 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-06-24 08:23
from __future__ import unicode_literals
import datacenterlight.cms_models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0023_auto_20180524_0349'),
]
operations = [
migrations.AddField(
model_name='dclcalculatorpluginmodel',
name='vm_templates_to_show',
field=datacenterlight.cms_models.MultipleChoiceArrayField(base_field=models.CharField(blank=True, max_length=256), blank=True, default=list, help_text='Recommended: If you wish to show all templates of the corresponding VM Type (public/ipv6only), please do not select any of the items in the above field. This will allow any new template(s) added in the backend to be automatically listed in this calculator instance.', size=None),
),
]

View file

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-09-25 20:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0024_dclcalculatorpluginmodel_vm_templates_to_show'),
]
operations = [
migrations.AddField(
model_name='dclnavbarpluginmodel',
name='show_login_option',
field=models.BooleanField(default=True, help_text='Uncheck this if you do not want to show login/dashboard.'),
),
]

View file

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-09-27 20:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0025_dclnavbarpluginmodel_show_login_option'),
]
operations = [
migrations.AddField(
model_name='dclcalculatorpluginmodel',
name='default_selected_template',
field=models.CharField(default='Devuan Ascii', help_text='Write the name of the template that you need selected as default when the calculator loads', max_length=128, null=True),
),
]

View file

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-09-29 05:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0026_dclcalculatorpluginmodel_default_selected_template'),
]
operations = [
migrations.AddField(
model_name='dclcalculatorpluginmodel',
name='enable_512mb_ram',
field=models.BooleanField(default=False),
),
]

View file

@ -1,103 +1,17 @@
import logging
from django.db import models from django.db import models
logger = logging.getLogger(__name__)
class VMTemplate(models.Model): class VMTemplate(models.Model):
PUBLIC = 'public'
IPV6 = 'ipv6only'
VM_TYPE_CHOICES = (
(PUBLIC, PUBLIC.title()),
(IPV6, IPV6.title()),
)
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
opennebula_vm_template_id = models.IntegerField() opennebula_vm_template_id = models.IntegerField()
vm_type = models.CharField(
max_length=50, choices=VM_TYPE_CHOICES, default=PUBLIC
)
def __str__(self):
return '%s - %s - %s' % (
self.opennebula_vm_template_id, self.vm_type, self.name
)
@classmethod @classmethod
def create(cls, name, opennebula_vm_template_id, vm_type): def create(cls, name, opennebula_vm_template_id):
vm_template = cls( vm_template = cls(
name=name, opennebula_vm_template_id=opennebula_vm_template_id, name=name, opennebula_vm_template_id=opennebula_vm_template_id)
vm_type=vm_type
)
return vm_template return vm_template
class VMPricing(models.Model):
name = models.CharField(max_length=255, unique=True)
vat_inclusive = models.BooleanField(default=True)
vat_percentage = models.DecimalField(
max_digits=7, decimal_places=5, blank=True, default=0
)
cores_unit_price = models.DecimalField(
max_digits=7, decimal_places=5, default=0
)
ram_unit_price = models.DecimalField(
max_digits=7, decimal_places=5, default=0
)
ssd_unit_price = models.DecimalField(
max_digits=7, decimal_places=5, default=0
)
hdd_unit_price = models.DecimalField(
max_digits=7, decimal_places=6, default=0
)
discount_name = models.CharField(max_length=255, null=True, blank=True)
discount_amount = models.DecimalField(
max_digits=6, decimal_places=2, default=0
)
def __str__(self):
display_str = self.name + ' => ' + ' - '.join([
'{}/Core'.format(self.cores_unit_price.normalize()),
'{}/GB RAM'.format(self.ram_unit_price.normalize()),
'{}/GB SSD'.format(self.ssd_unit_price.normalize()),
'{}/GB HDD'.format(self.hdd_unit_price.normalize()),
'{}% VAT'.format(self.vat_percentage.normalize())
if not self.vat_inclusive else 'VAT-Incl',
])
if self.discount_amount:
display_str = ' - '.join([
display_str,
'{} {}'.format(
self.discount_amount,
self.discount_name if self.discount_name else 'Discount'
)
])
return display_str
@classmethod
def get_vm_pricing_by_name(cls, name):
try:
pricing = VMPricing.objects.get(name=name)
except Exception as e:
logger.error(
"Error getting VMPricing with name {name}. "
"Details: {details}. Attempting to return default"
"pricing.".format(name=name, details=str(e))
)
pricing = VMPricing.get_default_pricing()
return pricing
@classmethod
def get_default_pricing(cls):
""" Returns the default pricing or None """
try:
default_pricing = VMPricing.objects.get(name='default')
except Exception as e:
logger.error(str(e))
default_pricing = None
return default_pricing
class StripePlan(models.Model): class StripePlan(models.Model):
""" """
A model to store Data Center Light's created Stripe plans A model to store Data Center Light's created Stripe plans

View file

@ -1,7 +1,7 @@
body, body,
html { html {
width: 100%; width: 100%;
height: 100%; min-height: 100%;
} }
body, body,
@ -74,20 +74,6 @@ a.list-group-item-danger.active:focus {
padding: 10px; padding: 10px;
} }
.navbar-brand > img {
height: 100%;
}
#logoWhite,
.navbar-transparent #logoBlack {
display: none;
}
#logoBlack,
.navbar-transparent #logoWhite {
display: block;
}
@media (min-width: 768px) { @media (min-width: 768px) {
.navbar-right { .navbar-right {
margin-right: 10px; margin-right: 10px;
@ -98,91 +84,15 @@ a.list-group-item-danger.active:focus {
} }
} }
.navbar .dcl-link {
display: block;
padding: 15px;
color: #777;
}
.navbar .dcl-link:focus,
.navbar .dcl-link:active,
.navbar .dcl-link:hover {
text-decoration: none;
}
.navbar .dropdown-menu .dcl-link {
padding: 1px 10px;
}
p.copyright { p.copyright {
margin: 0; margin: 15px 0 0;
} }
footer { footer {
font-weight: 300; padding: 20px 0;
padding: 25px 0;
background-color: #f8f8f8; background-color: #f8f8f8;
} }
footer .list-inline {
margin-bottom: 15px;
}
footer a { footer a {
color: #777; color: #777;
} }
footer .dcl-link-separator {
position: relative;
padding-left: 10px;
}
footer .dcl-link-separator::before {
content: "";
position: absolute;
display: inline-block;
top: 9px;
bottom: 0;
left: -2px;
right: 0;
width: 2px;
height: 2px;
border-radius: 100%;
background: #777;
}
.mb-0 {
margin-bottom: 0;
}
.thin-hr {
margin-top: 10px;
margin-bottom: 10px;
}
.payment-container .credit-card-info {
padding-bottom: 15px;
border-bottom: 1px solid #eee;
}
.credit-card-info {
display: flex;
}
.credit-card-info .align-bottom {
align-self: flex-end;
padding-right: 0 !important;
}
.new-card-head {
margin-top: 10px;
}
.new-card-button-margin button{
margin-top: 5px;
margin-bottom: 5px;
}
.input-no-border {
border: none !important;
background: transparent !important;
resize: none;
}

View file

@ -55,7 +55,7 @@
flex: 1; flex: 1;
} }
.header_slider > .carousel .item .container-fluid { .header_slider > .carousel .item .container {
overflow: auto; overflow: auto;
padding: 50px 20px 60px; padding: 50px 20px 60px;
height: 100%; height: 100%;
@ -104,9 +104,9 @@
.header_slider .carousel-control .fa { .header_slider .carousel-control .fa {
font-size: 4em; font-size: 4em;
} }
.header_slider > .carousel .item .container-fluid { .header_slider > .carousel .item .container {
overflow: auto; overflow: auto;
padding: 75px; padding: 75px 50px;
} }
.header_slider .btn-trans { .header_slider .btn-trans {
padding: 8px 15px; padding: 8px 15px;

View file

@ -1,12 +1,3 @@
.navbar-transparent #logoWhite {
display: none;
}
.navbar-transparent #logoBlack {
display: block;
width: 220px;
}
.topnav .navbar-fixed-top .navbar-collapse { .topnav .navbar-fixed-top .navbar-collapse {
max-height: 740px; max-height: 740px;
} }
@ -24,8 +15,8 @@
} }
@media(min-width: 768px) { @media(min-width: 768px) {
.navbar-default .navbar-nav>li a, .navbar-default .navbar-nav>li>a,
.navbar-right .highlights-dropdown .dropdown-menu>li a { .navbar-right .highlights-dropdown .dropdown-menu>li>a {
font-weight: 300; font-weight: 300;
} }
.navbar-right .highlights-dropdown .dropdown-menu { .navbar-right .highlights-dropdown .dropdown-menu {
@ -35,7 +26,7 @@
} }
} }
.navbar-right .highlights-dropdown .dropdown-menu>li a { .navbar-right .highlights-dropdown .dropdown-menu>li>a {
font-size: 13px; font-size: 13px;
font-family: 'Lato', sans-serif; font-family: 'Lato', sans-serif;
padding: 1px 10px 1px 18px !important; padding: 1px 10px 1px 18px !important;
@ -43,9 +34,9 @@
color: #333; color: #333;
} }
.navbar-right .highlights-dropdown .dropdown-menu>li a:hover, .navbar-right .highlights-dropdown .dropdown-menu>li>a:hover,
.navbar-right .highlights-dropdown .dropdown-menu>li a:focus, .navbar-right .highlights-dropdown .dropdown-menu>li>a:focus,
.navbar-right .highlights-dropdown .dropdown-menu>li a:active { .navbar-right .highlights-dropdown .dropdown-menu>li>a:active {
background: transparent; background: transparent;
text-decoration: underline !important; text-decoration: underline !important;
} }
@ -153,9 +144,9 @@
} }
@media (max-width: 767px) { @media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu>.active a, .navbar-default .navbar-nav .open .dropdown-menu>.active>a,
.navbar-default .navbar-nav .open .dropdown-menu>.active a:focus, .navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,
.navbar-default .navbar-nav .open .dropdown-menu>.active a:hover { .navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover {
background-color: transparent; background-color: transparent;
} }
} }
@ -172,7 +163,7 @@
} }
.content-dashboard { .content-dashboard {
min-height: calc(100vh - 96px); min-height: calc(100vh - 60px);
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
max-width: 1120px; max-width: 1120px;
@ -482,7 +473,6 @@
margin: 100px auto 40px; margin: 100px auto 40px;
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 30px 30px 20px; padding: 30px 30px 20px;
color: #595959;
} }
.order-detail-container .dashboard-title-thin { .order-detail-container .dashboard-title-thin {
@ -504,6 +494,10 @@
margin-bottom: 15px; margin-bottom: 15px;
} }
.order-detail-container .order-details strong {
color: #595959;
}
.order-detail-container h4 { .order-detail-container h4 {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
@ -512,28 +506,13 @@
.order-detail-container p { .order-detail-container p {
margin-bottom: 5px; margin-bottom: 5px;
color: #595959;
} }
.order-detail-container hr { .order-detail-container hr {
margin: 15px 0; margin: 15px 0;
} }
.order-detail-container .thin-hr {
margin: 10px 0;
}
.order-detail-container .subtotal-price {
font-size: 16px;
}
.order-detail-container .subtotal-price .text-primary {
font-size: 17px;
}
.order-detail-container .total-price {
font-size: 18px;
}
@media (max-width: 767px) { @media (max-width: 767px) {
.order-detail-container { .order-detail-container {
padding: 15px; padding: 15px;

View file

@ -58,16 +58,6 @@ textarea {
min-width: 180px; min-width: 180px;
} }
.lead {
font-size: 18px;
}
@media (min-width: 768px) {
.lead {
font-size: 21px;
}
}
/* Top navbar */ /* Top navbar */
@ -89,19 +79,25 @@ textarea {
border-radius: 6px; border-radius: 6px;
} }
.navbar-brand > img {
max-height: 30px;
}
@media (max-width: 767px) { @media (max-width: 767px) {
.navbar-default .navbar-nav>li>a{ .navbar-default .navbar-nav>li>a{
font-weight: 400; font-weight: 400;
} }
} }
.navbar-transparent .navbar-nav>li a,
.navbar-transparent .navbar-nav>.open>a, .navbar-transparent .navbar-nav>.open>a,
.navbar-transparent .navbar-nav>.open>a:focus, .navbar-transparent .navbar-nav>.open>a:focus,
.navbar-transparent .navbar-nav>.open>a:hover { .navbar-transparent .navbar-nav>.open>a:hover {
color: #fff; color: #fff;
} }
.navbar-transparent .navbar-nav>li a {
color: #fff;
}
.navbar-transparent .navbar-nav>li a:focus, .navbar-transparent .navbar-nav>li a:focus,
.navbar-transparent .navbar-nav>li a:active, .navbar-transparent .navbar-nav>li a:active,
@ -111,10 +107,20 @@ textarea {
text-decoration: none; text-decoration: none;
} }
.topnav .nav .open>a, .navbar .dcl-link {
.topnav .nav .open>a:focus, display: block;
.topnav .nav .open>a:hover { padding: 15px;
background: transparent; color: #777;
}
.navbar .dcl-link:focus,
.navbar .dcl-link:active,
.navbar .dcl-link:hover {
text-decoration: none;
}
.navbar .dropdown-menu .dcl-link {
padding: 1px 10px;
} }
.navbar-transparent .navbar-nav>li>.on-hover-border { .navbar-transparent .navbar-nav>li>.on-hover-border {
@ -137,6 +143,17 @@ textarea {
color: #fff; color: #fff;
} }
#logoWhite,
.navbar-transparent #logoBlack {
display: none;
}
#logoBlack,
.navbar-transparent #logoWhite {
display: block;
width: 220px;
}
.nav-language { .nav-language {
position: relative; position: relative;
} }
@ -412,20 +429,17 @@ textarea {
} }
.split-section.left .split-description { .split-section.left .split-description {
/* width: 90%; */
margin-right: auto; margin-right: auto;
} }
.split-section .split-description .lead { .split-section .split-description .lead {
color: #3a3a3a; color: #3a3a3a;
font-size: 21px;
} }
@media (min-width: 768px) { .split-section .space .split-description .lead {
.split-section .split-description .lead { font-size: 20px;
font-size: 21px;
}
.split-section .space .split-description .lead {
font-size: 20px;
}
} }
.split-section.right .split-description { .split-section.right .split-description {
@ -503,14 +517,14 @@ textarea {
.split-section-plain .split-figure { .split-section-plain .split-figure {
width: 41.66666667%; width: 41.66666667%;
} }
.split-section-plain .split-figure.col-sm-pull-6 { .split-section-plain .split-figure.col-sm-push-6 {
right: 58.33333333%; left: 58.33333333%;
} }
.split-section-plain .split-text { .split-section-plain .split-text {
width: 58.33333333%; width: 58.33333333%;
} }
.split-section-plain .split-text.col-sm-push-6 { .split-section-plain .split-text.col-sm-pull-6 {
left: 41.66666667%; right: 41.66666667%;
} }
} }
@ -751,11 +765,17 @@ textarea {
.ssdimg { .ssdimg {
margin: 0 15px; margin: 0 15px;
/* vertical-align: middle; */
/* display: inline-block; */
}
.ssdimg img {
max-width: 125px;
} }
@media (max-width: 767px) { @media (max-width: 767px) {
.ssdimg img { .ssdimg img {
max-height: 120px; width: 100px;
} }
} }
@ -776,7 +796,7 @@ textarea {
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
background: #fff; background: #fff;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 0 6px rgba(0, 0, 0, 0.15); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
padding-bottom: 40px; padding-bottom: 40px;
border-radius: 7px; border-radius: 7px;
text-align: center; text-align: center;
@ -929,7 +949,7 @@ textarea {
} }
@media(max-width:767px) { @media(max-width:991px) {
.section-sm-center .split-text, .section-sm-center .split-text,
.section-sm-center .space { .section-sm-center .space {
text-align: center !important; text-align: center !important;
@ -1037,8 +1057,8 @@ textarea {
line-height: 35px; line-height: 35px;
} }
.split-section .split-title h2 { .split-section .split-title h2 {
font-size: 32px; font-size: 35px;
line-height: 34px; line-height: 35px;
} }
.contact-section .title { .contact-section .title {
margin: 0 auto; margin: 0 auto;
@ -1171,7 +1191,7 @@ footer {
max-width: 430px; max-width: 430px;
} }
.flex-row-rev .desc-text { .flex-row-rev .desc-text {
max-width: 600px; max-width: 710px;
text-align: left; text-align: left;
} }
.flex-row-rev .percent-text { .flex-row-rev .percent-text {
@ -1200,6 +1220,24 @@ footer {
transform: rotate(45deg); transform: rotate(45deg);
} }
footer .dcl-link-separator {
position: relative;
padding-left: 10px;
}
footer .dcl-link-separator::before {
content: "";
position: absolute;
display: inline-block;
top: 9px;
bottom: 0;
left: -2px;
right: 0;
width: 2px;
height: 2px;
border-radius: 100%;
background: #777;
}
/* new styles for whydcl section cms plugin (to replace older style) */ /* new styles for whydcl section cms plugin (to replace older style) */
@ -1217,88 +1255,3 @@ footer {
font-size: 30px; font-size: 30px;
} }
} }
/* cms section promo */
.promo-section {
padding: 75px 15px;
}
.promo-section.promo-with-bg {
color: #fff;
background-size: cover;
background-position: center;
}
.promo-section.promo-with-bg a {
color: #87B6EA;
}
.promo-section.promo-with-bg a:hover,
.promo-section.promo-with-bg a:focus {
color: #77a6da;
}
.promo-section h3 {
font-weight: 700;
font-size: 36px;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-top: 10px;
margin-bottom: 25px;
}
.promo-section h4 {
font-size: 24px;
margin-bottom: 20px;
}
.promo-section p {
font-size: 18px;
line-height: 1.5;
}
.promo-section.text-center p {
max-width: 720px;
margin: auto;
}
.promo-section.text-center h3,
.promo-section.text-center h4 {
margin-bottom: 35px;
}
.split-text .split-subsection {
margin-top: 25px;
margin-bottom: 25px;
}
.split-text .promo-section {
padding: 20px 15px;
margin-top: 30px;
margin-bottom: 30px;
}
.split-text .promo-section .container {
width: auto;
}
.split-text .promo-section h3,
.split-text .promo-section h4 {
margin-bottom: 15px;
}
@media (max-width: 767px) {
.split-text .split-subsection {
margin-left: -15px;
margin-right: -15px;
}
.promo-section h3 {
font-size: 29px;
}
.split-text .promo-section {
padding-left: 0;
padding-right: 0;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5 KiB

Before After
Before After

View file

@ -5,10 +5,6 @@
/* --------------------------------------------- /* ---------------------------------------------
Scripts initialization Scripts initialization
--------------------------------------------- */ --------------------------------------------- */
var minRam = 1;
if(window.minRam){
minRam = window.minRam;
}
var cardPricing = { var cardPricing = {
'cpu': { 'cpu': {
'id': 'coreValue', 'id': 'coreValue',
@ -20,7 +16,7 @@
'ram': { 'ram': {
'id': 'ramValue', 'id': 'ramValue',
'value': 2, 'value': 2,
'min': minRam, 'min': 1,
'max': 200, 'max': 200,
'interval': 1 'interval': 1
}, },
@ -44,7 +40,6 @@
_initNavUrl(); _initNavUrl();
_initPricing(); _initPricing();
ajaxForms(); ajaxForms();
$('#ramValue').data('old-value', $('#ramValue').val());
}); });
$(window).resize(function() { $(window).resize(function() {
@ -109,33 +104,21 @@
}); });
$('.url').click(function(event) { $('.url').click(function(event) {
event.preventDefault(); event.preventDefault();
var $this = $(this); var href = $(this).attr('href');
var href = $this.attr('href');
$('.navbar-collapse').removeClass('in'); $('.navbar-collapse').removeClass('in');
$('.navbar-collapse').addClass('collapsing'); $('.navbar-collapse').addClass('collapsing');
if (href[0] === "#") { if (href[0] === "#") {
scrollToElement(href); if ($(href).length) {
} else if (href) { $('html, body').animate({
var path = $(this).prop('href').split('#'); scrollTop: $(href).offset().top - 50
var currentPath = window.location.origin + window.location.pathname; }, 1000);
if (currentPath == path[0] && path[1]) {
scrollToElement('#' + path[1]);
} else {
window.location = href;
} }
} else if (href) {
window.location = href;
} }
}); });
} }
function scrollToElement(el) {
var $el = $(el);
if ($el.length) {
$('html, body').animate({
scrollTop: $el.offset().top - 50
}, 1000);
}
}
function verifiedUrl() { function verifiedUrl() {
if (window.location.href.indexOf('#success') > -1) { if (window.location.href.indexOf('#success') > -1) {
form_success(); form_success();
@ -149,54 +132,21 @@
var data = $(this).data('minus'); var data = $(this).data('minus');
if (cardPricing[data].value > cardPricing[data].min) { if (cardPricing[data].value > cardPricing[data].min) {
if(data === 'ram' && String(cardPricing[data].value) === "1" && minRam === 0.5){ cardPricing[data].value = Number(cardPricing[data].value) - cardPricing[data].interval;
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(); _fetchPricing();
$('#ramValue').data('old-value', $('#ramValue').val());
}); });
$('.fa-plus-circle.right').click(function(event) { $('.fa-plus-circle.right').click(function(event) {
var data = $(this).data('plus'); var data = $(this).data('plus');
if (cardPricing[data].value < cardPricing[data].max) { if (cardPricing[data].value < cardPricing[data].max) {
if(data === 'ram' && String(cardPricing[data].value) === "0.5" && minRam === 0.5){ cardPricing[data].value = Number(cardPricing[data].value) + cardPricing[data].interval;
cardPricing[data].value = 1;
$('#ramValue').val('1');
$("#ramValue").attr('step', 1);
} else {
cardPricing[data].value = Number(cardPricing[data].value) + cardPricing[data].interval;
}
} }
_fetchPricing(); _fetchPricing();
$('#ramValue').data('old-value', $('#ramValue').val());
}); });
$('.input-price').change(function() { $('.input-price').change(function() {
var data = $(this).attr("name"); var data = $(this).attr("name");
var input = $('input[name=' + data + ']'); cardPricing[data].value = $('input[name=' + data + ']').val();
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(); _fetchPricing();
}); });
} }
@ -209,22 +159,7 @@
} }
function _calcPricing() { function _calcPricing() {
if(typeof window.coresUnitPrice === 'undefined'){ var total = (cardPricing['cpu'].value * 5) + (2 * cardPricing['ram'].value) + (0.6 * cardPricing['storage'].value);
window.coresUnitPrice = 5;
}
if(typeof window.ramUnitPrice === 'undefined'){
window.ramUnitPrice = 2;
}
if(typeof window.ssdUnitPrice === 'undefined'){
window.ssdUnitPrice = 0.6;
}
if(typeof window.discountAmount === 'undefined'){
window.discountAmount = 0;
}
var total = (cardPricing['cpu'].value * window.coresUnitPrice) +
(cardPricing['ram'].value * window.ramUnitPrice) +
(cardPricing['storage'].value * window.ssdUnitPrice) -
window.discountAmount;
total = parseFloat(total.toFixed(2)); total = parseFloat(total.toFixed(2));
$("#total").text(total); $("#total").text(total);
} }

View file

@ -1,26 +1,23 @@
from datetime import datetime from datetime import datetime
from celery import current_task
from celery.exceptions import MaxRetriesExceededError from celery.exceptions import MaxRetriesExceededError
from celery.utils.log import get_task_logger from celery.utils.log import get_task_logger
from celery import current_task
from django.conf import settings from django.conf import settings
from django.core.mail import EmailMessage from django.core.mail import EmailMessage
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils import translation from django.utils import translation
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from time import sleep
from dynamicweb.celery import app from dynamicweb.celery import app
from hosting.models import HostingOrder from hosting.models import HostingOrder, HostingBill
from membership.models import CustomUser from membership.models import StripeCustomer, CustomUser
from opennebula_api.models import OpenNebulaManager from opennebula_api.models import OpenNebulaManager
from opennebula_api.serializers import VirtualMachineSerializer from opennebula_api.serializers import VirtualMachineSerializer
from utils.hosting_utils import ( from utils.hosting_utils import get_all_public_keys, get_or_create_vm_detail
get_all_public_keys, get_or_create_vm_detail, ping_ok from utils.forms import UserBillingAddressForm
)
from utils.mailer import BaseEmail from utils.mailer import BaseEmail
from utils.stripe_utils import StripeUtils from utils.models import BillingAddress
from .models import VMPricing
logger = get_task_logger(__name__) logger = get_task_logger(__name__)
@ -52,15 +49,23 @@ def retry_task(task, exception=None):
@app.task(bind=True, max_retries=settings.CELERY_MAX_RETRIES) @app.task(bind=True, max_retries=settings.CELERY_MAX_RETRIES)
def create_vm_task(self, vm_template_id, user, specs, template, order_id): def create_vm_task(self, vm_template_id, user, specs, template,
stripe_customer_id, billing_address_data,
stripe_subscription_id, cc_details):
logger.debug( logger.debug(
"Running create_vm_task on {}".format(current_task.request.hostname)) "Running create_vm_task on {}".format(current_task.request.hostname))
vm_id = None vm_id = None
try: try:
final_price = ( final_price = specs.get('price')
specs.get('total_price') if 'total_price' in specs billing_address = BillingAddress(
else specs.get('price') cardholder_name=billing_address_data['cardholder_name'],
street_address=billing_address_data['street_address'],
city=billing_address_data['city'],
postal_code=billing_address_data['postal_code'],
country=billing_address_data['country']
) )
billing_address.save()
customer = StripeCustomer.objects.filter(id=stripe_customer_id).first()
if 'pass' in user: if 'pass' in user:
on_user = user.get('email') on_user = user.get('email')
@ -89,43 +94,33 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id):
if vm_id is None: if vm_id is None:
raise Exception("Could not create VM") raise Exception("Could not create VM")
# Update HostingOrder with the created vm_id # Create a Hosting Order
hosting_order = HostingOrder.objects.filter(id=order_id).first() order = HostingOrder.create(
error_msg = None price=final_price,
vm_id=vm_id,
try: customer=customer,
hosting_order.vm_id = vm_id billing_address=billing_address
hosting_order.save()
logger.debug(
"Updated hosting_order {} with vm_id={}".format(
hosting_order.id, vm_id
)
)
except Exception as ex:
error_msg = (
"HostingOrder with id {order_id} not found. This means that "
"the hosting order was not created and/or it is/was not "
"associated with VM with id {vm_id}. Details {details}".format(
order_id=order_id, vm_id=vm_id, details=str(ex)
)
)
logger.error(error_msg)
stripe_utils = StripeUtils()
result = stripe_utils.set_subscription_metadata(
subscription_id=hosting_order.subscription_id,
metadata={"VM_ID": str(vm_id)}
) )
if result.get('error') is not None: # Create a Hosting Bill
emsg = "Could not update subscription metadata for {sub}".format( HostingBill.create(
sub=hosting_order.subscription_id customer=customer, billing_address=billing_address)
)
logger.error(emsg) # Create Billing Address for User if he does not have one
if error_msg: if not customer.user.billing_addresses.count():
error_msg += ". " + emsg billing_address_data.update({
else: 'user': customer.user.id
error_msg = emsg })
billing_address_user_form = UserBillingAddressForm(
billing_address_data)
billing_address_user_form.is_valid()
billing_address_user_form.save()
# Associate an order with a stripe subscription
order.set_subscription_id(stripe_subscription_id, cc_details)
# If the Stripe payment succeeds, set order status approved
order.set_approved()
vm = VirtualMachineSerializer(manager.get_vm(vm_id)).data vm = VirtualMachineSerializer(manager.get_vm(vm_id)).data
@ -135,19 +130,12 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id):
'cores': specs.get('cpu'), 'cores': specs.get('cpu'),
'memory': specs.get('memory'), 'memory': specs.get('memory'),
'storage': specs.get('disk_size'), 'storage': specs.get('disk_size'),
'price': final_price, 'price': specs.get('price'),
'template': template.get('name'), 'template': template.get('name'),
'vm_name': vm.get('name'), 'vm_name': vm.get('name'),
'vm_id': vm['vm_id'], 'vm_id': vm['vm_id'],
'order_id': order_id 'order_id': order.id
} }
if error_msg:
context['errors'] = error_msg
if 'pricing_name' in specs:
context['pricing'] = str(VMPricing.get_vm_pricing_by_name(
name=specs['pricing_name']
))
email_data = { email_data = {
'subject': settings.DCL_TEXT + " Order from %s" % context['email'], 'subject': settings.DCL_TEXT + " Order from %s" % context['email'],
'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS,
@ -171,7 +159,7 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id):
'base_url': "{0}://{1}".format(user.get('request_scheme'), 'base_url': "{0}://{1}".format(user.get('request_scheme'),
user.get('request_host')), user.get('request_host')),
'order_url': reverse('hosting:orders', 'order_url': reverse('hosting:orders',
kwargs={'pk': order_id}), kwargs={'pk': order.id}),
'page_header': _( 'page_header': _(
'Your New VM %(vm_name)s at Data Center Light') % { 'Your New VM %(vm_name)s at Data Center Light') % {
'vm_name': vm.get('name')}, 'vm_name': vm.get('name')},
@ -188,11 +176,11 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id):
email = BaseEmail(**email_data) email = BaseEmail(**email_data)
email.send() email.send()
# try to see if we have the IPv6 of the new vm and that if the ssh # try to see if we have the IP and that if the ssh keys can
# keys can be configured # be configured
vm_ipv6 = manager.get_ipv6(vm_id) new_host = manager.get_primary_ipv4(vm_id)
logger.debug("New VM ID is {vm_id}".format(vm_id=vm_id)) logger.debug("New VM ID is {vm_id}".format(vm_id=vm_id))
if vm_ipv6 is not None: if new_host is not None:
custom_user = CustomUser.objects.get(email=user.get('email')) custom_user = CustomUser.objects.get(email=user.get('email'))
get_or_create_vm_detail(custom_user, manager, vm_id) get_or_create_vm_detail(custom_user, manager, vm_id)
if custom_user is not None: if custom_user is not None:
@ -203,48 +191,13 @@ def create_vm_task(self, vm_template_id, user, specs, template, order_id):
logger.debug( logger.debug(
"Calling configure on {host} for " "Calling configure on {host} for "
"{num_keys} keys".format( "{num_keys} keys".format(
host=vm_ipv6, num_keys=len(keys) host=new_host, num_keys=len(keys)))
) # Let's delay the task by 75 seconds to be sure
) # that we run the cdist configure after the host
# Let's wait until the IP responds to ping before we # is up
# run the cdist configure on the host manager.manage_public_key(keys,
did_manage_public_key = False hosts=[new_host],
for i in range(0, 15): countdown=75)
if ping_ok(vm_ipv6):
logger.debug(
"{} is pingable. Doing a "
"manage_public_key".format(vm_ipv6)
)
sleep(10)
manager.manage_public_key(
keys, hosts=[vm_ipv6]
)
did_manage_public_key = True
break
else:
logger.debug(
"Can't ping {}. Wait 5 secs".format(
vm_ipv6
)
)
sleep(5)
if not did_manage_public_key:
emsg = ("Waited for over 75 seconds for {} to be "
"pingable. But the VM was not reachable. "
"So, gave up manage_public_key. Please do "
"this manually".format(vm_ipv6))
logger.error(emsg)
email_data = {
'subject': '{} CELERY TASK INCOMPLETE: {} not '
'pingable for 75 seconds'.format(
settings.DCL_TEXT, vm_ipv6
),
'from_email': current_task.request.hostname,
'to': settings.DCL_ERROR_EMAILS_TO_LIST,
'body': emsg
}
email = EmailMessage(**email_data)
email.send()
except Exception as e: except Exception as e:
logger.error(str(e)) logger.error(str(e))
try: try:

View file

@ -9,7 +9,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Data Center Light by ungleich"> <meta name="description" content="Data Center Light by ungleich">
<meta name="author" content="ungleich glarus ag"> <meta name="author" content="ungleich GmbH">
<title>Data Center Light - {% block title %}VM hosting made in Switzerland{% endblock %}</title> <title>Data Center Light - {% block title %}VM hosting made in Switzerland{% endblock %}</title>
<!-- Vendor CSS --> <!-- Vendor CSS -->

View file

@ -1,4 +1,4 @@
{% load staticfiles i18n cms_tags sekizai_tags %} {% load staticfiles i18n %}
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html> <!DOCTYPE html>
@ -9,7 +9,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Data Center Light by ungleich"> <meta name="description" content="Data Center Light by ungleich">
<meta name="author" content="ungleich glarus ag"> <meta name="author" content="ungleich GmbH">
<title>Data Center Light - {% block title %}VM hosting made in Switzerland{% endblock %}</title> <title>Data Center Light - {% block title %}VM hosting made in Switzerland{% endblock %}</title>
@ -23,15 +23,9 @@
<!-- Custom CSS --> <!-- Custom CSS -->
<link href="{% static 'datacenterlight/css/common.css' %}" rel="stylesheet"> <link href="{% static 'datacenterlight/css/common.css' %}" rel="stylesheet">
<link href="{% static 'datacenterlight/css/hosting.css' %}" rel="stylesheet"> <link href="{% static 'datacenterlight/css/hosting.css' %}" rel="stylesheet">
{% if request.toolbar.edit_mode %}
<link href="{% static 'datacenterlight/css/cms.css' %}" rel="stylesheet">
{% endif %}
{% block css_extra %} {% block css_extra %}
{% endblock css_extra %} {% endblock css_extra %}
{% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %}
{% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %}
<!-- External Fonts --> <!-- External Fonts -->
<link rel="shortcut icon" href="{% static 'datacenterlight/img/favicon.ico' %}" type="image/x-icon"> <link rel="shortcut icon" href="{% static 'datacenterlight/img/favicon.ico' %}" type="image/x-icon">
@ -49,17 +43,28 @@
</head> </head>
<body> <body>
{% cms_toolbar %}
{% render_placeholder cms_integration.navbar_placeholder %} {% block navbar %}
{% include "hosting/includes/_navbar_user.html" %}
{% endblock navbar %}
<div class="{% if request.user.is_authenticated %}content-dashboard{% endif %}"> <div class="{% if request.user.is_authenticated %}content-dashboard{% endif %}">
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>
{% render_placeholder cms_integration.footer_placeholder %} <!-- Footer -->
{% if request.user.is_authenticated %}
<footer class="footer-vm">
<div class="container">
<p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. {% trans "All Rights Reserved" %}</p>
</div>
</footer>
{% else %}
<div class="footer-vm">
{% include "datacenterlight/includes/_footer.html" %}
</div>
{% endif %}
<!-- Moment --> <!-- Moment -->
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>

View file

@ -8,9 +8,9 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="ungleich glarus ag"> <meta name="description" content="Data Center Light by ungleich">
<meta name="description" content="{% page_attribute 'meta_description' %}"> <meta name="author" content="ungleich GmbH">
<title>{% page_attribute "page_title" %}</title> <title>{% page_attribute page_title %}</title>
<!-- Vendor CSS --> <!-- Vendor CSS -->
<!-- Bootstrap Core CSS --> <!-- Bootstrap Core CSS -->
@ -30,11 +30,7 @@
<!-- External Fonts --> <!-- External Fonts -->
<link href="//fonts.googleapis.com/css?family=Lato:300,400,600,700" rel="stylesheet" type="text/css"> <link href="//fonts.googleapis.com/css?family=Lato:300,400,600,700" rel="stylesheet" type="text/css">
{% if request.current_page.cmsfaviconextension %} <link rel="shortcut icon" href="{% static 'datacenterlight/img/favicon.ico' %}" type="image/x-icon">
<link rel="shortcut icon" href="{% static request.current_page.cmsfaviconextension.favicon.url %}" type="image/x-icon">
{% else %}
<link rel="shortcut icon" href="{% static 'datacenterlight/img/favicon.ico' %}" type="image/x-icon">
{% endif %}
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
@ -56,12 +52,11 @@
{% placeholder 'Datacenterlight Header' or %} {% placeholder 'Datacenterlight Header' or %}
<div class="dcl-header"> <div class="dcl-header">
<div class="container"> <div class="container">
<h1>{% page_attribute "page_title" %}</h1> <h1>{% page_attribute page_title %}</h1>
</div> </div>
</div> </div>
{% endplaceholder %} {% endplaceholder %}
{% url 'datacenterlight:index' as calculator_form_url %}
{% placeholder 'Datacenterlight Content' %} {% placeholder 'Datacenterlight Content' %}
{% placeholder 'datacenterlight_footer'%} {% placeholder 'datacenterlight_footer'%}

View file

@ -1,5 +1,29 @@
<div class="price-calc-section"> <div class="split-section {{ instance.get_extra_classes }}" id="{{ instance.html_id }}">
<div class="card"> <div class="container">
{% include "datacenterlight/includes/_calculator_form.html" with vm_pricing=instance.pricing %} <div class="row">
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-push-6{% endif %}">
<div class="split-text">
{% if instance.heading %}
<div class="{% if not instance.plain_heading %}split-title{% endif %}">
<h2>{{ instance.heading }}</h2>
</div>
{% endif %}
{% if instance.content %}
<div class="split-description">
<div class="lead">
{{ instance.content }}
</div>
</div>
{% endif %}
</div>
</div>
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-pull-6{% endif %}">
<div class="price-calc-section">
<div class="card">
{% include "datacenterlight/includes/_calculator_form.html" %}
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>

View file

@ -1,11 +1,11 @@
<div id="contact" class="full-contact-section"> <div id="{{ instance.id }}" class="full-contact-section">
<div class="intro-header-2 contact-section"> <div class="intro-header-2 contact-section">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
{% if instance.heading%} {% if instance.contact_text %}
<div class="title"> <div class="title">
<h2>{{ instance.heading}}</h2> <h2>{{ instance.contact_text }}</h2>
</div> </div>
{% endif %} {% endif %}
<div class="contact-details"> <div class="contact-details">
@ -40,4 +40,4 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,21 +0,0 @@
{% load cms_tags %}
{% if instance.heading %}
<div class="{% if not instance.plain_heading %}split-title{% else %}split-title-plain{% endif %}">
<h2>{{ instance.heading }}</h2>
</div>
{% endif %}
{% if instance.content %}
<div class="split-description">
<div class="lead">
{{ instance.content }}
</div>
</div>
{% endif %}
{% if children_to_content|length %}
<div class="split-subsection">
{% for plugin in children_to_content %}
{% render_plugin plugin %}
{% endfor %}
</div>
{% endif %}

View file

@ -10,12 +10,13 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
{% url 'datacenterlight:index' as default_logo_url %}
{% if instance.logo_dark or instance.logo_light %} {% if instance.logo_dark or instance.logo_light %}
<a href="{{ instance.logo_url|default:'/' }}" id="logoBlack" class="navbar-brand"><img src="{{ instance.get_logo_dark }}"></a> <a href="{{ instance.logo_url|default:default_logo_url }}" id="logoBlack" class="navbar-brand topnav"><img src="{{ instance.get_logo_dark }}"></a>
<a href="{{ instance.logo_url|default:'/' }}" id="logoWhite" class="navbar-brand"><img src="{{ instance.get_logo_light }}"></a> <a href="{{ instance.logo_url|default:default_logo_url }}" id="logoWhite" class="navbar-brand topnav"><img src="{{ instance.get_logo_light }}"></a>
{% else %} {% else %}
<a href="/" id="logoBlack" class="navbar-brand"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a> <a href="{{ default_logo_url }}" id="logoBlack" class="navbar-brand topnav"><img src="{% static 'datacenterlight/img/logo_black.svg' %}"></a>
<a href="/" id="logoWhite" class="navbar-brand"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a> <a href="{{ default_logo_url }}" id="logoWhite" class="navbar-brand topnav"><img src="{% static 'datacenterlight/img/logo_white.svg' %}"></a>
{% endif %} {% endif %}
</div> </div>
<div class="collapse navbar-collapse" id="dcl-topnav"> <div class="collapse navbar-collapse" id="dcl-topnav">
@ -26,25 +27,21 @@
{% render_plugin plugin %} {% render_plugin plugin %}
</li> </li>
{% endfor %} {% endfor %}
{% if instance.language_dropdown %} <li>
<li> {% if LANGUAGE_CODE == 'en-us'%}
{% if LANGUAGE_CODE == 'en-us'%} <a class="on-hover-border" href="{% change_lang 'de' %}">Deutsch&nbsp;&nbsp;<i class="fa fa-globe" aria-hidden="true"></i></a>
<a class="on-hover-border" href="{% change_lang 'de' %}">Deutsch&nbsp;&nbsp;<i class="fa fa-globe" aria-hidden="true"></i></a>
{% else %}
<a class="on-hover-border" href="{% change_lang 'en-us' %}">English&nbsp;&nbsp;<i class="fa fa-globe" aria-hidden="true"></i></a>
{% endif %}
</li>
{% endif %}
{% if instance.show_login_option %}
{% if not request.user.is_authenticated %}
<li>
<a href="{% url 'hosting:login' %}">{% trans "Login" %}&nbsp;&nbsp;<span class="fa fa-sign-in"></span></a>
</li>
{% else %} {% else %}
<li> <a class="on-hover-border" href="{% change_lang 'en-us' %}">English&nbsp;&nbsp;<i class="fa fa-globe" aria-hidden="true"></i></a>
<a href="{% url 'hosting:dashboard' %}">{% trans "Dashboard" %}</a>
</li>
{% endif %} {% endif %}
</li>
{% if not request.user.is_authenticated %}
<li>
<a href="{% url 'hosting:login' %}">{% trans "Login" %}&nbsp;&nbsp;<span class="fa fa-sign-in"></span></a>
</li>
{% else %}
<li>
<a href="{% url 'hosting:dashboard' %}">{% trans "Dashboard" %}</a>
</li>
{% endif %} {% endif %}
{% comment %} {% comment %}
<!-- to be used when more than one option for language --> <!-- to be used when more than one option for language -->

View file

@ -1,10 +1,10 @@
{% load cms_tags %} {% load cms_tags %}
<div class="dropdown highlights-dropdown"> <div class="dropdown highlights-dropdown">
<a class="dropdown-toggle url-init dcl-link" href="{{ instance.target|default:'#' }}" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ instance.text }}&nbsp;<span class="caret"></span></a> <a class="dropdown-toggle url-init dcl-link" href="{{ instance.url|default:'#' }}" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ instance.text }}&nbsp;<span class="caret"></span></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% for plugin in instance.child_plugin_instances %} {% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %} {% render_plugin plugin %}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>

View file

@ -1,31 +1,46 @@
{% load cms_tags %} {% load cms_tags %}
<section class="split-section {{ instance.get_extra_classes }}" id="{{ instance.html_id }}"> <div class="split-section {{ instance.get_extra_classes }}" id="{{ instance.html_id }}">
<div class="container"> <div class="container">
{% if children_to_side|length or children_calculator|length %} {% if instance.child_plugin_instances|length %}
<div class="row"> <div class="row">
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-push-6{% endif %} split-text"> <div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-push-6{% endif %} split-text">
{% include "datacenterlight/cms/includes/_section_split_content.html" %} {% if instance.heading %}
</div> <div class="{% if not instance.plain_heading %}split-title{% else %}split-title-plain{% endif %}">
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-pull-6{% endif %} split-figure"> <h2>{{ instance.heading }}</h2>
{% if children_calculator|length %}
{% for plugin in children_calculator %}
{% render_plugin plugin %}
{% endfor %}
{% endif %}
{% if children_to_side %}
<div class="section-figure">
{% for plugin in children_to_side %}
{% render_plugin plugin %}
{% endfor %}
</div> </div>
{% endif %} {% endif %}
{% if instance.content %}
<div class="split-description">
<div class="lead">
{{ instance.content }}
</div>
</div>
{% endif %}
</div>
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-pull-6{% endif %} split-figure">
<div class="section-figure">
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
</div>
</div> </div>
</div> </div>
{% else %} {% else %}
<div class="space"> <div class="space">
{% include "datacenterlight/cms/includes/_section_split_content.html" %} {% if instance.heading %}
<div class="{% if not instance.plain_heading %}split-title{% else %}split-title-plain{% endif %}">
<h2>{{ instance.heading }}</h2>
</div>
{% endif %}
{% if instance.content %}
<div class="split-description">
<div class="lead">
{{ instance.content }}
</div>
</div>
{% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
</section> </div>

View file

@ -1,15 +0,0 @@
{% load custom_tags %}
<section class="promo-section {{instance.get_extra_classes}}" {% if instance.background_image %}style="background-image:url({{ instance.background_image.url }})"{% endif %}>
<div class="container">
{% if instance.heading %}
<h3>{{instance.heading|escaped_line_break|linebreaksbr}}</h3>
{% endif %}
{% if instance.subheading %}
<h4>{{instance.subheading}}</h4>
{% endif %}
{% if instance.content %}
<p>{{instance.content}}</p>
{% endif %}
</div>
</section>

View file

@ -14,7 +14,7 @@
<table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;"> <table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;">
<tr> <tr>
<td> <td>
<img src="{{ base_url }}{% static 'datacenterlight/img/datacenterlight.png' %}" style="max-width: 200px;"> <img src="{{ base_url }}{% static 'datacenterlight/img/logo_black.png' %}" style="width: 200px; height: 50px;">
</td> </td>
</tr> </tr>
<tr> <tr>
@ -33,19 +33,18 @@
<p style="color: #4382c8; line-height: 1.4; font-family: Lato, Arial, sans-serif; font-weight: 300; margin: 0;"> <p style="color: #4382c8; line-height: 1.4; font-family: Lato, Arial, sans-serif; font-weight: 300; margin: 0;">
{{base_url}}{{activation_link}} {{base_url}}{{activation_link}}
</p> </p>
<p>
{% if account_details %} {% if account_details %}
{% url 'hosting:reset_password' as reset_password_url %} {% url 'hosting:reset_password' as reset_password_url %}
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin-bottom: 10px; margin-top: 10px;">
{% trans "Your account details are as follows" %}: {% trans "Your account details are as follows" %}:
</p>
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin-bottom: 10px; margin-top: 0;"> {% trans "Username" %} : {% trans "Your email address" %}
{% trans "Username" %} : {% trans "Your email address" %}<br/>
{% trans "Password" %} : {{account_details}} {% trans "Password" %} : {{account_details}}
</p>
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin-bottom: 0; margin-top: 0;"> {% trans "You can reset your password here" %}:
{% blocktrans %}You can reset your password <a href="{{base_url}}{{reset_password_url}}" style="text-decoration: none; color: #4382c8; font-weight: 400;">here</a>.{% endblocktrans %} {{base_url}}{{reset_password_url}}
</p>
{% endif %} {% endif %}
</p>
</td> </td>
</tr> </tr>
<tr> <tr>

View file

@ -14,7 +14,7 @@
<table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;"> <table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;">
<tr> <tr>
<td> <td>
<img src="{{ base_url }}{% static 'datacenterlight/img/datacenterlight.png' %}" style="max-width: 200px;"> <img src="{{ base_url }}{% static 'datacenterlight/img/logo_black.png' %}" style="width: 200px; height: 50px;">
</td> </td>
</tr> </tr>
<tr> <tr>

View file

@ -1,35 +1,14 @@
{% load staticfiles i18n%} {% load staticfiles i18n%}
<form id="order_form" method="POST" action="{% url 'datacenterlight:index' %}" data-toggle="validator" role="form">
{% if vm_pricing %}
<script type="application/javascript">
window.vat_inclusive = {% if vm_pricing.vat_inclusive %}true{% else %}false{% endif%};
window.vat_percentage = {{vm_pricing.vat_percentage|default:0}};
window.coresUnitPrice = {{vm_pricing.cores_unit_price|default:0}};
window.ramUnitPrice = {{vm_pricing.ram_unit_price|default:0}};
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 %}';
</script>
{% endif %}
<form id="order_form" method="POST" action="{{calculator_form_url}}" data-toggle="validator" role="form">
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="pid" value="{{instance.id}}">
<div class="title"> <div class="title">
<h3>{% trans "VM hosting" %} </h3> <h3>{% trans "VM hosting" %} </h3>
</div> </div>
<div class="price"> <div class="price">
<span id="total"></span> <span id="total">15</span>
<span>CHF/{% trans "month" %}</span> <span>CHF/{% trans "month" %}</span>
<div class="price-text"> <div class="price-text">
<p> <p>{% trans "VAT included" %}</p>
{% if vm_pricing.vat_inclusive %}{% trans "VAT included" %} <br>{% endif %}
{% if vm_pricing.discount_amount %}
{% trans "You save" %} {{ vm_pricing.discount_amount }} CHF
{% endif %}
</p>
</div> </div>
</div> </div>
<div class="descriptions"> <div class="descriptions">
@ -57,8 +36,8 @@
<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="{% if min_ram == 0.5 %}0{% else %}1{% endif %}" max="200" name="ram" <input id="ramValue" class="input-price select-number" type="number" min="1" max="200" name="ram"
data-error="{% blocktrans with min_ram=min_ram %}Please enter a value in range {{min_ram}} - 200.{% endblocktrans %}" required step="1"> data-error="{% trans 'Please enter a value in range 1 - 200.' %}" 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>
@ -94,12 +73,10 @@
<label for="config">OS</label> <label for="config">OS</label>
<select name="config"> <select name="config">
{% for template in templates %} {% for template in templates %}
<option value="{{template.opennebula_vm_template_id}}">{{template.name}}</option>
<option value="{{template.opennebula_vm_template_id}}" {% if template.name|lower == instance.default_selected_template|lower %}selected="selected"{% endif %}>{{template.name}}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
</div> </div>
<input type="hidden" name="pricing_name" value="{% if vm_pricing.name %}{{vm_pricing.name}}{% else %}unknown{% endif%}"></input>
<input type="submit" class="btn btn-primary disabled" value="{% trans 'Continue' %}"></input> <input type="submit" class="btn btn-primary disabled" value="{% trans 'Continue' %}"></input>
</form> </form>

View file

@ -3,19 +3,42 @@
<footer> <footer>
<div class="container"> <div class="container">
<ul class="list-inline"> <ul class="list-inline">
{% if request.resolver_match.url_name != "index" %}
<li>
<a href="{% url 'datacenterlight:index' %}">{% trans "Home" %}</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
{% endif %}
<li> <li>
<a class="url-init" href="https://{{MULTISITE_CMS_FALLBACK}}">{% trans "Home" %}</a> <a class="url-init" href="{% url 'datacenterlight:index' %}#how">{% trans "Highlights" %}</a>
</li> </li>
<li class="footer-menu-divider">&sdot;</li>
<li> <li>
<a class="url-init" href="https://{{MULTISITE_CMS_FALLBACK}}#contact">{% trans "Contact" %}</a> <a class="url-init" href="{% url 'datacenterlight:index' %}#your">{% trans "Scale out" %}</a>
</li> </li>
<li class="footer-menu-divider">&sdot;</li> <li>
<a class="url-init" href="{% url 'datacenterlight:index' %}#our">{% trans "Reliable and light" %}</a>
</li>
{% if request.resolver_match.url_name != "index" %}
<li>
<a class="url-init" href="{% url 'datacenterlight:index' %}#price">{% trans "Pricing" %}</a>
</li>
<li class="footer-menu-divider">&sdot;</li>
{% else %}
<li>
<a class="url-init" href="{% url 'datacenterlight:index' %}#price">{% trans "Order VM" %}</a>
</li>
{% endif %}
<li> <li>
<a class="url-init" href="https://{{MULTISITE_CMS_FALLBACK}}/cms/terms-of-service">{% trans "Terms of Service" %}</a> <a class="url-init" href="{% url 'datacenterlight:index' %}#contact">{% trans "Contact" %}</a>
</li>
{% if request.resolver_match.url_name != "index" %}
<li class="footer-menu-divider">&sdot;</li>
{% endif %}
<li>
<a class="url-init" href="/cms/terms-of-service">{% trans "Terms of Service" %}</a>
</li> </li>
</ul> </ul>
<p class="copyright text-muted small">Copyright &copy; ungleich glarus ag {% now "Y" %}. {% trans "All Rights Reserved" %}</p> <p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. {% trans "All Rights Reserved" %}</p>
</div> </div>
</footer> </footer>

View file

@ -16,8 +16,19 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<!-- Start Navbar collapse--> <!-- Start Navbar collapse-->
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li class="dropdown highlights-dropdown">
<a class="dropdown-toggle url-init" href="{% url 'datacenterlight:index' %}#how" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Highlights" %}&nbsp;<span class="caret"></span></a>
<ul class="dropdown-menu ">
<li><a class="url-init" href="{% url 'datacenterlight:index' %}#your">{% trans "Scale out" %}</a></li>
<li><a class="url-init" href="{% url 'datacenterlight:index' %}#our">{% trans "Reliable and light" %}</a></li>
<li> <a class="url-init" href="{% url 'datacenterlight:index' %}#price">{% trans "Order VM" %}</a></li>
</ul>
</li>
<li> <li>
<a class="url-init" href="https://datacenterlight.ch/en-us/cms/datacenterlight/#contact">{% trans "Contact" %}</a> <a href="{% url 'datacenterlight:whydatacenterlight' %}">{% trans "Why Data Center Light?" %}</a>
</li>
<li>
<a class="url-init" href="{% url 'datacenterlight:index' %}#contact">{% trans "Contact" %}</a>
</li> </li>
<li> <li>
{% if LANGUAGE_CODE == 'en-us'%} {% if LANGUAGE_CODE == 'en-us'%}

View file

@ -1,5 +1,5 @@
{% extends "datacenterlight/base_hosting.html" %} {% extends "datacenterlight/base_hosting.html" %}
{% load staticfiles bootstrap3 i18n cms_tags humanize %} {% load staticfiles bootstrap3 i18n %}
{% block css_extra %} {% block css_extra %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paymentfont/1.1.2/css/paymentfont.min.css"/> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paymentfont/1.1.2/css/paymentfont.min.css"/>
@ -67,102 +67,110 @@
</div> </div>
<div class="dcl-payment-box"> <div class="dcl-payment-box">
<div class="dcl-payment-section"> <div class="dcl-payment-section">
{% if generic_payment_form %} <h3>{%trans "Your Order" %}</h3>
<h3>{%trans "Make a payment" %}</h3> <hr class="top-hr">
<hr class="top-hr"> <div class="dcl-payment-order">
<form role="form" id="generic-payment-form" method="post" action="" novalidate> <p>{% trans "Cores"%} <strong class="pull-right">{{request.session.specs.cpu|floatformat}}</strong></p>
{% csrf_token %} <hr>
<input type="hidden" name="product" value="1" /> <p>{% trans "Memory"%} <strong class="pull-right">{{request.session.specs.memory|floatformat}} GB</strong></p>
{% for field in generic_payment_form %} <hr>
{% bootstrap_field field type='fields'%} <p>{% trans "Disk space"%} <strong class="pull-right">{{request.session.specs.disk_size|floatformat}} GB</strong></p>
{% endfor %} <hr>
<p class="text-danger">{{generic_payment_form.non_field_errors|striptags}}</p> <p>{% trans "Configuration"%} <strong class="pull-right">{{request.session.template.name}}</strong></p>
</form> <hr>
{% else %} <p class="last-p"><strong>{%trans "Total" %}</strong>&nbsp;&nbsp;<small>({%trans "including VAT" %})</small> <strong class="pull-right">{{request.session.specs.price}} CHF/{% trans "Month" %}</strong></p>
<h3>{%trans "Your Order" %}</h3> </div>
<hr class="top-hr">
<div class="dcl-payment-order">
<p>{% trans "Cores"%} <strong class="pull-right">{{request.session.specs.cpu|floatformat}}</strong></p>
<hr>
<p>{% trans "Memory"%} <strong class="pull-right">{{request.session.specs.memory|floatformat}} GB</strong></p>
<hr>
<p>{% trans "Disk space"%} <strong class="pull-right">{{request.session.specs.disk_size|floatformat}} GB</strong></p>
<hr>
<p>{% trans "Configuration"%} <strong class="pull-right">{{request.session.template.name}}</strong></p>
<hr>
<p>
<strong>{%trans "Total" %}</strong>&nbsp;&nbsp;
<small>
({% if vm_pricing.vat_inclusive %}{%trans "including VAT" %}{% else %}{%trans "excluding VAT" %}{% endif %})
</small>
<strong class="pull-right">{{request.session.specs.price|intcomma}} CHF/{% trans "Month" %}</strong>
</p>
<hr>
{% if vm_pricing.discount_amount %}
<p class="mb-0">
{%trans "Discount" as discount_name %}
<strong>{{ vm_pricing.discount_name|default:discount_name }}</strong>&nbsp;&nbsp;
<strong class="pull-right text-primary">- {{ vm_pricing.discount_amount }} CHF/{% trans "Month" %}</strong>
</p>
<p>
({% trans "Will be applied at checkout" %})
</p>
{% endif %}
</div>
{% endif %}
</div> </div>
</div> </div>
<div class="dcl-payment-box"> <div class="dcl-payment-box">
<div class="dcl-payment-section"> <div class="dcl-payment-section">
{% with card_list_len=cards_list|length %}
<h3><b>{%trans "Credit Card"%}</b></h3> <h3><b>{%trans "Credit Card"%}</b></h3>
<hr class="top-hr"> <hr class="top-hr">
<p> <p>
{% if card_list_len > 0 %}
{% blocktrans %}Please select one of the cards that you used before or fill in your credit card information below. We are using <a href="https://stripe.com" target="_blank">Stripe</a> for payment and do not store your information in our database.{% endblocktrans %}
{% else %}
{% blocktrans %}Please fill in your credit card information below. We are using <a href="https://stripe.com" target="_blank">Stripe</a> for payment and do not store your information in our database.{% endblocktrans %} {% blocktrans %}Please fill in your credit card information below. We are using <a href="https://stripe.com" target="_blank">Stripe</a> for payment and do not store your information in our database.{% endblocktrans %}
{% endif %}
</p> </p>
<div> <div>
{% for card in cards_list %} {% if credit_card_data.last4 %}
<div class="credit-card-info"> <form role="form" id="payment-form-with-creditcard" novalidate>
<div class="col-xs-6 no-padding"> <h5 class="billing-head">Credit Card</h5>
<h5 class="billing-head">{% trans "Credit Card" %}</h5> <h5 class="membership-lead">Last 4: *****{{credit_card_data.last4}}</h5>
<h5 class="membership-lead">{% trans "Last" %} 4: ***** {{card.last4}}</h5> <h5 class="membership-lead">Type: {{credit_card_data.cc_brand}}</h5>
<h5 class="membership-lead">{% trans "Type" %}: {{card.brand}}</h5> <input type="hidden" name="credit_card_needed" value="false"/>
</div> </form>
<div class="col-xs-6 text-right align-bottom"> {% if not messages and not form.non_field_errors %}
<a class="btn choice-btn choice-btn-faded" href="#" data-id_card="{{card.id}}">{% trans "SELECT" %}</a> <p class="card-warning-content card-warning-addtional-margin">
</div> {% trans "You are not making any payment yet. After submitting your card information, you will be taken to the Confirm Order Page." %}
</div> </p>
{% endfor %}
{% if card_list_len > 0 %}
<div class="new-card-head">
<div class="row">
<div class="col-xs-6">
<h4>{% trans "Add a new credit card" %}</h4>
</div>
<div class="col-xs-6 text-right new-card-button-margin">
<button data-toggle="collapse" data-target="#newcard" class="btn choice-btn">
<span class="fa fa-plus"></span>&nbsp;&nbsp;{% trans "NEW CARD" %}
</button>
</div>
</div>
</div>
<div id="newcard" class="collapse">
<hr class="thick-hr">
<div class="card-details-box">
<h3>{%trans "New Credit Card" %}</h3>
<hr>
{% include "hosting/includes/_card_input.html" %}
</div>
</div>
{% else%}
{% include "hosting/includes/_card_input.html" %}
{% endif %} {% endif %}
</div> <div id='payment_error'>
{% endwith %} {% for message in messages %}
{% if 'failed_payment' or 'make_charge_error' in message.tags %}
<ul class="list-unstyled">
<li>
<p class="card-warning-content card-warning-error">{{ message|safe }}</p>
</li>
</ul>
{% endif %}
{% endfor %}
{% for error in form.non_field_errors %}
<p class="card-warning-content card-warning-error">
{{ error|escape }}
</p>
{% endfor %}
</div>
<div class="text-right">
<button id="payment_button_with_creditcard" class="btn btn-vm-contact" type="submit">{%trans "SUBMIT" %}</button>
</div>
{% else %}
<form action="" id="payment-form-new" method="POST">
<input type="hidden" name="token"/>
<div class="group">
<div class="credit-card-goup">
<div class="card-element card-number-element">
<label>{%trans "Card Number" %}</label>
<div id="card-number-element" class="field my-input"></div>
</div>
<div class="row">
<div class="col-xs-5 card-element card-expiry-element">
<label>{%trans "Expiry Date" %}</label>
<div id="card-expiry-element" class="field my-input"></div>
</div>
<div class="col-xs-3 col-xs-offset-4 card-element card-cvc-element">
<label>{%trans "CVC" %}</label>
<div id="card-cvc-element" class="field my-input"></div>
</div>
</div>
<div class="card-element brand">
<label>{%trans "Card Type" %}</label>
<i class="pf pf-credit-card" id="brand-icon"></i>
</div>
</div>
</div>
<div id="card-errors"></div>
{% if not messages and not form.non_field_errors %}
<p class="card-warning-content">
{% trans "You are not making any payment yet. After placing your order, you will be taken to the Submit Payment Page." %}
</p>
{% endif %}
<div id='payment_error'>
{% for message in messages %}
{% if 'failed_payment' in message.tags or 'make_charge_error' in message.tags or 'error' in message.tags %}
<ul class="list-unstyled">
<li><p class="card-warning-content card-warning-error">{{ message|safe }}</p></li>
</ul>
{% endif %}
{% endfor %}
</div>
<div class="text-right">
<button class="btn btn-vm-contact btn-wide" type="submit">{%trans "SUBMIT" %}</button>
</div>
<div style="display:none;">
<p class="payment-errors"></p>
</div>
</form>
{% endif %}
</div>
</div> </div>
</div> </div>
</div> </div>
@ -182,4 +190,13 @@
})(); })();
</script> </script>
{%endif%} {%endif%}
{% if credit_card_data.last4 and credit_card_data.cc_brand %}
<script type="text/javascript">
(function () {
window.hasCreditcard = true;
})();
</script>
{%endif%}
{%endblock%} {%endblock%}

View file

@ -1,5 +1,5 @@
{% extends "datacenterlight/base_hosting.html" %} {% extends "datacenterlight/base_hosting.html" %}
{% load staticfiles bootstrap3 i18n custom_tags humanize %} {% load staticfiles bootstrap3 i18n custom_tags %}
{% block content %} {% block content %}
<div id="order-detail{{order.pk}}" class="order-detail-container"> <div id="order-detail{{order.pk}}" class="order-detail-container">
@ -47,104 +47,38 @@
<hr> <hr>
<div> <div>
<h4>{% trans "Order summary" %}</h4> <h4>{% trans "Order summary" %}</h4>
{% if generic_payment_details %} <p>
<strong>{% trans "Product" %}:</strong>&nbsp;
{{ request.session.template.name }}
</p>
<div class="row">
<div class="col-sm-6">
<p> <p>
<strong>{% trans "Product" %}:</strong>&nbsp; <span>{% trans "Cores" %}: </span>
{{ generic_payment_details.product_name }} <span class="pull-right">{{vm.cpu|floatformat}}</span>
</p> </p>
<div class="row">
<div class="col-sm-6">
<p>
<span>{% trans "Amount" %}: </span>
<strong class="pull-right">CHF {{generic_payment_details.amount|floatformat:2|intcomma}}</strong>
</p>
{% if generic_payment_details.description %}
<p>
<span>{% trans "Description" %}: </span>
<strong class="pull-right">{{generic_payment_details.description}}</strong>
</p>
{% endif %}
{% if generic_payment_details.recurring %}
<p>
<span>{% trans "Recurring" %}: </span>
<strong class="pull-right">Yes</strong>
</p>
{% endif %}
</div>
</div>
{% else %}
<p> <p>
<strong>{% trans "Product" %}:</strong>&nbsp; <span>{% trans "Memory" %}: </span>
{{ request.session.template.name }} <span class="pull-right">{{vm.memory}} GB</span>
</p> </p>
<div class="row"> <p>
<div class="col-sm-6"> <span>{% trans "Disk space" %}: </span>
<p> <span class="pull-right">{{vm.disk_size}} GB</span>
<span>{% trans "Cores" %}: </span> </p>
<strong class="pull-right">{{vm.cpu|floatformat}}</strong> <p>
</p> <span>{% trans "Total" %}</span>
<p> <span class="pull-right">{{vm.price}} CHF</span>
<span>{% trans "Memory" %}: </span> </p>
<strong class="pull-right">{{vm.memory|intcomma}} GB</strong> </div>
</p> </div>
<p>
<span>{% trans "Disk space" %}: </span>
<strong class="pull-right">{{vm.disk_size|intcomma}} GB</strong>
</p>
</div>
<div class="col-sm-12">
<hr class="thin-hr">
</div>
{% if vm.vat > 0 or vm.discount.amount > 0 %}
<div class="col-sm-6">
<div class="subtotal-price">
{% if vm.vat > 0 %}
<p>
<strong class="text-lg">{% trans "Subtotal" %} </strong>
<strong class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</strong>
</p>
<p>
<small>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) </small>
<strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</strong>
</p>
{% endif %}
{% if vm.discount.amount > 0 %}
<p class="text-primary">
{%trans "Discount" as discount_name %}
<strong>{{ vm.discount.name|default:discount_name }} </strong>
<strong class="pull-right">- {{ vm.discount.amount }} CHF</strong>
</p>
{% endif %}
</div>
</div>
<div class="col-sm-12">
<hr class="thin-hr">
</div>
{% endif %}
<div class="col-sm-6">
<p class="total-price">
<strong>{% trans "Total" %} </strong>
<strong class="pull-right">{{vm.total_price|floatformat:2|intcomma}} CHF</strong>
</p>
</div>
</div>
{% endif %}
</div> </div>
<hr class="thin-hr"> <hr>
</div> </div>
<form id="virtual_machine_create_form" action="" method="POST"> <form id="virtual_machine_create_form" action="" method="POST">
{% csrf_token %} {% csrf_token %}
<div class="row"> <div class="row">
<div class="col-sm-8"> <div class="col-sm-8">
{% if generic_payment_details %} <div class="dcl-place-order-text">{% blocktrans with vm_price=request.session.specs.price %}By clicking "Place order" this plan will charge your credit card account with the fee of {{ vm_price }}CHF/month{% endblocktrans %}.</div>
{% if generic_payment_details.recurring %}
<div class="dcl-place-order-text">{% 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 %}.</div>
{% else %}
<div class="dcl-place-order-text">{% 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 %}.</div>
{% endif %}
{% else %}
<div class="dcl-place-order-text">{% 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 %}.</div>
{% endif %}
</div> </div>
<div class="col-sm-4 order-confirm-btn text-right"> <div class="col-sm-4 order-confirm-btn text-right">
<button class="btn choice-btn" id="btn-create-vm" data-toggle="modal" data-target="#createvm-modal"> <button class="btn choice-btn" id="btn-create-vm" data-toggle="modal" data-target="#createvm-modal">
@ -186,5 +120,16 @@
<script type="text/javascript"> <script type="text/javascript">
{% trans "Some problem encountered. Please try again later." as err_msg %} {% trans "Some problem encountered. Please try again later." as err_msg %}
var create_vm_error_message = '{{err_msg|safe}}'; var create_vm_error_message = '{{err_msg|safe}}';
window.onload = function () {
var locale_dates = document.getElementsByClassName("locale_date");
var formats = ['YYYY-MM-DD hh:mm a']
var i;
for (i = 0; i < locale_dates.length; i++) {
var oldDate = moment.utc(locale_dates[i].textContent, formats);
var outputFormat = locale_dates[i].getAttribute('data-format') || oldDate._f;
locale_dates[i].innerHTML = oldDate.local().format(outputFormat);
locale_dates[i].className += ' done';
}
};
</script> </script>
{%endblock%} {%endblock%}

View file

@ -41,14 +41,4 @@ def multiply(value, arg):
:param arg: :param arg:
:return: :return:
""" """
return value * arg return value*arg
@register.filter('escaped_line_break')
def escaped_line_break(value):
"""
usage: {{ text|escaped_line_break }}
:param value:
:return:
"""
return value.replace("\\n", "\n")

View file

@ -12,11 +12,9 @@ from unittest import skipIf
from datacenterlight.models import VMTemplate from datacenterlight.models import VMTemplate
from datacenterlight.tasks import create_vm_task from datacenterlight.tasks import create_vm_task
from hosting.models import HostingOrder
from membership.models import StripeCustomer from membership.models import StripeCustomer
from opennebula_api.serializers import VMTemplateSerializer from opennebula_api.serializers import VMTemplateSerializer
from utils.hosting_utils import get_vm_price from utils.hosting_utils import get_vm_price
from utils.models import BillingAddress
from utils.stripe_utils import StripeUtils from utils.stripe_utils import StripeUtils
@ -83,13 +81,11 @@ class CeleryTaskTestCase(TestCase):
stripe_customer = StripeCustomer.get_or_create( stripe_customer = StripeCustomer.get_or_create(
email=self.customer_email, email=self.customer_email,
token=self.token token=self.token)
)
card_details = self.stripe_utils.get_card_details( card_details = self.stripe_utils.get_card_details(
stripe_customer.stripe_id stripe_customer.stripe_id,
) self.token)
card_details_dict = card_details.get('error') card_details_dict = card_details.get('response_object')
self.assertEquals(card_details_dict, None)
billing_address_data = {'cardholder_name': self.customer_name, billing_address_data = {'cardholder_name': self.customer_name,
'postal_code': '1231', 'postal_code': '1231',
'country': 'CH', 'country': 'CH',
@ -105,8 +101,7 @@ class CeleryTaskTestCase(TestCase):
disk_size=disk_size) disk_size=disk_size)
plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu, plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu,
memory=memory, memory=memory,
disk_size=disk_size, disk_size=disk_size)
price=amount_to_be_charged)
stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu, stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu,
ram=memory, ram=memory,
ssd=disk_size, ssd=disk_size,
@ -127,24 +122,10 @@ class CeleryTaskTestCase(TestCase):
msg = subscription_result.get('error') msg = subscription_result.get('error')
raise Exception("Creating subscription failed: {}".format(msg)) raise Exception("Creating subscription failed: {}".format(msg))
billing_address = BillingAddress(
cardholder_name=billing_address_data['cardholder_name'],
street_address=billing_address_data['street_address'],
city=billing_address_data['city'],
postal_code=billing_address_data['postal_code'],
country=billing_address_data['country']
)
billing_address.save()
order = HostingOrder.create(
price=specs['price'],
vm_id=0,
customer=stripe_customer,
billing_address=billing_address
)
async_task = create_vm_task.delay( async_task = create_vm_task.delay(
vm_template_id, self.user, specs, template_data, order.id vm_template_id, self.user, specs, template_data,
stripe_customer.id, billing_address_data,
stripe_subscription_obj.id, card_details_dict
) )
new_vm_id = 0 new_vm_id = 0
res = None res = None

View file

@ -1,20 +1,17 @@
from django.conf.urls import url from django.conf.urls import url
from django.views.generic import TemplateView, RedirectView from django.views.generic import TemplateView
from .views import ( from .views import (
IndexView, PaymentOrderView, OrderConfirmationView, IndexView, PaymentOrderView, OrderConfirmationView,
WhyDataCenterLightView, ContactUsView WhyDataCenterLightView, ContactUsView
) )
urlpatterns = [ urlpatterns = [
url(r'^$', IndexView.as_view(), name='index'), url(r'^$', IndexView.as_view(), name='index'),
url(r'^t/$', IndexView.as_view(), name='index_t'), url(r'^t/$', IndexView.as_view(), name='index_t'),
url(r'^g/$', IndexView.as_view(), name='index_g'), url(r'^g/$', IndexView.as_view(), name='index_g'),
url(r'^f/$', IndexView.as_view(), name='index_f'), url(r'^f/$', IndexView.as_view(), name='index_f'),
url(r'^l/$', IndexView.as_view(), name='index_l'), url(r'^l/$', IndexView.as_view(), name='index_l'),
url(r'^new/$', RedirectView.as_view(url='/cms/'),
name='cms_index'),
url(r'^whydatacenterlight/?$', WhyDataCenterLightView.as_view(), url(r'^whydatacenterlight/?$', WhyDataCenterLightView.as_view(),
name='whydatacenterlight'), name='whydatacenterlight'),
url(r'^payment/?$', PaymentOrderView.as_view(), name='payment'), url(r'^payment/?$', PaymentOrderView.as_view(), name='payment'),

View file

@ -1,102 +0,0 @@
import logging
from django.contrib.sites.models import Site
from datacenterlight.tasks import create_vm_task
from hosting.models import HostingOrder, HostingBill, OrderDetail
from membership.models import StripeCustomer
from utils.forms import UserBillingAddressForm
from utils.models import BillingAddress
from .cms_models import CMSIntegration
from .models import VMPricing, VMTemplate
logger = logging.getLogger(__name__)
def get_cms_integration(name):
current_site = Site.objects.get_current()
try:
cms_integration = CMSIntegration.objects.get(
name=name, domain=current_site
)
except CMSIntegration.DoesNotExist:
cms_integration = CMSIntegration.objects.get(name=name, domain=None)
return cms_integration
def create_vm(billing_address_data, stripe_customer_id, specs,
stripe_subscription_obj, card_details_dict, request,
vm_template_id, template, user):
billing_address = BillingAddress(
cardholder_name=billing_address_data['cardholder_name'],
street_address=billing_address_data['street_address'],
city=billing_address_data['city'],
postal_code=billing_address_data['postal_code'],
country=billing_address_data['country']
)
billing_address.save()
customer = StripeCustomer.objects.filter(id=stripe_customer_id).first()
vm_pricing = (
VMPricing.get_vm_pricing_by_name(name=specs['pricing_name'])
if 'pricing_name' in specs else
VMPricing.get_default_pricing()
)
final_price = (
specs.get('total_price')
if 'total_price' in specs
else specs.get('price')
)
# Create a Hosting Order with vm_id = 0, we shall set it later in
# celery task once the VM instance is up and running
order = HostingOrder.create(
price=final_price,
customer=customer,
billing_address=billing_address,
vm_pricing=vm_pricing
)
order_detail_obj, obj_created = OrderDetail.objects.get_or_create(
vm_template=VMTemplate.objects.get(
opennebula_vm_template_id=vm_template_id
),
cores=specs['cpu'], memory=specs['memory'], ssd_size=specs['disk_size']
)
order.order_detail = order_detail_obj
order.save()
# Create a Hosting Bill
HostingBill.create(customer=customer, billing_address=billing_address)
# Create Billing Address for User if he does not have one
if not customer.user.billing_addresses.count():
billing_address_data.update({
'user': customer.user.id
})
billing_address_user_form = UserBillingAddressForm(
billing_address_data
)
billing_address_user_form.is_valid()
billing_address_user_form.save()
# Associate the given stripe subscription with the order
order.set_subscription_id(
stripe_subscription_obj.id, card_details_dict
)
# Set order status approved
order.set_approved()
create_vm_task.delay(vm_template_id, user, specs, template, order.id)
clear_all_session_vars(request)
def clear_all_session_vars(request):
if request.session is not None:
for session_var in ['specs', 'template', 'billing_address',
'billing_address_data', 'card_id',
'token', 'customer', 'generic_payment_type',
'generic_payment_details', 'product_id']:
if session_var in request.session:
del request.session[session_var]

View file

@ -1,3 +1,4 @@
import json
import logging import logging
from django import forms from django import forms
@ -6,31 +7,25 @@ from django.contrib import messages
from django.contrib.auth import login, authenticate from django.contrib.auth import login, authenticate
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, JsonResponse, Http404 from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render from django.shortcuts import render
from django.utils.translation import get_language, ugettext_lazy as _ from django.utils.translation import get_language, ugettext_lazy as _
from django.views.decorators.cache import cache_control from django.views.decorators.cache import cache_control
from django.views.generic import FormView, CreateView, DetailView from django.views.generic import FormView, CreateView, DetailView
from hosting.forms import ( from datacenterlight.tasks import create_vm_task
HostingUserLoginForm, GenericPaymentForm, ProductPaymentForm from hosting.forms import HostingUserLoginForm
) from hosting.models import HostingOrder
from hosting.models import (
HostingBill, HostingOrder, UserCardDetail, GenericProduct
)
from membership.models import CustomUser, StripeCustomer from membership.models import CustomUser, StripeCustomer
from opennebula_api.serializers import VMTemplateSerializer from opennebula_api.serializers import VMTemplateSerializer
from utils.forms import ( from utils.forms import (
BillingAddressForm, BillingAddressFormSignup, UserBillingAddressForm, BillingAddressForm, BillingAddressFormSignup
BillingAddress
) )
from utils.hosting_utils import get_vm_price_with_vat from utils.hosting_utils import get_vm_price
from utils.stripe_utils import StripeUtils from utils.stripe_utils import StripeUtils
from utils.tasks import send_plain_email_task from utils.tasks import send_plain_email_task
from .cms_models import DCLCalculatorPluginModel
from .forms import ContactForm from .forms import ContactForm
from .models import VMTemplate, VMPricing from .models import VMTemplate
from .utils import get_cms_integration, create_vm, clear_all_session_vars
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -47,10 +42,9 @@ class ContactUsView(FormView):
return self.render_to_response( return self.render_to_response(
self.get_context_data(contact_form=form)) self.get_context_data(contact_form=form))
else: else:
return render( return render(self.request,
self.request, 'datacenterlight/index.html', 'datacenterlight/index.html',
self.get_context_data(contact_form=form) self.get_context_data(contact_form=form))
)
def form_valid(self, form): def form_valid(self, form):
form.save() form.save()
@ -64,7 +58,7 @@ class ContactUsView(FormView):
sender=form.cleaned_data.get('email') sender=form.cleaned_data.get('email')
), ),
'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS,
'to': [from_emails.get(from_page, 'support@ungleich.ch')], 'to': [from_emails.get(from_page, 'info@ungleich.ch')],
'body': "\n".join( 'body': "\n".join(
["%s=%s" % (k, v) for (k, v) in form.cleaned_data.items()]), ["%s=%s" % (k, v) for (k, v) in form.cleaned_data.items()]),
'reply_to': [form.cleaned_data.get('email')], 'reply_to': [form.cleaned_data.get('email')],
@ -74,10 +68,10 @@ class ContactUsView(FormView):
return self.render_to_response( return self.render_to_response(
self.get_context_data(success=True, contact_form=form)) self.get_context_data(success=True, contact_form=form))
else: else:
return render( return render(self.request,
self.request, 'datacenterlight/index.html', 'datacenterlight/index.html',
self.get_context_data(success=True, contact_form=form) self.get_context_data(success=True,
) contact_form=form))
class IndexView(CreateView): class IndexView(CreateView):
@ -90,29 +84,7 @@ class IndexView(CreateView):
raise ValidationError(_('Invalid number of cores')) raise ValidationError(_('Invalid number of cores'))
def validate_memory(self, value): def validate_memory(self, value):
if 'pid' in self.request.POST: if (value > 200) or (value < 1):
try:
plugin = DCLCalculatorPluginModel.objects.get(
id=self.request.POST['pid']
)
except DCLCalculatorPluginModel.DoesNotExist as dne:
logger.error(
str(dne) + " plugin_id: " + self.request.POST['pid']
)
raise ValidationError(_('Invalid calculator properties'))
if plugin.enable_512mb_ram:
if value % 1 == 0 or value == 0.5:
logger.debug(
"Given ram {value} is either 0.5 or a"
" whole number".format(value=value)
)
if (value > 200) or (value < 0.5):
raise ValidationError(_('Invalid RAM size'))
else:
raise ValidationError(_('Invalid RAM size'))
elif (value > 200) or (value < 1) or (value % 1 != 0):
raise ValidationError(_('Invalid RAM size'))
else:
raise ValidationError(_('Invalid RAM size')) raise ValidationError(_('Invalid RAM size'))
def validate_storage(self, value): def validate_storage(self, value):
@ -121,41 +93,30 @@ class IndexView(CreateView):
@cache_control(no_cache=True, must_revalidate=True, no_store=True) @cache_control(no_cache=True, must_revalidate=True, no_store=True)
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
clear_all_session_vars(request) for session_var in ['specs', 'user', 'billing_address_data']:
return HttpResponseRedirect(reverse('datacenterlight:cms_index')) if session_var in request.session:
del request.session[session_var]
vm_templates = VMTemplate.objects.all()
context = {
'templates': vm_templates
}
return render(request, self.template_name, context)
def post(self, request): def post(self, request):
cores = request.POST.get('cpu') cores = request.POST.get('cpu')
cores_field = forms.IntegerField(validators=[self.validate_cores]) cores_field = forms.IntegerField(validators=[self.validate_cores])
memory = request.POST.get('ram') memory = request.POST.get('ram')
memory_field = forms.FloatField(validators=[self.validate_memory]) memory_field = forms.IntegerField(validators=[self.validate_memory])
storage = request.POST.get('storage') storage = request.POST.get('storage')
storage_field = forms.IntegerField(validators=[self.validate_storage]) storage_field = forms.IntegerField(validators=[self.validate_storage])
template_id = int(request.POST.get('config')) template_id = int(request.POST.get('config'))
pricing_name = request.POST.get('pricing_name')
vm_pricing = VMPricing.get_vm_pricing_by_name(pricing_name)
template = VMTemplate.objects.filter( template = VMTemplate.objects.filter(
opennebula_vm_template_id=template_id opennebula_vm_template_id=template_id
).first() ).first()
template_data = VMTemplateSerializer(template).data template_data = VMTemplateSerializer(template).data
referer_url = request.META['HTTP_REFERER'] referer_url = request.META['HTTP_REFERER']
if vm_pricing is None:
vm_pricing_name_msg = _(
"Incorrect pricing name. Please contact support"
"{support_email}".format(
support_email=settings.DCL_SUPPORT_FROM_ADDRESS
)
)
messages.add_message(
self.request, messages.ERROR, vm_pricing_name_msg,
extra_tags='pricing'
)
return HttpResponseRedirect(referer_url + "#order_form")
else:
vm_pricing_name = vm_pricing.name
try: try:
cores = cores_field.clean(cores) cores = cores_field.clean(cores)
except ValidationError as err: except ValidationError as err:
@ -183,22 +144,14 @@ class IndexView(CreateView):
) )
return HttpResponseRedirect(referer_url + "#order_form") return HttpResponseRedirect(referer_url + "#order_form")
price, vat, vat_percent, discount = get_vm_price_with_vat( amount_to_be_charged = get_vm_price(
cpu=cores, cpu=cores, memory=memory, disk_size=storage
memory=memory,
ssd_size=storage,
pricing_name=vm_pricing_name
) )
specs = { specs = {
'cpu': cores, 'cpu': cores,
'memory': memory, 'memory': memory,
'disk_size': storage, 'disk_size': storage,
'price': price, 'price': amount_to_be_charged
'vat': vat,
'vat_percent': vat_percent,
'discount': discount,
'total_price': round(price + vat - discount['amount'], 2),
'pricing_name': vm_pricing_name
} }
request.session['specs'] = specs request.session['specs'] = specs
request.session['template'] = template_data request.session['template'] = template_data
@ -249,15 +202,19 @@ class PaymentOrderView(FormView):
billing_address_form = BillingAddressForm( billing_address_form = BillingAddressForm(
instance=self.request.user.billing_addresses.first() instance=self.request.user.billing_addresses.first()
) )
user = self.request.user # Get user last order
if hasattr(user, 'stripecustomer'): last_hosting_order = HostingOrder.objects.filter(
stripe_customer = user.stripecustomer customer__user=self.request.user
else: ).last()
stripe_customer = None
cards_list = UserCardDetail.get_all_cards_list( # If user has already an hosting order, get the credit card
stripe_customer=stripe_customer # data from it
) if last_hosting_order:
context.update({'cards_list': cards_list}) credit_card_data = last_hosting_order.get_cc_data()
if credit_card_data:
context['credit_card_data'] = credit_card_data
else:
context['credit_card_data'] = None
else: else:
billing_address_form = BillingAddressFormSignup( billing_address_form = BillingAddressFormSignup(
initial=billing_address_data initial=billing_address_data
@ -267,95 +224,17 @@ class PaymentOrderView(FormView):
'stripe_key': settings.STRIPE_API_PUBLIC_KEY, 'stripe_key': settings.STRIPE_API_PUBLIC_KEY,
'site_url': reverse('datacenterlight:index'), 'site_url': reverse('datacenterlight:index'),
'login_form': HostingUserLoginForm(prefix='login_form'), 'login_form': HostingUserLoginForm(prefix='login_form'),
'billing_address_form': billing_address_form, 'billing_address_form': billing_address_form
'cms_integration': get_cms_integration('default'),
}) })
if ('generic_payment_type' in self.request.session and
self.request.session['generic_payment_type'] == 'generic'):
if 'product_id' in self.request.session:
product = GenericProduct.objects.get(
id=self.request.session['product_id']
)
context.update({'generic_payment_form': ProductPaymentForm(
prefix='generic_payment_form',
initial={'product_name': product.product_name,
'amount': float(product.get_actual_price()),
'recurring': product.product_is_subscription,
'description': product.product_description,
},
product_id=product.id
), })
else:
context.update({'generic_payment_form': GenericPaymentForm(
prefix='generic_payment_form',
), })
else:
context.update({
'vm_pricing': VMPricing.get_vm_pricing_by_name(
self.request.session['specs']['pricing_name']
)
})
return context return context
@cache_control(no_cache=True, must_revalidate=True, no_store=True) @cache_control(no_cache=True, must_revalidate=True, no_store=True)
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
if (('type' in request.GET and request.GET['type'] == 'generic') if 'specs' not in request.session:
or 'product_slug' in kwargs):
request.session['generic_payment_type'] = 'generic'
if 'generic_payment_details' in request.session:
request.session.pop('generic_payment_details')
request.session.pop('product_id')
if 'product_slug' in kwargs:
logger.debug("Product slug is " + kwargs['product_slug'])
try:
product = GenericProduct.objects.get(
product_slug=kwargs['product_slug']
)
except GenericProduct.DoesNotExist as dne:
logger.error(
"Product '{}' does "
"not exist".format(kwargs['product_slug'])
)
raise Http404()
request.session['product_id'] = product.id
elif 'specs' not in request.session:
return HttpResponseRedirect(reverse('datacenterlight:index')) return HttpResponseRedirect(reverse('datacenterlight:index'))
return self.render_to_response(self.get_context_data()) return self.render_to_response(self.get_context_data())
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
if 'product' in request.POST:
# query for the supplied product
product = None
try:
product = GenericProduct.objects.get(
id=request.POST['generic_payment_form-product_name']
)
except GenericProduct.DoesNotExist as dne:
logger.error(
"The requested product '{}' does not exist".format(
request.POST['generic_payment_form-product_name']
)
)
except GenericProduct.MultipleObjectsReturned as mpe:
logger.error(
"There seem to be more than one product with "
"the name {}".format(
request.POST['generic_payment_form-product_name']
)
)
product = GenericProduct.objects.all(
product_name=request.
POST['generic_payment_form-product_name']
).first()
if product is None:
return JsonResponse({})
else:
return JsonResponse({
'amount': product.get_actual_price(),
'isSubscription': product.product_is_subscription
})
if 'login_form' in request.POST: if 'login_form' in request.POST:
login_form = HostingUserLoginForm( login_form = HostingUserLoginForm(
data=request.POST, prefix='login_form' data=request.POST, prefix='login_form'
@ -366,13 +245,6 @@ class PaymentOrderView(FormView):
auth_user = authenticate(email=email, password=password) auth_user = authenticate(email=email, password=password)
if auth_user: if auth_user:
login(self.request, auth_user) login(self.request, auth_user)
if 'product_slug' in kwargs:
return HttpResponseRedirect(
reverse('show_product',
kwargs={
'product_slug': kwargs['product_slug']}
)
)
return HttpResponseRedirect( return HttpResponseRedirect(
reverse('datacenterlight:payment') reverse('datacenterlight:payment')
) )
@ -389,87 +261,15 @@ class PaymentOrderView(FormView):
data=request.POST, data=request.POST,
) )
if address_form.is_valid(): if address_form.is_valid():
# Check if we are in a generic payment case and handle the generic
# payment details form before we go on to verify payment
if ('generic_payment_type' in request.session and
self.request.session['generic_payment_type'] == 'generic'):
if 'product_id' in request.session:
generic_payment_form = ProductPaymentForm(
data=request.POST, prefix='generic_payment_form',
product_id=request.session['product_id']
)
else:
generic_payment_form = GenericPaymentForm(
data=request.POST, prefix='generic_payment_form'
)
if generic_payment_form.is_valid():
logger.debug("Generic payment form is valid.")
if 'product_id' in request.session:
product = generic_payment_form.product
else:
product = generic_payment_form.cleaned_data.get(
'product_name'
)
gp_details = {
"product_name": product.product_name,
"amount": generic_payment_form.cleaned_data.get(
'amount'
),
"recurring": generic_payment_form.cleaned_data.get(
'recurring'
),
"description": generic_payment_form.cleaned_data.get(
'description'
),
"product_id": product.id,
"product_slug": product.product_slug
}
request.session["generic_payment_details"] = (
gp_details
)
else:
logger.debug("Generic payment form invalid")
context = self.get_context_data()
context['generic_payment_form'] = generic_payment_form
context['billing_address_form'] = address_form
return self.render_to_response(context)
token = address_form.cleaned_data.get('token') token = address_form.cleaned_data.get('token')
if token is '':
card_id = address_form.cleaned_data.get('card')
try:
user_card_detail = UserCardDetail.objects.get(id=card_id)
if not request.user.has_perm(
'view_usercarddetail', user_card_detail
):
raise UserCardDetail.DoesNotExist(
_("{user} does not have permission to access the "
"card").format(user=request.user.email)
)
except UserCardDetail.DoesNotExist as e:
ex = str(e)
logger.error("Card Id: {card_id}, Exception: {ex}".format(
card_id=card_id, ex=ex
)
)
msg = _("An error occurred. Details: {}".format(ex))
messages.add_message(
self.request, messages.ERROR, msg,
extra_tags='make_charge_error'
)
return HttpResponseRedirect(
reverse('datacenterlight:payment') + '#payment_error'
)
request.session['card_id'] = user_card_detail.id
else:
request.session['token'] = token
if request.user.is_authenticated(): if request.user.is_authenticated():
this_user = { this_user = {
'email': request.user.email, 'email': request.user.email,
'name': request.user.name 'name': request.user.name
} }
customer = StripeCustomer.get_or_create( customer = StripeCustomer.get_or_create(
email=this_user.get('email'), token=token email=this_user.get('email'),
) token=token)
else: else:
user_email = address_form.cleaned_data.get('email') user_email = address_form.cleaned_data.get('email')
user_name = address_form.cleaned_data.get('name') user_name = address_form.cleaned_data.get('name')
@ -517,6 +317,7 @@ class PaymentOrderView(FormView):
billing_address_form=address_form billing_address_form=address_form
) )
) )
request.session['token'] = token
if type(customer) is StripeCustomer: if type(customer) is StripeCustomer:
request.session['customer'] = customer.stripe_id request.session['customer'] = customer.stripe_id
else: else:
@ -537,137 +338,45 @@ class OrderConfirmationView(DetailView):
@cache_control(no_cache=True, must_revalidate=True, no_store=True) @cache_control(no_cache=True, must_revalidate=True, no_store=True)
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
context = {} if 'specs' not in request.session or 'user' not in request.session:
if (('specs' not in request.session or 'user' not in request.session)
and 'generic_payment_type' not in request.session):
return HttpResponseRedirect(reverse('datacenterlight:index')) return HttpResponseRedirect(reverse('datacenterlight:index'))
if 'token' in self.request.session: if 'token' not in request.session:
token = self.request.session['token'] return HttpResponseRedirect(reverse('datacenterlight:payment'))
stripe_utils = StripeUtils() stripe_api_cus_id = request.session.get('customer')
card_details = stripe_utils.get_cards_details_from_token( stripe_utils = StripeUtils()
token card_details = stripe_utils.get_card_details(stripe_api_cus_id,
) request.session.get(
if not card_details.get('response_object'): 'token'))
return HttpResponseRedirect(reverse('hosting:payment')) if not card_details.get('response_object'):
card_details_response = card_details['response_object'] msg = card_details.get('error')
context['cc_last4'] = card_details_response['last4'] messages.add_message(self.request, messages.ERROR, msg,
context['cc_brand'] = card_details_response['brand'] extra_tags='failed_payment')
else: return HttpResponseRedirect(
card_id = self.request.session.get('card_id') reverse('datacenterlight:payment') + '#payment_error')
card_detail = UserCardDetail.objects.get(id=card_id) context = {
context['cc_last4'] = card_detail.last4
context['cc_brand'] = card_detail.brand
if ('generic_payment_type' in request.session and
self.request.session['generic_payment_type'] == 'generic'):
context.update({
'generic_payment_details':
request.session['generic_payment_details'],
})
else:
context.update({
'vm': request.session.get('specs'),
})
context.update({
'site_url': reverse('datacenterlight:index'), 'site_url': reverse('datacenterlight:index'),
'cc_last4': card_details.get('response_object').get('last4'),
'cc_brand': card_details.get('response_object').get('brand'),
'vm': request.session.get('specs'),
'page_header_text': _('Confirm Order'), 'page_header_text': _('Confirm Order'),
'billing_address_data': ( 'billing_address_data': request.session.get('billing_address_data')
request.session.get('billing_address_data') }
),
'cms_integration': get_cms_integration('default'),
})
return render(request, self.template_name, context) return render(request, self.template_name, context)
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
template = request.session.get('template')
specs = request.session.get('specs')
user = request.session.get('user') user = request.session.get('user')
stripe_api_cus_id = request.session.get('customer') stripe_api_cus_id = request.session.get('customer')
vm_template_id = template.get('id', 1)
stripe_utils = StripeUtils() stripe_utils = StripeUtils()
card_details = stripe_utils.get_card_details(stripe_api_cus_id,
if 'token' in request.session: request.session.get(
card_details = stripe_utils.get_cards_details_from_token( 'token'))
request.session.get('token') if not card_details.get('response_object'):
) msg = card_details.get('error')
if not card_details.get('response_object'): messages.add_message(self.request, messages.ERROR, msg,
msg = card_details.get('error') extra_tags='failed_payment')
messages.add_message(self.request, messages.ERROR, msg,
extra_tags='failed_payment')
response = {
'status': False,
'redirect': "{url}#{section}".format(
url=(reverse(
'show_product',
kwargs={'product_slug':
request.session['generic_payment_details']
['product_slug']}
) if 'generic_payment_details' in request.session else
reverse('datacenterlight:payment')
),
section='payment_error'),
'msg_title': str(_('Error.')),
'msg_body': str(
_('There was a payment related error.'
' On close of this popup, you will be'
' redirected back to the payment page.')
)
}
return JsonResponse(response)
card_details_response = card_details['response_object']
card_details_dict = {
'last4': card_details_response['last4'],
'brand': card_details_response['brand'],
'card_id': card_details_response['card_id']
}
stripe_customer_obj = StripeCustomer.objects.filter(
stripe_id=stripe_api_cus_id).first()
if stripe_customer_obj:
ucd = UserCardDetail.get_user_card_details(
stripe_customer_obj, card_details_response
)
if not ucd:
acc_result = stripe_utils.associate_customer_card(
stripe_api_cus_id, request.session['token'],
set_as_default=True
)
if acc_result['response_object'] is None:
msg = _(
'An error occurred while associating the card.'
' Details: {details}'.format(
details=acc_result['error']
)
)
messages.add_message(self.request, messages.ERROR, msg,
extra_tags='failed_payment')
response = {
'status': False,
'redirect': "{url}#{section}".format(
url=(reverse(
'show_product',
kwargs={'product_slug':
request.session
['generic_payment_details']
['product_slug']}
) if 'generic_payment_details' in
request.session else
reverse('datacenterlight:payment')
),
section='payment_error'),
'msg_title': str(_('Error.')),
'msg_body': str(
_('There was a payment related error.'
' On close of this popup, you will be redirected'
' back to the payment page.')
)
}
return JsonResponse(response)
elif 'card_id' in request.session:
card_id = request.session.get('card_id')
user_card_detail = UserCardDetail.objects.get(id=card_id)
card_details_dict = {
'last4': user_card_detail.last4,
'brand': user_card_detail.brand,
'card_id': user_card_detail.card_id
}
else:
response = { response = {
'status': False, 'status': False,
'redirect': "{url}#{section}".format( 'redirect': "{url}#{section}".format(
@ -679,124 +388,49 @@ class OrderConfirmationView(DetailView):
' On close of this popup, you will be redirected back to' ' On close of this popup, you will be redirected back to'
' the payment page.')) ' the payment page.'))
} }
return JsonResponse(response) return HttpResponse(json.dumps(response),
content_type="application/json")
if ('generic_payment_type' in request.session and card_details_dict = card_details.get('response_object')
self.request.session['generic_payment_type'] == 'generic'): cpu = specs.get('cpu')
gp_details = self.request.session['generic_payment_details'] memory = specs.get('memory')
if gp_details['recurring']: disk_size = specs.get('disk_size')
# generic recurring payment amount_to_be_charged = specs.get('price')
logger.debug("Commencing a generic recurring payment") plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu,
else: memory=memory,
# generic one time payment disk_size=disk_size)
logger.debug("Commencing a one time payment") stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu,
charge_response = stripe_utils.make_charge( ram=memory,
amount=gp_details['amount'], ssd=disk_size,
customer=stripe_api_cus_id version=1,
) app='dcl')
stripe_onetime_charge = charge_response.get('response_object') stripe_plan = stripe_utils.get_or_create_stripe_plan(
amount=amount_to_be_charged,
# Check if the payment was approved name=plan_name,
if not stripe_onetime_charge: stripe_plan_id=stripe_plan_id)
msg = charge_response.get('error') subscription_result = stripe_utils.subscribe_customer_to_plan(
messages.add_message(self.request, messages.ERROR, msg, stripe_api_cus_id,
extra_tags='failed_payment') [{"plan": stripe_plan.get(
response = { 'response_object').stripe_plan_id}])
'status': False, stripe_subscription_obj = subscription_result.get('response_object')
'redirect': "{url}#{section}".format( # Check if the subscription was approved and is active
url=(reverse('show_product', kwargs={ if (stripe_subscription_obj is None
'product_slug': gp_details['product_slug']} or stripe_subscription_obj.status != 'active'):
) if 'generic_payment_details' in msg = subscription_result.get('error')
request.session else messages.add_message(self.request, messages.ERROR, msg,
reverse('datacenterlight:payment') extra_tags='failed_payment')
), response = {
section='payment_error'), 'status': False,
'msg_title': str(_('Error.')), 'redirect': "{url}#{section}".format(
'msg_body': str( url=reverse('datacenterlight:payment'),
_('There was a payment related error.' section='payment_error'),
' On close of this popup, you will be redirected' 'msg_title': str(_('Error.')),
' back to the payment page.')) 'msg_body': str(
} _('There was a payment related error.'
return JsonResponse(response) ' On close of this popup, you will be redirected back to'
' the payment page.'))
if ('generic_payment_type' not in request.session or }
(request.session['generic_payment_details']['recurring'])): return HttpResponse(json.dumps(response),
if 'generic_payment_details' in request.session: content_type="application/json")
amount_to_be_charged = (
round(
request.session['generic_payment_details']['amount'],
2
)
)
plan_name = "generic-{0}-{1:.2f}".format(
request.session['generic_payment_details']['product_id'],
amount_to_be_charged
)
stripe_plan_id = plan_name
else:
template = request.session.get('template')
specs = request.session.get('specs')
vm_template_id = template.get('id', 1)
cpu = specs.get('cpu')
memory = specs.get('memory')
disk_size = specs.get('disk_size')
amount_to_be_charged = specs.get('total_price')
plan_name = StripeUtils.get_stripe_plan_name(
cpu=cpu,
memory=memory,
disk_size=disk_size,
price=amount_to_be_charged
)
stripe_plan_id = StripeUtils.get_stripe_plan_id(
cpu=cpu,
ram=memory,
ssd=disk_size,
version=1,
app='dcl',
price=amount_to_be_charged
)
stripe_plan = stripe_utils.get_or_create_stripe_plan(
amount=amount_to_be_charged,
name=plan_name,
stripe_plan_id=stripe_plan_id)
subscription_result = stripe_utils.subscribe_customer_to_plan(
stripe_api_cus_id,
[{"plan": stripe_plan.get(
'response_object').stripe_plan_id}])
stripe_subscription_obj = subscription_result.get('response_object')
# Check if the subscription was approved and is active
if (stripe_subscription_obj is None
or stripe_subscription_obj.status != 'active'):
# At this point, we have created a Stripe API card and
# associated it with the customer; but the transaction failed
# due to some reason. So, we would want to dissociate this card
# here.
# ...
msg = subscription_result.get('error')
messages.add_message(self.request, messages.ERROR, msg,
extra_tags='failed_payment')
response = {
'status': False,
'redirect': "{url}#{section}".format(
url=(reverse(
'show_product',
kwargs={'product_slug':
request.session['generic_payment_details']
['product_slug']}
) if 'generic_payment_details' in request.session else
reverse('datacenterlight:payment')
),
section='payment_error'
),
'msg_title': str(_('Error.')),
'msg_body': str(
_('There was a payment related error.'
' On close of this popup, you will be redirected back to'
' the payment page.'))
}
return JsonResponse(response)
# Create user if the user is not logged in and if he is not already # Create user if the user is not logged in and if he is not already
# registered # registered
@ -836,148 +470,12 @@ class OrderConfirmationView(DetailView):
stripe_customer_id = request.user.stripecustomer.id stripe_customer_id = request.user.stripecustomer.id
custom_user = request.user custom_user = request.user
if 'token' in request.session:
ucd = UserCardDetail.get_or_create_user_card_detail(
stripe_customer=self.request.user.stripecustomer,
card_details=card_details_response
)
UserCardDetail.save_default_card_local(
self.request.user.stripecustomer.stripe_id,
ucd.card_id
)
else:
card_id = request.session.get('card_id')
user_card_detail = UserCardDetail.objects.get(id=card_id)
card_details_dict = {
'last4': user_card_detail.last4,
'brand': user_card_detail.brand,
'card_id': user_card_detail.card_id
}
if not user_card_detail.preferred:
UserCardDetail.set_default_card(
stripe_api_cus_id=stripe_api_cus_id,
stripe_source_id=user_card_detail.card_id
)
# Save billing address # Save billing address
billing_address_data = request.session.get('billing_address_data') billing_address_data = request.session.get('billing_address_data')
logger.debug('billing_address_data is {}'.format(billing_address_data)) logger.debug('billing_address_data is {}'.format(billing_address_data))
billing_address_data.update({ billing_address_data.update({
'user': custom_user.id 'user': custom_user.id
}) })
if 'generic_payment_type' in request.session:
stripe_cus = StripeCustomer.objects.filter(
stripe_id=stripe_api_cus_id
).first()
billing_address = BillingAddress(
cardholder_name=billing_address_data['cardholder_name'],
street_address=billing_address_data['street_address'],
city=billing_address_data['city'],
postal_code=billing_address_data['postal_code'],
country=billing_address_data['country']
)
billing_address.save()
order = HostingOrder.create(
price=self.request
.session['generic_payment_details']['amount'],
customer=stripe_cus,
billing_address=billing_address,
vm_pricing=VMPricing.get_default_pricing()
)
# Create a Hosting Bill
HostingBill.create(customer=stripe_cus,
billing_address=billing_address)
# Create Billing Address for User if he does not have one
if not stripe_cus.user.billing_addresses.count():
billing_address_data.update({
'user': stripe_cus.user.id
})
billing_address_user_form = UserBillingAddressForm(
billing_address_data
)
billing_address_user_form.is_valid()
billing_address_user_form.save()
if self.request.session['generic_payment_details']['recurring']:
# Associate the given stripe subscription with the order
order.set_subscription_id(
stripe_subscription_obj.id, card_details_dict
)
else:
# Associate the given stripe charge id with the order
order.set_stripe_charge(stripe_onetime_charge)
# Set order status approved
order.set_approved()
order.generic_payment_description = gp_details["description"]
order.generic_product_id = gp_details["product_id"]
order.save()
# send emails
context = {
'name': user.get('name'),
'email': user.get('email'),
'amount': gp_details['amount'],
'description': gp_details['description'],
'recurring': gp_details['recurring'],
'product_name': gp_details['product_name'],
'product_id': gp_details['product_id'],
'order_id': order.id
}
email_data = {
'subject': (settings.DCL_TEXT +
" Payment received from %s" % context['email']),
'from_email': settings.DCL_SUPPORT_FROM_ADDRESS,
'to': ['info@ungleich.ch'],
'body': "\n".join(
["%s=%s" % (k, v) for (k, v) in context.items()]),
'reply_to': [context['email']],
}
send_plain_email_task.delay(email_data)
email_data = {
'subject': _("Confirmation of your payment"),
'from_email': settings.DCL_SUPPORT_FROM_ADDRESS,
'to': [user.get('email')],
'body': _("Hi {name},\n\n"
"thank you for your order!\n"
"We have just received a payment of CHF {amount:.2f}"
" from you.{recurring}\n\n"
"Cheers,\nYour Data Center Light team".format(
name=user.get('name'),
amount=gp_details['amount'],
recurring=(
_(' This is a monthly recurring plan.')
if gp_details['recurring'] else ''
)
)
),
'reply_to': ['info@ungleich.ch'],
}
send_plain_email_task.delay(email_data)
response = {
'status': True,
'redirect': (
reverse('hosting:orders')
if request.user.is_authenticated()
else reverse('datacenterlight:index')
),
'msg_title': str(_('Thank you for the payment.')),
'msg_body': str(
_('You will soon receive a confirmation email of the '
'payment. You can always contact us at '
'info@ungleich.ch for any question that you may have.')
)
}
clear_all_session_vars(request)
return JsonResponse(response)
user = { user = {
'name': custom_user.name, 'name': custom_user.name,
'email': custom_user.email, 'email': custom_user.email,
@ -987,11 +485,14 @@ class OrderConfirmationView(DetailView):
'language': get_language(), 'language': get_language(),
} }
create_vm( create_vm_task.delay(vm_template_id, user, specs, template,
billing_address_data, stripe_customer_id, specs, stripe_customer_id, billing_address_data,
stripe_subscription_obj, card_details_dict, request, stripe_subscription_obj.id, card_details_dict)
vm_template_id, template, user for session_var in ['specs', 'template', 'billing_address',
) 'billing_address_data',
'token', 'customer']:
if session_var in request.session:
del request.session[session_var]
response = { response = {
'status': True, 'status': True,
@ -1007,4 +508,5 @@ class OrderConfirmationView(DetailView):
' it is ready.')) ' it is ready.'))
} }
return JsonResponse(response) return HttpResponse(json.dumps(response),
content_type="application/json")

View file

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-08-24 07:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('digitalglarus', '0025_membershiporder_stripe_subscription_id'),
]
operations = [
migrations.AlterField(
model_name='bookingorder',
name='cc_brand',
field=models.CharField(blank=True, max_length=128),
),
migrations.AlterField(
model_name='membershiporder',
name='cc_brand',
field=models.CharField(blank=True, max_length=128),
),
]

View file

@ -39,7 +39,7 @@ class Ordereable(models.Model):
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
approved = models.BooleanField(default=False) approved = models.BooleanField(default=False)
last4 = models.CharField(max_length=4, blank=True) last4 = models.CharField(max_length=4, blank=True)
cc_brand = models.CharField(max_length=128, blank=True) cc_brand = models.CharField(max_length=10, blank=True)
stripe_charge_id = models.CharField(max_length=100, null=True) stripe_charge_id = models.CharField(max_length=100, null=True)
class Meta: class Meta:

View file

@ -70,7 +70,7 @@ hr.small {
} }
.navbar-custom .navbar-brand { .navbar-custom .navbar-brand {
color: white; color: white;
padding: 5px 20px; padding: 20px;
} }
.navbar-custom .navbar-brand:hover, .navbar-custom .navbar-brand:hover,
.navbar-custom .navbar-brand:focus { .navbar-custom .navbar-brand:focus {

View file

@ -57,7 +57,7 @@
ga('send', 'pageview'); ga('send', 'pageview');
</script> </script>
<link rel="shortcut icon" href="{% static 'digitalglarus/img/favicon.ico' %}" type="image/x-icon"> <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
<style id="igtranslator-color" type="text/css"></style> <style id="igtranslator-color" type="text/css"></style>
<style type="text/css"> <style type="text/css">
@ -87,10 +87,10 @@
height: 100%; height: 100%;
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
overflow-x: hidden; overflow-x: hidden;
} }
@media only screen and (min-width: 769px){ @media only screen and (min-width: 769px){
.dropdown.home-dropdown-mobile { .dropdown.home-dropdown-mobile {
display: none; display: none;
} }
@ -99,10 +99,10 @@
} }
} }
@media only screen and (max-width: 768px){ @media only screen and (max-width: 768px){
.dropdown.home-dropdown-mobile { .dropdown.home-dropdown-mobile {
display: block; display: block;
background-color: background-color:
} }
.dropdown.home-dropdown-mobile .dropdown-menu{ .dropdown.home-dropdown-mobile .dropdown-menu{
@ -164,7 +164,7 @@
<a class="page-scroll" href="#contact">Contact</a> <a class="page-scroll" href="#contact">Contact</a>
</li> </li>
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<li class="dropdown home-dropdown-mobile open"> <li class="dropdown home-dropdown-mobile open">
<a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#"> <a class="dropdown-toggle" role="button" data-toggle="dropdown" href="#">
@ -177,7 +177,7 @@
</a> </a>
</li> </li>
<li> <li>
<a href="{% url 'digitalglarus:membership_orders_list' %}"><i class="fa fa-heart-o" aria-hidden="true"></i> {% trans "Membership"%} <a href="{% url 'digitalglarus:membership_orders_list' %}"><i class="fa fa-heart-o" aria-hidden="true"></i> {% trans "Membership"%}
</a> </a>
</li> </li>
<li> <li>
@ -200,7 +200,7 @@
</a> </a>
</li> </li>
<li> <li>
<a href="{% url 'digitalglarus:membership_orders_list' %}"><i class="fa fa-heart-o" aria-hidden="true"></i> {% trans "Membership"%} <a href="{% url 'digitalglarus:membership_orders_list' %}"><i class="fa fa-heart-o" aria-hidden="true"></i> {% trans "Membership"%}
</a> </a>
</li> </li>
<li> <li>
@ -210,11 +210,11 @@
</a> </a>
</li> </li>
</ul> </ul>
</li> </li>
{% else %} {% else %}
<li> <li>
<a class="page-scroll" href="{% url 'digitalglarus:login' %}">Login</a> <a class="page-scroll" href="{% url 'digitalglarus:login' %}">Login</a>
</li> </li>
{% endif %} {% endif %}
<!-- <li> <!-- <li>
<a class="page-scroll" href="{% url 'digitalglarus:signup' %}">Sign Up</a> <a class="page-scroll" href="{% url 'digitalglarus:signup' %}">Sign Up</a>
@ -227,7 +227,7 @@
</nav> </nav>
{% block content %} {% endblock %} {% block content %} {% endblock %}
<footer> <footer>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
@ -255,7 +255,7 @@
</div> </div>
</div> </div>
</footer> </footer>
<script type="text/javascript" src="{% static 'digitalglarus/bower_components/jquery/dist/jquery.min.js' %}"></script> <script type="text/javascript" src="{% static 'digitalglarus/bower_components/jquery/dist/jquery.min.js' %}"></script>
<!-- jQuery --> <!-- jQuery -->
@ -295,7 +295,7 @@
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/latest/css/bootstrap.css" /> <!-- <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/latest/css/bootstrap.css" />
--> -->
<!-- Include Date Range Picker --> <!-- Include Date Range Picker -->
<script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.42/js/bootstrap-datetimepicker.min.js <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.42/js/bootstrap-datetimepicker.min.js

View file

@ -2,7 +2,7 @@ import logging
from django.conf import settings from django.conf import settings
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponseRedirect, Http404 from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse_lazy, reverse from django.core.urlresolvers import reverse_lazy, reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView, UpdateView from django.views.generic import TemplateView, UpdateView
@ -492,18 +492,6 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView):
'membership_dates': membership.type.first_month_formated_range 'membership_dates': membership.type.first_month_formated_range
}) })
email_to_admin_data = {
'subject': "New Digital Glarus subscription: {user}".format(
user=self.request.user.email
),
'from_email': 'info@digitalglarus.ch',
'to': ['info@ungleich.ch'],
'body': "\n".join(
["%s=%s" % (k, v) for (k, v) in
order_data.items()]),
}
send_plain_email_task.delay(email_to_admin_data)
context = { context = {
'membership': membership, 'membership': membership,
'order': membership_order, 'order': membership_order,
@ -846,9 +834,8 @@ class ContactView(FormView):
def blog(request): def blog(request):
tags = ["digitalglarus"] tags = ["digitalglarus"]
posts = (Post.objects posts = Post.objects.filter(tags__name__in=tags, publish=True).translated(get_language())
.filter(tags__name__in=tags, publish=True) # posts = Post.objects.filter_by_language(get_language()).filter(tags__name__in=tags, publish=True)
.translated(get_language()))
context = { context = {
'post_list': posts, 'post_list': posts,
} }
@ -856,9 +843,9 @@ def blog(request):
def blog_detail(request, slug): def blog_detail(request, slug):
# post = Post.objects.filter_by_language(get_language()).filter(slug=slug).first()
post = Post.objects.translated(get_language(), slug=slug).first() post = Post.objects.translated(get_language(), slug=slug).first()
if post is None:
raise Http404()
context = { context = {
'post': post, 'post': post,
} }

View file

@ -1,2 +0,0 @@
DECIMAL_SEPARATOR = '.'
THOUSAND_SEPARATOR = ','

View file

@ -2,15 +2,16 @@
Copyright 2015 ungleich. Copyright 2015 ungleich.
""" """
import json
import logging
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os import os
import json
from django.utils.translation import ugettext_lazy as _
# dotenv # dotenv
import dotenv import dotenv
from django.utils.translation import ugettext_lazy as _ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -55,7 +56,6 @@ PROJECT_DIR = os.path.abspath(
dotenv.read_dotenv("{0}/.env".format(PROJECT_DIR)) dotenv.read_dotenv("{0}/.env".format(PROJECT_DIR))
from multisite import SiteID from multisite import SiteID
SITE_ID = SiteID(default=1) SITE_ID = SiteID(default=1)
APP_ROOT_ENDPOINT = "/" APP_ROOT_ENDPOINT = "/"
@ -82,7 +82,6 @@ INSTALLED_APPS = (
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
@ -179,7 +178,9 @@ ROOT_URLCONF = 'dynamicweb.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(PROJECT_DIR, 'membership'), 'DIRS': [os.path.join(PROJECT_DIR, 'cms_templates/'),
os.path.join(PROJECT_DIR, 'cms_templates/djangocms_blog/'),
os.path.join(PROJECT_DIR, 'membership'),
os.path.join(PROJECT_DIR, 'hosting/templates/'), os.path.join(PROJECT_DIR, 'hosting/templates/'),
os.path.join(PROJECT_DIR, 'nosystemd/templates/'), os.path.join(PROJECT_DIR, 'nosystemd/templates/'),
os.path.join(PROJECT_DIR, os.path.join(PROJECT_DIR,
@ -190,8 +191,6 @@ TEMPLATES = [
os.path.join(PROJECT_DIR, os.path.join(PROJECT_DIR,
'ungleich_page/templates/ungleich_page'), 'ungleich_page/templates/ungleich_page'),
os.path.join(PROJECT_DIR, 'templates/analytics'), os.path.join(PROJECT_DIR, 'templates/analytics'),
os.path.join(PROJECT_DIR, 'cms_templates/'),
os.path.join(PROJECT_DIR, 'cms_templates/djangocms_blog/'),
], ],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
@ -256,10 +255,6 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
FORMAT_MODULE_PATH = [
'dynamicweb.formats'
]
LANGUAGES = ( LANGUAGES = (
('en-us', _('English')), ('en-us', _('English')),
('de', _('Deutsch')), ('de', _('Deutsch')),
@ -268,6 +263,7 @@ LANGUAGES = (
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
LOCALE_PATHS = [ LOCALE_PATHS = [
os.path.join(PROJECT_DIR, 'digitalglarus/locale'), os.path.join(PROJECT_DIR, 'digitalglarus/locale'),
] ]
@ -356,18 +352,6 @@ CMS_PLACEHOLDER_CONF = {
}, },
] ]
}, },
'datacenterlight_calculator': {
'name': _('Datacenterlight Calculator'),
'plugins': ['DCLCalculatorPlugin'],
'default_plugins': [
{
'plugin_type': 'DCLCalculatorPlugin',
'values': {
'pricing_id': 1
},
},
]
},
} }
CMS_PERMISSION = True CMS_PERMISSION = True
@ -532,7 +516,7 @@ META_INCLUDE_KEYWORDS = ["ungleich", "hosting", "switzerland",
"Schweiz", "Swiss", "cdist"] "Schweiz", "Swiss", "cdist"]
META_USE_SITES = True META_USE_SITES = True
PARLER_LANGUAGES = {SITE_ID: ({'code': 'en-us'}, {'code': 'de'},)} PARLER_LANGUAGES = {1: ({'code': 'en-us'}, {'code': 'de'},)}
AUTH_USER_MODEL = 'membership.CustomUser' AUTH_USER_MODEL = 'membership.CustomUser'
# PAYMENT # PAYMENT
@ -580,6 +564,7 @@ MULTISITE_FALLBACK_KWARGS = {
FILER_ENABLE_PERMISSIONS = True FILER_ENABLE_PERMISSIONS = True
############################################# #############################################
# configurations for opennebula-integration # # configurations for opennebula-integration #
############################################# #############################################
@ -629,7 +614,6 @@ GOOGLE_ANALYTICS_PROPERTY_IDS = {
'ipv6onlyhosting.ch': 'UA-62285904-10', 'ipv6onlyhosting.ch': 'UA-62285904-10',
'ipv6onlyhosting.net': 'UA-62285904-10', 'ipv6onlyhosting.net': 'UA-62285904-10',
'ipv6onlyhosting.com': 'UA-62285904-10', 'ipv6onlyhosting.com': 'UA-62285904-10',
'comic.ungleich.ch': 'UA-62285904-13',
'127.0.0.1:8000': 'localhost', '127.0.0.1:8000': 'localhost',
'dynamicweb-development.ungleich.ch': 'development', 'dynamicweb-development.ungleich.ch': 'development',
'dynamicweb-staging.ungleich.ch': 'staging' 'dynamicweb-staging.ungleich.ch': 'staging'
@ -701,12 +685,6 @@ if ENABLE_LOGGING:
TEST_MANAGE_SSH_KEY_PUBKEY = env('TEST_MANAGE_SSH_KEY_PUBKEY') TEST_MANAGE_SSH_KEY_PUBKEY = env('TEST_MANAGE_SSH_KEY_PUBKEY')
TEST_MANAGE_SSH_KEY_HOST = env('TEST_MANAGE_SSH_KEY_HOST') TEST_MANAGE_SSH_KEY_HOST = env('TEST_MANAGE_SSH_KEY_HOST')
X_FRAME_OPTIONS_ALLOW_FROM_URI = env('X_FRAME_OPTIONS_ALLOW_FROM_URI')
X_FRAME_OPTIONS = ('SAMEORIGIN' if X_FRAME_OPTIONS_ALLOW_FROM_URI is None else
'ALLOW-FROM {}'.format(
X_FRAME_OPTIONS_ALLOW_FROM_URI.strip()
))
DEBUG = bool_env('DEBUG') DEBUG = bool_env('DEBUG')
if DEBUG: if DEBUG:

View file

@ -1,7 +1,5 @@
from cms.models.pagemodel import Page
from django.conf.urls import include, url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
from django.contrib.sites.models import Site
from django.conf.urls.i18n import i18n_patterns from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static from django.conf.urls.static import static
from django.views import i18n, static as static_view from django.views import i18n, static as static_view
@ -10,7 +8,6 @@ from django.conf import settings
from hosting.views import ( from hosting.views import (
RailsHostingView, DjangoHostingView, NodeJSHostingView RailsHostingView, DjangoHostingView, NodeJSHostingView
) )
from datacenterlight.views import PaymentOrderView
from membership import urls as membership_urls from membership import urls as membership_urls
from ungleich_page.views import LandingView from ungleich_page.views import LandingView
from django.views.generic import RedirectView from django.views.generic import RedirectView
@ -19,8 +16,8 @@ import debug_toolbar
urlpatterns = [ urlpatterns = [
url(r'^index.html$', LandingView.as_view()), url(r'^index.html$', LandingView.as_view()),
url(r'^open_api/', url(r'^open_api/', include('opennebula_api.urls',
include('opennebula_api.urls', namespace='opennebula_api')), namespace='opennebula_api')),
url(r'^railshosting/', RailsHostingView.as_view(), url(r'^railshosting/', RailsHostingView.as_view(),
name="rails.hosting"), name="rails.hosting"),
url(r'^nodehosting/', NodeJSHostingView.as_view(), url(r'^nodehosting/', NodeJSHostingView.as_view(),
@ -29,10 +26,8 @@ urlpatterns = [
name="django.hosting"), name="django.hosting"),
url(r'^nosystemd/', include('nosystemd.urls', namespace="nosystemd")), url(r'^nosystemd/', include('nosystemd.urls', namespace="nosystemd")),
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')), url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
url(r'^jsi18n/(?P<packages>\S+?)/$', i18n.javascript_catalog), url(r'^jsi18n/(?P<packages>\S+?)/$',
url(r'^product/(?P<product_slug>[\w-]+)/$', i18n.javascript_catalog),
PaymentOrderView.as_view(),
name='show_product'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += i18n_patterns( urlpatterns += i18n_patterns(
@ -40,31 +35,30 @@ urlpatterns += i18n_patterns(
) )
# note the django CMS URLs included via i18n_patterns # note the django CMS URLs included via i18n_patterns
REDIRECT_TO_CMS = False
if Page.objects.filter(site_id=Site.objects.get_current().id).count():
REDIRECT_TO_CMS = True
urlpatterns += i18n_patterns( urlpatterns += i18n_patterns(
url(r'^$', LandingView.as_view()),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^datacenterlight/', url(r'^datacenterlight/',
include('datacenterlight.urls', namespace="datacenterlight")), include('datacenterlight.urls', namespace="datacenterlight")),
url(r'^hosting/', RedirectView.as_view(url=reverse_lazy('hosting:login')), url(r'^hosting/', RedirectView.as_view(
name='redirect_hosting_login'), url=reverse_lazy('hosting:login')), name='redirect_hosting_login'),
url(r'^alplora/', include('alplora.urls', namespace="alplora")), url(r'^alplora/', include('alplora.urls', namespace="alplora")),
url(r'^membership/', include(membership_urls)), url(r'^membership/', include(membership_urls)),
url(r'^digitalglarus/', url(r'^digitalglarus/', include('digitalglarus.urls',
include('digitalglarus.urls', namespace="digitalglarus")), namespace="digitalglarus")),
url(r'^cms/blog/', include('ungleich.urls', namespace='ungleich')), # url(r'^blog/', include('ungleich.urls', namespace='ungleich')),
url(r'^blog/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>\w[-\w]*)/$', url(r'^',
include('ungleich_page.urls',
namespace='ungleich_page'),
name='ungleich_page'),
url(r'^cms/blog/',
include('ungleich.urls', namespace='ungleich')),
url(
r'^blog/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>\w[-\w]*)/$',
RedirectView.as_view(pattern_name='ungleich:post-detail')), RedirectView.as_view(pattern_name='ungleich:post-detail')),
url(r'^blog/$', url(r'^blog/|cms/$', RedirectView.as_view(
RedirectView.as_view(url=reverse_lazy('ungleich:post-list')), url=reverse_lazy('ungleich:post-list')), name='blog_list_view'),
name='blog_list_view'),
url(r'^cms/', include('cms.urls')), url(r'^cms/', include('cms.urls')),
url(r'^blog/', include('djangocms_blog.urls', namespace='djangocms_blog')),
url(r'^$', RedirectView.as_view(url='/cms') if REDIRECT_TO_CMS
else LandingView.as_view()),
url(r'^', include('ungleich_page.urls', namespace='ungleich_page')),
) )
urlpatterns += [ urlpatterns += [

View file

@ -3,12 +3,10 @@ from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin from django.contrib import admin
from django.views import static as static_view from django.views import static as static_view
from django.views.generic import RedirectView
urlpatterns = i18n_patterns( urlpatterns = i18n_patterns(
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(r'^cms/', include('cms.urls')), url(r'^cms/', include('cms.urls')),
url(r'^$', RedirectView.as_view(url='/cms')),
) )
urlpatterns += [ urlpatterns += [

View file

@ -1,8 +1,8 @@
from django.contrib import admin from django.contrib import admin
from .models import HostingOrder, HostingBill, HostingPlan, GenericProduct from .models import HostingOrder, HostingBill, HostingPlan
admin.site.register(HostingOrder) admin.site.register(HostingOrder)
admin.site.register(HostingBill) admin.site.register(HostingBill)
admin.site.register(HostingPlan) admin.site.register(HostingPlan)
admin.site.register(GenericProduct)

View file

@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _
from membership.models import CustomUser from membership.models import CustomUser
from utils.hosting_utils import get_all_public_keys from utils.hosting_utils import get_all_public_keys
from .models import UserHostingKey, GenericProduct from .models import UserHostingKey
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -52,93 +52,6 @@ class HostingUserLoginForm(forms.Form):
raise forms.ValidationError(_("User does not exist")) raise forms.ValidationError(_("User does not exist"))
class ProductModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return obj.product_name
class GenericPaymentForm(forms.Form):
product_name = ProductModelChoiceField(
queryset=GenericProduct.objects.all().order_by('product_name'),
empty_label=_("Choose a product"),
)
amount = forms.FloatField(
widget=forms.TextInput(
attrs={'placeholder': _('Amount in CHF'),
'readonly': 'readonly', }
),
max_value=999999,
min_value=1,
label=_('Amount in CHF')
)
recurring = forms.BooleanField(required=False,
label=_("Recurring monthly"), )
description = forms.CharField(
widget=forms.Textarea(attrs={'style': "height: 60px;"}),
required=False
)
class Meta:
model = GenericProduct
fields = ['product_name', 'amount', 'recurring', 'description']
def clean_amount(self):
amount = self.cleaned_data.get('amount')
if (float(self.cleaned_data.get('product_name').get_actual_price()) !=
amount):
raise forms.ValidationError(_("Amount field does not match"))
return amount
def clean_recurring(self):
recurring = self.cleaned_data.get('recurring')
if (self.cleaned_data.get('product_name').product_is_subscription !=
(True if recurring else False)):
raise forms.ValidationError(_("Recurring field does not match"))
return recurring
class ProductPaymentForm(GenericPaymentForm):
def __init__(self, *args, **kwargs):
product_id = kwargs.pop('product_id', None)
if product_id is not None:
self.product = GenericProduct.objects.get(id=product_id)
super(ProductPaymentForm, self).__init__(*args, **kwargs)
self.fields['product_name'] = forms.CharField(
widget=forms.TextInput(
attrs={'placeholder': _('Product name'),
'readonly': 'readonly'}
)
)
if self.product.product_is_subscription:
self.fields['amount'].label = "{amt} ({payment_type})".format(
amt=_('Amount in CHF'),
payment_type=_('Monthly subscription')
)
else:
self.fields['amount'].label = "{amt} ({payment_type})".format(
amt=_('Amount in CHF'),
payment_type=_('One time payment')
)
self.fields['recurring'].widget = forms.HiddenInput()
self.fields['product_name'].widget.attrs['class'] = 'input-no-border'
self.fields['amount'].widget.attrs['class'] = 'input-no-border'
self.fields['description'].widget.attrs['class'] = 'input-no-border'
def clean_amount(self):
amount = self.cleaned_data.get('amount')
if (self.product is None or
float(self.product.get_actual_price()) != amount):
raise forms.ValidationError(_("Amount field does not match"))
return amount
def clean_recurring(self):
recurring = self.cleaned_data.get('recurring')
if (self.product.product_is_subscription !=
(True if recurring else False)):
raise forms.ValidationError(_("Recurring field does not match"))
return recurring
class HostingUserSignupForm(forms.ModelForm): class HostingUserSignupForm(forms.ModelForm):
confirm_password = forms.CharField(label=_("Confirm Password"), confirm_password = forms.CharField(label=_("Confirm Password"),
widget=forms.PasswordInput()) widget=forms.PasswordInput())
@ -198,7 +111,7 @@ class UserHostingKeyForm(forms.ModelForm):
public_key=openssh_pubkey_str).first().name public_key=openssh_pubkey_str).first().name
KEY_EXISTS_MESSAGE = _( KEY_EXISTS_MESSAGE = _(
"This key exists already with the name \"%(name)s\"") % { "This key exists already with the name \"%(name)s\"") % {
'name': key_name} 'name': key_name}
raise forms.ValidationError(KEY_EXISTS_MESSAGE) raise forms.ValidationError(KEY_EXISTS_MESSAGE)
with tempfile.NamedTemporaryFile(delete=True) as tmp_public_key_file: with tempfile.NamedTemporaryFile(delete=True) as tmp_public_key_file:

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-08 08:45+0000\n" "POT-Creation-Date: 2017-12-21 00:23+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -209,7 +209,7 @@ msgstr "Du hast eine neue virtuelle Maschine bestellt!"
#, python-format #, python-format
msgid "Your order of <strong>%(vm_name)s</strong> has been charged." msgid "Your order of <strong>%(vm_name)s</strong> has been charged."
msgstr "Deine Bestellung von <strong>%(vm_name)s</strong> wurde entgegengenommen." msgstr "Deine Bestellung von <strong>%(vm_name)s</strong> wurde erhoben."
msgid "You can view your VM detail by clicking the button below." msgid "You can view your VM detail by clicking the button below."
msgstr "Um die Rechnung zu sehen, klicke auf den Button unten." msgstr "Um die Rechnung zu sehen, klicke auf den Button unten."
@ -222,7 +222,7 @@ msgstr "Dein Data Center Light Team"
#, python-format #, python-format
msgid "Your order of %(vm_name)s has been charged." msgid "Your order of %(vm_name)s has been charged."
msgstr "Deine Bestellung von %(vm_name)s wurde entgegengenommen." msgstr "Deine Bestellung von %(vm_name)s wurde erhoben."
msgid "You can view your VM detail by following the link below." msgid "You can view your VM detail by following the link below."
msgstr "Um die Rechnung zu sehen, klicke auf den Link unten." msgstr "Um die Rechnung zu sehen, klicke auf den Link unten."
@ -249,7 +249,7 @@ msgstr "VM Kündigung"
#, python-format #, python-format
msgid "" msgid ""
"You are receiving this email because your virtual machine <strong>" "You are receiving this email because your virutal machine <strong>"
"%(vm_name)s</strong> has been cancelled." "%(vm_name)s</strong> has been cancelled."
msgstr "" msgstr ""
"Du erhälst diese E-Mail, da deine virtuelle Maschine <strong>%(vm_name)s</" "Du erhälst diese E-Mail, da deine virtuelle Maschine <strong>%(vm_name)s</"
@ -265,7 +265,7 @@ msgstr "NEUE VM"
#, python-format #, python-format
msgid "" msgid ""
"You are receiving this email because your virtual machine %(vm_name)s has " "You are receiving this email because your virutal machine %(vm_name)s has "
"been cancelled." "been cancelled."
msgstr "" msgstr ""
"Du erhälst diese E-Mail, da deine virtuelle Maschine %(vm_name)s gekündigt " "Du erhälst diese E-Mail, da deine virtuelle Maschine %(vm_name)s gekündigt "
@ -274,28 +274,6 @@ msgstr ""
msgid "You can always order a new VM by following the link below." msgid "You can always order a new VM by following the link below."
msgstr "" msgstr ""
msgid "Card Number"
msgstr "Kreditkartennummer"
msgid "Expiry Date"
msgstr "Ablaufdatum"
msgid "CVC"
msgstr ""
msgid "Card Type"
msgstr "Kartentyp"
msgid ""
"You are not making any payment yet. After placing your order, you will be "
"taken to the Submit Payment Page."
msgstr ""
"Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst ausgelöst, "
"nachdem Du die Bestellung auf der nächsten Seite bestätigt hast."
msgid "SUBMIT"
msgstr "ABSENDEN"
msgid "Toggle navigation" msgid "Toggle navigation"
msgstr "Umschalten" msgstr "Umschalten"
@ -387,24 +365,15 @@ msgstr "Arbeitsspeicher"
msgid "Disk space" msgid "Disk space"
msgstr "Festplattenkapazität" msgstr "Festplattenkapazität"
msgid "Subtotal"
msgstr "Zwischensumme"
msgid "VAT"
msgstr "Mehrwertsteuer"
msgid "Discount"
msgstr "Rabatt"
msgid "Total" msgid "Total"
msgstr "Gesamt" msgstr "Gesamt"
#, python-format #, python-format
msgid "" msgid ""
"By clicking \"Place order\" this plan will charge your credit card account " "By clicking \"Place order\" this plan will charge your credit card account "
"with %(vm_price)s CHF/month" "with the fee of %(vm_price)sCHF/month"
msgstr "" msgstr ""
"Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit %(vm_price)s CHF " "Wenn Du \"bestellen\" auswählst, wird Deine Kreditkarte mit %(vm_price)sCHF "
"pro Monat belastet" "pro Monat belastet"
msgid "Place order" msgid "Place order"
@ -452,26 +421,9 @@ msgstr "Konfiguration"
msgid "including VAT" msgid "including VAT"
msgstr "inkl. Mehrwertsteuer" msgstr "inkl. Mehrwertsteuer"
msgid "excluding VAT"
msgstr "exkl. Mehrwertsteuer"
msgid "Will be applied at checkout"
msgstr "wird an der Kasse angewendet"
msgid "Billing Address" msgid "Billing Address"
msgstr "Rechnungsadresse" msgstr "Rechnungsadresse"
msgid ""
"Please select one of the cards that you used before or fill in your credit "
"card information below. We are using <a href=\"https://stripe.com\" target="
"\"_blank\">Stripe</a> for payment and do not store your information in our "
"database."
msgstr ""
"Bitte wähle eine der zuvor genutzten Kreditkarten oder gib Deine "
"Kreditkartendetails unten an. Die Bezahlung wird über <a href=\"https://"
"stripe.com\" target=\"_blank\">Stripe</a> abgewickelt. Wir speichern Deine "
"Kreditkartendetails nicht in unserer Datenbank."
msgid "" msgid ""
"Please fill in your credit card information below. We are using <a href=" "Please fill in your credit card information below. We are using <a href="
"\"https://stripe.com\" target=\"_blank\">Stripe</a> for payment and do not " "\"https://stripe.com\" target=\"_blank\">Stripe</a> for payment and do not "
@ -481,24 +433,28 @@ msgstr ""
"\"https://stripe.com\" target=\"_blank\">Stripe</a> für die Bezahlung und " "\"https://stripe.com\" target=\"_blank\">Stripe</a> für die Bezahlung und "
"speichern keine Informationen in unserer Datenbank." "speichern keine Informationen in unserer Datenbank."
msgid "Last" msgid ""
msgstr "Letzten" "You are not making any payment yet. After submitting your card information, "
"you will be taken to the Confirm Order Page."
msgstr ""
"Es wird noch keine Bezahlung vorgenommen. Die Bezahlung wird erst ausgelöst, "
"nachdem Du die Bestellung auf der nächsten Seite bestätigt hast."
msgid "Type" msgid "SUBMIT"
msgstr "ABSENDEN"
msgid "Card Number"
msgstr "Kreditkartennummer"
msgid "Expiry Date"
msgstr "Ablaufdatum"
msgid "CVC"
msgstr ""
msgid "Card Type"
msgstr "Kartentyp" msgstr "Kartentyp"
msgid "SELECT"
msgstr "AUSWÄHLEN"
msgid "Add a new credit card"
msgstr "Eine neue Kreditkarte hinzufügen"
msgid "NEW CARD"
msgstr "BEARBEITEN"
msgid "New Credit Card"
msgstr "Neue Kreditkarte"
msgid "Processing" msgid "Processing"
msgstr "Weiter" msgstr "Weiter"
@ -512,22 +468,13 @@ msgid "Password reset"
msgstr "Passwort zurücksetzen" msgstr "Passwort zurücksetzen"
msgid "UPDATE" msgid "UPDATE"
msgstr "AKTUALISIEREN" msgstr ""
msgid "REMOVE CARD" msgid "Last"
msgstr "KARTE ENTFERNEN" msgstr ""
msgid "Remove Card" msgid "Type"
msgstr "Karte entfernen" msgstr "Kartentyp"
msgid "Do you want to remove this associated card?"
msgstr "Möchtest Du den Schlüssel löschen?"
msgid "Delete"
msgstr "Löschen"
msgid "DEFAULT"
msgstr "STANDARD"
msgid "No Credit Cards Added" msgid "No Credit Cards Added"
msgstr "Es wurde keine Kreditkarte hinzugefügt" msgstr "Es wurde keine Kreditkarte hinzugefügt"
@ -572,7 +519,10 @@ msgid "Public Key"
msgstr "" msgstr ""
msgid "Private Key" msgid "Private Key"
msgstr "Privater Schlüssel" msgstr ""
msgid "Delete"
msgstr "Löschen"
msgid "Delete SSH Key" msgid "Delete SSH Key"
msgstr "SSH Key löschen" msgstr "SSH Key löschen"
@ -630,12 +580,6 @@ msgstr ""
"Bitte entschuldige, es scheint ein unerwarteter Fehler aufgetreten zu sein. " "Bitte entschuldige, es scheint ein unerwarteter Fehler aufgetreten zu sein. "
"Versuche es doch bitte noch einmal." "Versuche es doch bitte noch einmal."
msgid "Attention:"
msgstr "Achtung:"
msgid "terminating VM can not be reverted."
msgstr "Das Beenden kann nicht rückgängig gemacht werden."
msgid "Something doesn't work?" msgid "Something doesn't work?"
msgstr "Etwas funktioniert nicht?" msgstr "Etwas funktioniert nicht?"
@ -648,12 +592,8 @@ msgstr "KONTAKT"
msgid "Terminate your Virtual Machine" msgid "Terminate your Virtual Machine"
msgstr "Deine Virtuelle Maschine beenden" msgstr "Deine Virtuelle Maschine beenden"
msgid "" msgid "Do you want to cancel your Virtual Machine"
"Terminated VMs can not be revived and will not be refunded. Do you want to " msgstr "Bist Du sicher, dass Du Deine virtuelle Maschine beenden willst"
"terminate your VM?"
msgstr ""
"Beendete VMs können nicht wiederhergestellt oder erstattet werden. Möchtest "
"du die VM beenden?"
#, python-format #, python-format
msgid "" msgid ""
@ -715,36 +655,6 @@ msgstr "Dein Passwort konnte nicht zurückgesetzt werden."
msgid "The reset password link is no longer valid." msgid "The reset password link is no longer valid."
msgstr "Der Link zum Zurücksetzen Deines Passwortes ist nicht mehr gültig." msgstr "Der Link zum Zurücksetzen Deines Passwortes ist nicht mehr gültig."
msgid "Card deassociation successful"
msgstr "Die Verbindung mit der Karte wurde erfolgreich aufgehoben"
msgid "You are not permitted to do this operation"
msgstr "Du hast keine Erlaubnis um diese Operation durchzuführen"
msgid "The selected card does not exist"
msgstr "Die ausgewählte Karte existiert nicht"
msgid "Billing address updated successfully"
msgstr "Die Rechnungsadresse wurde erfolgreich aktualisiert"
msgid "You seem to have already added this card"
msgstr "Es scheint, als hättest du diese Karte bereits hinzugefügt"
#, python-brace-format
msgid "An error occurred while associating the card. Details: {details}"
msgstr ""
"Beim Verbinden der Karte ist ein Fehler aufgetreten. Details: {details}"
msgid "Successfully associated the card with your account"
msgstr "Die Karte wurde erfolgreich mit deinem Konto verbunden"
#, python-brace-format
msgid "{user} does not have permission to access the card"
msgstr "{user} hat keine Erlaubnis auf diese Karte zuzugreifen"
msgid "An error occurred. Details: {}"
msgstr "Ein Fehler ist aufgetreten. Details: {}"
msgid "Invalid credit card" msgid "Invalid credit card"
msgstr "Ungültige Kreditkarte" msgstr "Ungültige Kreditkarte"
@ -789,10 +699,6 @@ msgstr "Ungültige RAM-Grösse"
msgid "Invalid storage size" msgid "Invalid storage size"
msgstr "Ungültige Speicher-Grösse" msgstr "Ungültige Speicher-Grösse"
#, python-brace-format
msgid "Incorrect pricing name. Please contact support{support_email}"
msgstr ""
msgid "" msgid ""
"We could not find the requested VM. Please " "We could not find the requested VM. Please "
"contact Data Center Light Support." "contact Data Center Light Support."
@ -807,11 +713,6 @@ msgstr ""
msgid "Error terminating VM" msgid "Error terminating VM"
msgstr "Fehler beenden VM" msgstr "Fehler beenden VM"
msgid ""
"VM terminate action timed out. Please contact support@datacenterlight.ch for "
"further information."
msgstr ""
#, python-format #, python-format
msgid "Virtual Machine %(vm_name)s Cancelled" msgid "Virtual Machine %(vm_name)s Cancelled"
msgstr "Virtuelle Maschine %(vm_name)s Kündigung" msgstr "Virtuelle Maschine %(vm_name)s Kündigung"
@ -821,9 +722,6 @@ msgstr ""
"Es gab einen Fehler bei der Bearbeitung Deine Anfrage. Bitte versuche es " "Es gab einen Fehler bei der Bearbeitung Deine Anfrage. Bitte versuche es "
"noch einmal." "noch einmal."
#~ msgid "Do you want to cancel your Virtual Machine"
#~ msgstr "Bist Du sicher, dass Du Deine virtuelle Maschine beenden willst"
#~ msgid "Reset your password" #~ msgid "Reset your password"
#~ msgstr "Passwort zurücksetzen" #~ msgstr "Passwort zurücksetzen"
@ -890,6 +788,15 @@ msgstr ""
#~ msgid "Notifications " #~ msgid "Notifications "
#~ msgstr "Benachrichtigungen" #~ msgstr "Benachrichtigungen"
#~ msgid "REMOVE CARD"
#~ msgstr "KARTE ENTFERNEN"
#~ msgid "EDIT CARD"
#~ msgstr "BEARBEITEN"
#~ msgid "Add a new Card."
#~ msgstr "Neue Kreditkarte hinzufügen."
#~ msgid "You are not making any payment here." #~ msgid "You are not making any payment here."
#~ msgstr "Es wird noch keine Bezahlung vorgenommen" #~ msgstr "Es wird noch keine Bezahlung vorgenommen"

View file

@ -1,45 +0,0 @@
from django.core.management.base import BaseCommand
from hosting.models import UserCardDetail
from membership.models import CustomUser
from utils.stripe_utils import StripeUtils
class Command(BaseCommand):
help = '''Imports the usercard details of all customers. Created just for
multiple card support.'''
def handle(self, *args, **options):
try:
stripe_utils = StripeUtils()
for user in CustomUser.objects.all():
if hasattr(user, 'stripecustomer'):
if user.stripecustomer:
card_details_resp = stripe_utils.get_card_details(
user.stripecustomer.stripe_id
)
card_details = card_details_resp['response_object']
if card_details:
ucd = UserCardDetail.get_or_create_user_card_detail(
stripe_customer=user.stripecustomer,
card_details=card_details
)
UserCardDetail.save_default_card_local(
user.stripecustomer.stripe_id,
ucd.card_id
)
print("Saved user card details for {}".format(
user.email
))
else:
print(" --- Could not get card details for "
"{}".format(user.email))
print(" --- Error: {}".format(
card_details_resp['error']
))
else:
print(" === {} does not have a StripeCustomer object".format(
user.email
))
except Exception as e:
print(" *** Error occurred. Details {}".format(str(e)))

View file

@ -1,23 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-04-16 00:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0019_auto_20180415_2236'),
('hosting', '0043_vmdetail'),
]
operations = [
migrations.AddField(
model_name='hostingorder',
name='vm_pricing',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='datacenterlight.VMPricing'),
preserve_default=False,
),
]

View file

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-07-01 20:28
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import utils.mixins
class Migration(migrations.Migration):
dependencies = [
('datacenterlight', '0024_dclcalculatorpluginmodel_vm_templates_to_show'),
('hosting', '0044_hostingorder_vm_pricing'),
]
operations = [
migrations.CreateModel(
name='OrderDetail',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cores', models.IntegerField(default=0)),
('memory', models.IntegerField(default=0)),
('hdd_size', models.IntegerField(default=0)),
('ssd_size', models.IntegerField(default=0)),
('vm_template', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='datacenterlight.VMTemplate')),
],
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.AddField(
model_name='hostingorder',
name='order_detail',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='hosting.OrderDetail'),
),
]

View file

@ -1,36 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-07-03 20:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import utils.mixins
class Migration(migrations.Migration):
dependencies = [
('membership', '0007_auto_20180213_0128'),
('hosting', '0045_auto_20180701_2028'),
]
operations = [
migrations.CreateModel(
name='UserCardDetail',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('last4', models.CharField(max_length=4)),
('brand', models.CharField(max_length=10)),
('card_id', models.CharField(blank=True, default='', max_length=100)),
('fingerprint', models.CharField(max_length=100)),
('exp_month', models.IntegerField()),
('exp_year', models.IntegerField()),
('preferred', models.BooleanField(default=False)),
('stripe_customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='membership.StripeCustomer')),
],
options={
'permissions': (('view_usercarddetail', 'View User Card'),),
},
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
]

View file

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-08-21 12:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hosting', '0046_usercarddetail'),
]
operations = [
migrations.AlterField(
model_name='hostingorder',
name='cc_brand',
field=models.CharField(max_length=128),
),
migrations.AlterField(
model_name='usercarddetail',
name='brand',
field=models.CharField(max_length=128),
),
]

View file

@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-10-03 07:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import utils.mixins
class Migration(migrations.Migration):
dependencies = [
('hosting', '0047_auto_20180821_1240'),
]
operations = [
migrations.CreateModel(
name='GenericProduct',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('product_name', models.CharField(default='', max_length=128)),
('product_slug', models.SlugField(help_text='An optional html id for the Section. Required to set as target of a link on page', unique=True)),
('product_description', models.CharField(default='', max_length=500)),
('created_at', models.DateTimeField(auto_now_add=True)),
('product_price', models.DecimalField(decimal_places=2, max_digits=6)),
('product_vat', models.DecimalField(decimal_places=4, default=0, max_digits=6)),
('product_is_subscription', models.BooleanField(default=True)),
],
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.AddField(
model_name='hostingorder',
name='generic_payment_description',
field=models.CharField(max_length=500, null=True),
),
migrations.AddField(
model_name='hostingorder',
name='generic_product',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='hosting.GenericProduct'),
),
]

View file

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-10-05 07:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hosting', '0048_auto_20181003_0757'),
]
operations = [
migrations.AlterField(
model_name='genericproduct',
name='product_slug',
field=models.SlugField(help_text='An mandatory unique slug for the product', unique=True),
),
]

View file

@ -1,5 +1,4 @@
from django.shortcuts import redirect from django.shortcuts import redirect
from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from opennebula_api.serializers import VirtualMachineTemplateSerializer from opennebula_api.serializers import VirtualMachineTemplateSerializer
@ -25,10 +24,3 @@ class ProcessVMSelectionMixin(object):
request.session['next'] = reverse('hosting:payment') request.session['next'] = reverse('hosting:payment')
return redirect(reverse('hosting:login')) return redirect(reverse('hosting:login'))
return redirect(reverse('hosting:payment')) return redirect(reverse('hosting:payment'))
class HostingContextMixin(object):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['MULTISITE_CMS_FALLBACK'] = settings.MULTISITE_CMS_FALLBACK
return context

View file

@ -1,17 +1,14 @@
import logging
import os import os
import logging
from Crypto.PublicKey import RSA
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from django.utils.functional import cached_property from django.utils.functional import cached_property
from Crypto.PublicKey import RSA
from datacenterlight.models import VMPricing, VMTemplate
from membership.models import StripeCustomer, CustomUser from membership.models import StripeCustomer, CustomUser
from utils.mixins import AssignPermissionsMixin
from utils.models import BillingAddress from utils.models import BillingAddress
from utils.stripe_utils import StripeUtils from utils.mixins import AssignPermissionsMixin
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -42,49 +39,6 @@ class HostingPlan(models.Model):
return price return price
class OrderDetail(AssignPermissionsMixin, models.Model):
vm_template = models.ForeignKey(
VMTemplate, blank=True, null=True, default=None,
on_delete=models.SET_NULL
)
cores = models.IntegerField(default=0)
memory = models.IntegerField(default=0)
hdd_size = models.IntegerField(default=0)
ssd_size = models.IntegerField(default=0)
def __str__(self):
return "Not available" if self.vm_template is None else (
"%s - %s, %s cores, %s GB RAM, %s GB SSD" % (
self.vm_template.name, self.vm_template.vm_type, self.cores,
self.memory, self.ssd_size
)
)
class GenericProduct(AssignPermissionsMixin, models.Model):
permissions = ('view_genericproduct',)
product_name = models.CharField(max_length=128, default="")
product_slug = models.SlugField(
unique=True,
help_text=(
'An mandatory unique slug for the product'
)
)
product_description = models.CharField(max_length=500, default="")
created_at = models.DateTimeField(auto_now_add=True)
product_price = models.DecimalField(max_digits=6, decimal_places=2)
product_vat = models.DecimalField(max_digits=6, decimal_places=4, default=0)
product_is_subscription = models.BooleanField(default=True)
def __str__(self):
return self.product_name
def get_actual_price(self):
return round(
self.product_price + (self.product_price * self.product_vat), 2
)
class HostingOrder(AssignPermissionsMixin, models.Model): class HostingOrder(AssignPermissionsMixin, models.Model):
ORDER_APPROVED_STATUS = 'Approved' ORDER_APPROVED_STATUS = 'Approved'
ORDER_DECLINED_STATUS = 'Declined' ORDER_DECLINED_STATUS = 'Declined'
@ -95,22 +49,11 @@ class HostingOrder(AssignPermissionsMixin, models.Model):
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
approved = models.BooleanField(default=False) approved = models.BooleanField(default=False)
last4 = models.CharField(max_length=4) last4 = models.CharField(max_length=4)
cc_brand = models.CharField(max_length=128) cc_brand = models.CharField(max_length=10)
stripe_charge_id = models.CharField(max_length=100, null=True) stripe_charge_id = models.CharField(max_length=100, null=True)
price = models.FloatField() price = models.FloatField()
subscription_id = models.CharField(max_length=100, null=True) subscription_id = models.CharField(max_length=100, null=True)
vm_pricing = models.ForeignKey(VMPricing)
order_detail = models.ForeignKey(
OrderDetail, null=True, blank=True, default=None,
on_delete=models.SET_NULL
)
generic_product = models.ForeignKey(
GenericProduct, null=True, blank=True, default=None,
on_delete=models.SET_NULL
)
generic_payment_description = models.CharField(
max_length=500, null=True
)
permissions = ('view_hostingorder',) permissions = ('view_hostingorder',)
class Meta: class Meta:
@ -119,32 +62,20 @@ class HostingOrder(AssignPermissionsMixin, models.Model):
) )
def __str__(self): def __str__(self):
hosting_order_str = ("Order Nr: #{} - VM_ID: {} - {} - {} - " return "%s" % (self.id)
"Specs: {} - Price: {}").format(
self.id, self.vm_id, self.customer.user.email, self.created_at,
self.order_detail, self.price
)
if self.generic_product_id is not None:
hosting_order_str += " - Generic Payment"
if self.stripe_charge_id is not None:
hosting_order_str += " - One time charge"
else:
hosting_order_str += " - Recurring"
return hosting_order_str
@cached_property @cached_property
def status(self): def status(self):
return self.ORDER_APPROVED_STATUS if self.approved else self.ORDER_DECLINED_STATUS return self.ORDER_APPROVED_STATUS if self.approved else self.ORDER_DECLINED_STATUS
@classmethod @classmethod
def create(cls, price=None, vm_id=0, customer=None, def create(cls, price=None, vm_id=None, customer=None,
billing_address=None, vm_pricing=None): billing_address=None):
instance = cls.objects.create( instance = cls.objects.create(
price=price, price=price,
vm_id=vm_id, vm_id=vm_id,
customer=customer, customer=customer,
billing_address=billing_address, billing_address=billing_address
vm_pricing=vm_pricing
) )
instance.assign_permissions(customer.user) instance.assign_permissions(customer.user)
return instance return instance
@ -249,156 +180,3 @@ class VMDetail(models.Model):
months = relativedelta(end_date, self.created_at).months or 1 months = relativedelta(end_date, self.created_at).months or 1
end_date = self.created_at + relativedelta(months=months, days=-1) end_date = self.created_at + relativedelta(months=months, days=-1)
return end_date return end_date
class UserCardDetail(AssignPermissionsMixin, models.Model):
permissions = ('view_usercarddetail',)
stripe_customer = models.ForeignKey(StripeCustomer)
last4 = models.CharField(max_length=4)
brand = models.CharField(max_length=128)
card_id = models.CharField(max_length=100, blank=True, default='')
fingerprint = models.CharField(max_length=100)
exp_month = models.IntegerField(null=False)
exp_year = models.IntegerField(null=False)
preferred = models.BooleanField(default=False)
class Meta:
permissions = (
('view_usercarddetail', 'View User Card'),
)
@classmethod
def create(cls, stripe_customer=None, last4=None, brand=None,
fingerprint=None, exp_month=None, exp_year=None, card_id=None,
preferred=False):
instance = cls.objects.create(
stripe_customer=stripe_customer, last4=last4, brand=brand,
fingerprint=fingerprint, exp_month=exp_month, exp_year=exp_year,
card_id=card_id, preferred=preferred
)
instance.assign_permissions(stripe_customer.user)
return instance
@classmethod
def get_all_cards_list(cls, stripe_customer):
"""
Get all the cards of the given customer as a list
:param stripe_customer: The StripeCustomer object
:return: A list of all cards; an empty list if the customer object is
None
"""
cards_list = []
if stripe_customer is None:
return cards_list
user_card_details = UserCardDetail.objects.filter(
stripe_customer_id=stripe_customer.id
).order_by('-preferred', 'id')
for card in user_card_details:
cards_list.append({
'last4': card.last4, 'brand': card.brand, 'id': card.id,
'preferred': card.preferred
})
return cards_list
@classmethod
def get_or_create_user_card_detail(cls, stripe_customer, card_details):
"""
A method that checks if a UserCardDetail object exists already
based upon the given card_details and creates it for the given
customer if it does not exist. It returns the UserCardDetail object
matching the given card_details if it exists.
:param stripe_customer: The given StripeCustomer object to whom the
card object should belong to
:param card_details: A dictionary identifying a given card
:return: UserCardDetail object
"""
try:
if ('fingerprint' in card_details and 'exp_month' in card_details
and 'exp_year' in card_details):
card_detail = UserCardDetail.objects.get(
stripe_customer=stripe_customer,
fingerprint=card_details['fingerprint'],
exp_month=card_details['exp_month'],
exp_year=card_details['exp_year']
)
else:
raise UserCardDetail.DoesNotExist()
except UserCardDetail.DoesNotExist:
preferred = False
if 'preferred' in card_details:
preferred = card_details['preferred']
card_detail = UserCardDetail.create(
stripe_customer=stripe_customer,
last4=card_details['last4'],
brand=card_details['brand'],
fingerprint=card_details['fingerprint'],
exp_month=card_details['exp_month'],
exp_year=card_details['exp_year'],
card_id=card_details['card_id'],
preferred=preferred
)
return card_detail
@staticmethod
def set_default_card(stripe_api_cus_id, stripe_source_id):
"""
Sets the given stripe source as the default source for the given
Stripe customer
:param stripe_api_cus_id: Stripe customer id
:param stripe_source_id: The Stripe source id
:return:
"""
stripe_utils = StripeUtils()
cus_response = stripe_utils.get_customer(stripe_api_cus_id)
cu = cus_response['response_object']
cu.default_source = stripe_source_id
cu.save()
UserCardDetail.save_default_card_local(
stripe_api_cus_id, stripe_source_id
)
@staticmethod
def set_default_card_from_stripe(stripe_api_cus_id):
stripe_utils = StripeUtils()
cus_response = stripe_utils.get_customer(stripe_api_cus_id)
cu = cus_response['response_object']
default_source = cu.default_source
if default_source is not None:
UserCardDetail.save_default_card_local(
stripe_api_cus_id, default_source
)
@staticmethod
def save_default_card_local(stripe_api_cus_id, card_id):
stripe_cust = StripeCustomer.objects.get(stripe_id=stripe_api_cus_id)
user_card_detail = UserCardDetail.objects.get(
stripe_customer=stripe_cust, card_id=card_id
)
for card in stripe_cust.usercarddetail_set.all():
card.preferred = False
card.save()
user_card_detail.preferred = True
user_card_detail.save()
@staticmethod
def get_user_card_details(stripe_customer, card_details):
"""
A utility function to check whether a StripeCustomer is already
associated with the card having given details
:param stripe_customer:
:param card_details:
:return: The UserCardDetails object if it exists, None otherwise
"""
try:
ucd = UserCardDetail.objects.get(
stripe_customer=stripe_customer,
fingerprint=card_details['fingerprint'],
exp_month=card_details['exp_month'],
exp_year=card_details['exp_year']
)
return ucd
except UserCardDetail.DoesNotExist:
return None

View file

@ -23,13 +23,6 @@
margin: 0 auto; margin: 0 auto;
max-width: 1120px; max-width: 1120px;
} }
.container-table{
margin-top: 35px;
overflow-y: hidden;
}
.container-table table{
overflow-y: auto;
}
.borderless td { .borderless td {
border: none !important; border: none !important;
} }
@ -42,19 +35,6 @@
color: transparent; color: transparent;
} }
.inline-headers h3, .inline-headers h4 {
display: inline-block;
vertical-align: baseline;
}
.space-above {
margin-top: 4%;
}
.space-above-big {
margin-top: 20%;
}
.table>tbody>tr>td{ .table>tbody>tr>td{
vertical-align: middle; vertical-align: middle;
} }
@ -294,26 +274,6 @@
font-size: 16px; font-size: 16px;
} }
.payment-container .credit-card-info {
padding-bottom: 15px;
border-bottom: 1px solid #eee;
}
.credit-card-info {
display: flex;
}
.credit-card-info .align-bottom{
align-self: flex-end;
padding-right: 0 !important;
}
.another-card-text {
padding: 20px 0;
font-size: 18px;
font-weight: 700;
}
.credit-card-form { .credit-card-form {
max-width: 360px; max-width: 360px;
} }
@ -333,15 +293,8 @@
text-decoration: none; text-decoration: none;
} }
.settings-container .new-card-head { .settings-container .credit-card-details-opt {
margin-top: 40px; padding-top: 15px;
margin-bottom: 30px;
}
.settings-container .new-card-head h4 {
font-size: 15px;
margin-top: 8px;
font-weight: 600;
} }
.caps-link .svg-img { .caps-link .svg-img {
@ -360,11 +313,7 @@
.settings-container .btn-vm-contact { .settings-container .btn-vm-contact {
font-weight: 600; font-weight: 600;
font-size: 13px; font-size: 13px;
} /* padding: 4px 15px; */
.settings-container .choice-btn {
letter-spacing: 2px;
min-width: 127px;
} }
.btn-wide { .btn-wide {
@ -406,37 +355,10 @@
fill: #999; fill: #999;
} }
.card-details-box {
border: 1px solid #eee;
padding: 5px 25px 25px;
}
.thick-hr {
border-top: 5px solid #eee;
}
.locale_date { .locale_date {
opacity: 0; opacity: 0;
} }
.locale_date.done{ .locale_date.done{
opacity: 1; opacity: 1;
}
.mb-0 {
margin-bottom: 0;
}
.thin-hr {
margin-top: 10px;
margin-bottom: 10px;
}
.new-card-head {
margin-top: 10px;
}
.new-card-button-margin button{
margin-top: 5px;
margin-bottom: 5px;
} }

View file

@ -426,7 +426,6 @@ footer {
right: 0; right: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
font-weight: 300;
} }
p.copyright { p.copyright {
@ -449,6 +448,230 @@ a.unlink:hover {
color: inherit; color: inherit;
} }
/***** DCL payment page **********/
.dcl-order-container {
font-weight: 300;
}
.dcl-order-table-header {
border-bottom: 1px solid #eee;
padding-top: 15px;
padding-bottom: 15px;
font-size: 16px;
color: #333;
text-align: center;
font-weight: 300;
}
.dcl-order-table-content {
border-bottom: 1px solid #eee;
padding-top: 15px;
padding-bottom: 15px;
font-size: 18px;
font-weight: 600;
text-align: center;
}
.tbl-content {
}
.dcl-order-table-total {
border-bottom: 4px solid #eee;
padding-top: 15px;
padding-bottom: 20px;
font-size: 20px;
font-weight: 600;
color: #999;
}
.dcl-order-table-total span {
font-size: 13px;
color: #999;
font-weight: 400;
padding-left: 5px;
}
.dcl-place-order-text{
color: #808080;
}
.dcl-order-table-total .tbl-total {
text-align: center;
color: #000;
padding-left: 44px;
}
.tbl-total .dcl-price-month {
font-size: 16px;
text-transform: capitalize;
color: #000;
}
.tbl-no-padding {
padding: 0px;
}
.dcl-billing-sec {
margin-top: 50px;
}
.dcl-order-sec {
padding: 0 30px;
}
.card-warning-content {
font-weight: 300;
border: 1px solid #a1a1a1;
border-radius: 3px;
padding: 5px;
margin-bottom: 15px;
}
.card-warning-error {
border: 1px solid #EB4D5C;
color: #EB4D5C;
}
.card-warning-addtional-margin {
margin-top: 15px;
}
.stripe-payment-btn {
outline: none;
width: auto;
float: right;
font-style: normal;
font-weight: 300;
position: absolute;
padding-left: 30px;
padding-right: 30px;
right: 0;
}
.card-cvc-element label {
padding-left: 10px;
}
.card-element {
margin-bottom: 10px;
}
.card-element label{
width:100%;
margin-bottom:0px;
}
.my-input {
border-bottom: 1px solid #ccc;
}
.card-cvc-element .my-input {
padding-left: 10px;
}
#card-errors {
clear: both;
padding: 0 0 10px;
color: #eb4d5c;
}
.credit-card-goup{
padding: 0;
}
@media (max-width: 767px) {
.dcl-order-table-total span {
padding-left: 3px;
}
.dcl-order-sec {
padding: 10px 20px 30px 20px;
border-bottom: 4px solid #eee;
}
.tbl-header {
border-bottom: 1px solid #eee;
padding: 10px 0;
}
.tbl-content {
border-bottom: 1px solid #eee;
padding: 10px 0;
}
.dcl-order-table-header {
border-bottom: 0px solid #eee;
padding: 10px 0;
text-align: left;
}
.dcl-order-table-content {
border-bottom: 0px solid #eee;
padding: 10px 0;
text-align: right;
font-size: 16px;
}
.dcl-order-table-total {
font-size: 18px;
color: #000;
padding: 10px 0;
border-bottom: 0px solid #eee;
}
.dcl-order-table-total .tbl-total {
padding: 0px;
text-align: right;
}
.dcl-billing-sec {
margin-top: 30px;
margin-bottom: 30px;
}
.card-expiry-element {
padding-right: 10px;
}
.card-cvc-element {
padding-left: 10px;
}
#billing-form .form-control {
box-shadow: none !important;
font-weight: 400;
}
}
@media (min-width: 1200px) {
.dcl-order-container {
width: 990px;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
}
@media (min-width: 768px) {
.dcl-billing {
padding-right: 65px;
border-right: 1px solid #eee;
}
.dcl-creditcard {
padding-left: 65px;
}
.tbl-tot {
padding-left: 17px;
}
.content-dashboard {
/*width: auto !important;*/
}
}
@media only screen and (max-width: 1040px) and (min-width: 768px) { @media only screen and (max-width: 1040px) and (min-width: 768px) {
.content-dashboard { .content-dashboard {
width: 96% !important; width: 96% !important;

View file

@ -3,7 +3,6 @@
margin: 100px auto 40px; margin: 100px auto 40px;
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 15px; padding: 15px;
color: #595959;
} }
@media(min-width: 768px) { @media(min-width: 768px) {
@ -49,6 +48,10 @@
margin-bottom: 15px; margin-bottom: 15px;
} }
.order-detail-container .order-details strong {
color: #595959;
}
.order-detail-container h4 { .order-detail-container h4 {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
@ -57,28 +60,13 @@
.order-detail-container p { .order-detail-container p {
margin-bottom: 5px; margin-bottom: 5px;
color: #595959;
} }
.order-detail-container hr { .order-detail-container hr {
margin: 15px 0; margin: 15px 0;
} }
.order-detail-container .thin-hr {
margin: 10px 0;
}
.order-detail-container .subtotal-price {
font-size: 16px;
}
.order-detail-container .subtotal-price .text-primary {
font-size: 17px;
}
.order-detail-container .total-price {
font-size: 18px;
}
@media (max-width: 767px) { @media (max-width: 767px) {
.order-confirm-btn { .order-confirm-btn {
text-align: center; text-align: center;
@ -108,8 +96,4 @@
#virtual_machine_create_form { #virtual_machine_create_form {
padding: 15px 0; padding: 15px 0;
}
.dcl-place-order-text {
color: #808080;
} }

View file

@ -1,35 +1,19 @@
.payment-container {
padding-top: 70px;
padding-bottom: 11%;
}
.creditcard-box .panel-title {
display: inline;
font-weight: bold;
font-size: 17px;
}
.creditcard-box .checkbox.pull-right {
margin: 0;
}
.creditcard-box .pl-ziro {
padding-left: 0px;
}
.payment-container {padding-top:70px; padding-bottom: 11%;}
.creditcard-box .panel-title {display: inline;font-weight: bold; font-size:17px;}
.creditcard-box .checkbox.pull-right { margin: 0; }
.creditcard-box .pl-ziro { padding-left: 0px; }
.creditcard-box .form-control.error { .creditcard-box .form-control.error {
border-color: red; border-color: red;
outline: 0; outline: 0;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6); box-shadow: inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(255,0,0,0.6);
} }
.creditcard-box label.error { .creditcard-box label.error {
font-weight: bold; font-weight: bold;
color: red; color: red;
padding: 2px 8px; padding: 2px 8px;
margin-top: 2px; margin-top: 2px;
} }
.creditcard-box .payment-errors { .creditcard-box .payment-errors {
font-weight: bold; font-weight: bold;
color: red; color: red;
@ -37,221 +21,96 @@
margin-top: 2px; margin-top: 2px;
} }
.dcl-order-sec { /* landing page payment new style */
padding: 0 30px; .last-p {
margin-bottom: 0;
}
.dcl-payment-section {
max-width: 391px;
margin: 0 auto 30px;
padding: 0 10px 30px;
border-bottom: 1px solid #edebeb;
height: 100%;
}
.dcl-payment-section hr{
margin-top: 15px;
margin-bottom: 15px;
}
.dcl-payment-section .top-hr {
margin-left: -10px;
}
.dcl-payment-section h3 {
font-weight: 600;
}
.dcl-payment-section p {
/*padding: 0 5px;*/
font-weight: 400;
}
.dcl-payment-section .card-warning-content {
padding: 8px 10px;
font-weight: 300;
}
.dcl-payment-order strong{
font-size: 17px;
}
.dcl-payment-order p {
font-weight: 300;
}
.dcl-payment-section .form-group {
margin-bottom: 10px;
}
.dcl-payment-section .form-control {
box-shadow: none;
padding: 6px 12px;
height: 32px;
}
.dcl-payment-user {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
} }
.dcl-billing-sec { .dcl-payment-user h4 {
margin-top: 50px; font-weight: 600;
} font-size: 17px;
.dcl-order-container {
font-weight: 300;
}
.dcl-order-table-header {
border-bottom: 1px solid #eee;
padding: 15px 10px;
font-size: 16px;
color: #333;
font-weight: 300;
}
.dcl-order-table-content {
border-bottom: 1px solid #eee;
padding: 15px 10px;
font-size: 18px;
font-weight: 600;
}
.dcl-order-table-total {
border-bottom: 4px solid #eee;
padding-top: 15px;
padding-bottom: 20px;
font-size: 20px;
font-weight: 600;
}
.dcl-order-table-total span {
font-size: 13px;
color: #999;
font-weight: 400;
}
.dcl-order-table-total .tbl-total {
text-align: right;
color: #000;
}
.tbl-no-padding {
padding: 0px;
}
.card-warning-content {
font-weight: 300;
border: 1px solid #a1a1a1;
border-radius: 3px;
padding: 5px;
margin-bottom: 15px;
}
.card-warning-error {
border: 1px solid #EB4D5C;
color: #EB4D5C;
}
.card-warning-addtional-margin {
margin-top: 15px;
}
.stripe-payment-btn {
outline: none;
width: auto;
float: right;
font-style: normal;
font-weight: 300;
position: absolute;
padding-left: 30px;
padding-right: 30px;
right: 0;
}
.card-cvc-element label {
padding-left: 10px;
}
.card-element {
margin-bottom: 10px;
}
.card-element label {
width: 100%;
margin-bottom: 0px;
}
.my-input {
border-bottom: 1px solid #ccc;
}
.card-cvc-element .my-input {
padding-left: 10px;
}
#card-errors {
clear: both;
padding: 0 0 10px;
color: #eb4d5c;
}
.credit-card-goup {
padding: 0;
}
@media (max-width: 767px) {
.dcl-order-sec {
padding: 10px 5px 30px;
border-bottom: 4px solid #eee;
}
.dcl-billing-sec {
margin-top: 30px;
margin-bottom: 30px;
padding: 5px;
}
.dcl-billing {
margin-top: 20px;
margin-bottom: 40px;
}
.tbl-header {
border-bottom: 1px solid #eee;
padding-top: 10px;
padding-bottom: 10px;
margin-right: -15px;
}
.dcl-order-table-total .tbl-total {
margin-left: -15px;
}
.dcl-order-table-total .tbl-tot {
margin-right: -15px;
}
.tbl-content {
border-bottom: 1px solid #eee;
padding-top: 10px;
padding-bottom: 10px;
margin-left: -15px;
}
.dcl-order-table-header {
border-bottom: 0px solid #eee;
padding: 10px 0;
text-align: left;
}
.dcl-order-table-content {
border-bottom: 0px solid #eee;
padding: 10px 0;
text-align: right;
font-size: 16px;
}
.dcl-order-table-total {
font-size: 18px;
color: #000;
padding: 10px 0;
border-bottom: 0px solid #eee;
}
.card-expiry-element {
padding-right: 10px;
}
.card-cvc-element {
padding-left: 10px;
}
#billing-form .form-control {
box-shadow: none !important;
font-weight: 400;
}
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.dcl-billing { .dcl-payment-grid {
padding-right: 65px; display: flex;
border-right: 1px solid #eee; align-items: stretch;
} flex-wrap: wrap;
}
.dcl-creditcard { .dcl-payment-box {
padding-left: 65px; width: 50%;
} position: relative;
padding: 0 30px;
.dcl-order-table-total .tbl-total, }
.dcl-order-table-total .tbl-tot { .dcl-payment-box:nth-child(2) {
padding: 0 10px; order: 1;
} }
.dcl-payment-box:nth-child(4) {
.tbl-header-center, order: 2;
.tbl-content-center { }
text-align: center; .dcl-payment-section {
} padding: 15px 10px;
margin-bottom: 0;
.tbl-header-right, border-bottom-width: 5px;
.tbl-content-right { }
text-align: right; .dcl-payment-box:nth-child(2n) .dcl-payment-section {
} border-bottom: none;
}
.dcl-payment-box:nth-child(1):after,
.dcl-payment-box:nth-child(2):after {
content: ' ';
display: block;
background: #eee;
width: 1px;
position: absolute;
right: 0;
z-index: 2;
top: 20px;
bottom: 20px;
}
} }
@media (min-width: 1200px) {
.dcl-order-container {
width: 990px;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
}

View file

@ -1,9 +1,7 @@
/* Create VM calculator */ /* Create VM calculator */
.price-calc-section { .price-calc-section {
padding: 20px 0 !important; padding: 80px 40px !important;
font-weight: 300;
font-size: 18px;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
@ -42,19 +40,19 @@
} }
.price-calc-section .card { .price-calc-section .card {
border-radius: 7px; width: 50%;
margin: 0 auto; margin: 0 auto;
background: #fff; background: #fff;
box-shadow: 1px 3px 6px 2px rgba(0, 0, 0, 0.2); box-shadow: 1px 3px 6px 2px rgba(0, 0, 0, 0.2);
padding-bottom: 30px; padding-bottom: 30px;
text-align: center; text-align: center;
max-width: 4000px; max-width: 320px;
position: relative; position: relative;
} }
@media (min-width: 768px) { @media (min-width: 768px) {
.price-calc-section .card { .price-calc-section .card {
/* margin-left: 0; */ margin-left: 0;
} }
} }
@ -87,7 +85,7 @@
} }
.price-calc-section .card .description { .price-calc-section .card .description {
padding: 12px; padding: 7px 8px 2px;
position: relative; position: relative;
display: flex; display: flex;
justify-content: space-around !important; justify-content: space-around !important;
@ -95,7 +93,7 @@
} }
.price-calc-section .card .description span { .price-calc-section .card .description span {
font-size: 16px; font-size: 14px;
margin-left: 5px; margin-left: 5px;
/* margin-left: 0px; */ /* margin-left: 0px; */
/* justify-self: start; */ /* justify-self: start; */
@ -106,18 +104,17 @@
} }
.price-calc-section .card .description .select-number{ .price-calc-section .card .description .select-number{
font-size: 18px; font-size: 16px;
text-align: center; text-align: center;
width: 85px; width: 85px;
padding: 5px 10px;
} }
.price-calc-section .card .description i { .price-calc-section .card .description i {
color: #29427a; color: #29427a;
cursor: pointer; cursor: pointer;
font-size: 20px; font-size: 20px;
/* border: 1px solid #ccc; */ border: 1px solid #ccc;
/* padding: 5px 6px 3px; */ padding: 5px 6px 3px;
border-radius: 5px; border-radius: 5px;
} }
@ -196,7 +193,7 @@
.price-calc-section .help-block.with-errors { .price-calc-section .help-block.with-errors {
text-align: center; text-align: center;
margin: 0 0; margin: 0 0;
padding: 0 0; padding: 0 0 5px;
} }
.price-calc-section .help-block.with-errors ul { .price-calc-section .help-block.with-errors ul {
margin-bottom: 0; margin-bottom: 0;
@ -212,10 +209,10 @@
display: block; display: block;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 18%;
z-index: 20; z-index: 20;
height: 1px; height: 1px;
width: 100%; width: 65%;
background: rgba(128, 128, 128, 0.2); background: rgba(128, 128, 128, 0.2);
} }

View file

@ -146,13 +146,9 @@
text-align: center; text-align: center;
} }
.vm-vmid-with-warning {
padding: 50px 0 33px !important;
}
.vm-vmid .alert { .vm-vmid .alert {
margin-top: 15px; margin-top: 15px;
margin-bottom: -25px; margin-bottom: -60px;
} }
.vm-item-lg { .vm-item-lg {
@ -187,13 +183,6 @@
margin-top: 25px; margin-top: 25px;
} }
.vm-terminate-warning {
letter-spacing: 0.6px;
font-size: 12px;
font-weight: 400;
color: #373636;
}
.vm-contact-us { .vm-contact-us {
margin: 25px 0 30px; margin: 25px 0 30px;
/* text-align: center; */ /* text-align: center; */
@ -280,7 +269,7 @@
border: 2px solid #A3C0E2; border: 2px solid #A3C0E2;
padding: 5px 25px; padding: 5px 25px;
font-size: 12px; font-size: 12px;
letter-spacing: 2px; letter-spacing: 1.3px;
} }
.btn-vm-contact:hover, .btn-vm-contact:focus { .btn-vm-contact:hover, .btn-vm-contact:focus {
background: #fff; background: #fff;

View file

@ -153,125 +153,4 @@ $( document ).ready(function() {
$('.navbar-fixed-top.topnav').css('padding-right', topnavPadding-scrollbarWidth); $('.navbar-fixed-top.topnav').css('padding-right', topnavPadding-scrollbarWidth);
} }
}); });
});
/* ---------------------------------------------
Scripts initialization
--------------------------------------------- */
var minRam = 1;
if(window.minRam){
minRam = window.minRam;
}
var cardPricing = {
'cpu': {
'id': 'coreValue',
'value': 1,
'min': 1,
'max': 48,
'interval': 1
},
'ram': {
'id': 'ramValue',
'value': 2,
'min': minRam,
'max': 200,
'interval': 1
},
'storage': {
'id': 'storageValue',
'value': 10,
'min': 10,
'max': 2000,
'interval': 10
}
};
function _initPricing() {
_fetchPricing();
$('.fa-minus-circle.left').click(function(event) {
var data = $(this).data('minus');
if (cardPricing[data].value > 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;
}
}
_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;
}
}
_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;
_fetchPricing();
});
}
function _fetchPricing() {
Object.keys(cardPricing).map(function(element) {
$('input[name=' + element + ']').val(cardPricing[element].value);
});
_calcPricing();
}
function _calcPricing() {
if(typeof window.coresUnitPrice === 'undefined'){
window.coresUnitPrice = 5;
}
if(typeof window.ramUnitPrice === 'undefined'){
window.ramUnitPrice = 2;
}
if(typeof window.ssdUnitPrice === 'undefined'){
window.ssdUnitPrice = 0.6;
}
if(typeof window.discountAmount === 'undefined'){
window.discountAmount = 0;
}
var total = (cardPricing['cpu'].value * window.coresUnitPrice) +
(cardPricing['ram'].value * window.ramUnitPrice) +
(cardPricing['storage'].value * window.ssdUnitPrice) -
window.discountAmount;
total = parseFloat(total.toFixed(2));
$("#total").text(total);
}
_initPricing();
$('#ramValue').data('old-value', $('#ramValue').val());
});

View file

@ -22,39 +22,6 @@ function setBrandIcon(brand) {
$(document).ready(function () { $(document).ready(function () {
$(function () {
$("select#id_generic_payment_form-product_name").change(function () {
var gp_form = $('#generic-payment-form');
$.ajax({
url: gp_form.attr('action'),
type: 'POST',
data: gp_form.serialize(),
init: function () {
console.log("init")
},
success: function (data) {
if (data.amount !== undefined) {
$("#id_generic_payment_form-amount").val(data.amount);
if (data.isSubscription) {
$('#id_generic_payment_form-recurring').prop('checked', true);
} else {
$('#id_generic_payment_form-recurring').prop('checked', false);
}
} else {
$("#id_generic_payment_form-amount").val('');
$('#id_generic_payment_form-recurring').prop('checked', false);
console.log("No product found")
}
},
error: function (xmlhttprequest, textstatus, message) {
$("#id_generic_payment_form-amount").val('');
$('#id_generic_payment_form-recurring').prop('checked', false);
console.log("Error fetching product")
}
});
})
});
$.ajaxSetup({ $.ajaxSetup({
beforeSend: function (xhr, settings) { beforeSend: function (xhr, settings) {
function getCookie(name) { function getCookie(name) {
@ -157,35 +124,17 @@ $(document).ready(function () {
$('#billing-form').submit(); $('#billing-form').submit();
} }
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length === 2) return parts.pop().split(";").shift();
}
function submitBillingForm() {
var billing_form = $('#billing-form');
var recurring_input = $('#id_generic_payment_form-recurring');
billing_form.append('<input type="hidden" name="generic_payment_form-product_name" value="' + $('#id_generic_payment_form-product_name').val() + '" />');
billing_form.append('<input type="hidden" name="generic_payment_form-amount" value="' + $('#id_generic_payment_form-amount').val() + '" />');
if (recurring_input.attr('type') === 'hidden') {
billing_form.append('<input type="hidden" name="generic_payment_form-recurring" value="' + (recurring_input.val() === 'True' ? 'on' : '') + '" />');
} else {
billing_form.append('<input type="hidden" name="generic_payment_form-recurring" value="' + (recurring_input.prop('checked') ? 'on' : '') + '" />');
}
billing_form.append('<input type="hidden" name="generic_payment_form-description" value="' + $('#id_generic_payment_form-description').val() + '" />');
billing_form.submit();
}
var $form_new = $('#payment-form-new'); var $form_new = $('#payment-form-new');
$form_new.submit(payWithStripe_new); $form_new.submit(payWithStripe_new);
function payWithStripe_new(e) { function payWithStripe_new(e) {
e.preventDefault(); e.preventDefault();
function stripeTokenHandler(token) { function stripeTokenHandler(token) {
// Insert the token ID into the form so it gets submitted to the server // Insert the token ID into the form so it gets submitted to the server
$('#id_token').val(token.id); $('#id_token').val(token.id);
submitBillingForm(); $('#billing-form').submit();
} }
@ -246,11 +195,5 @@ $(document).ready(function () {
$(element).closest('.form-group').append(error); $(element).closest('.form-group').append(error);
} }
}); });
$('.credit-card-info .btn.choice-btn').click(function () {
var id = this.dataset['id_card'];
$('#id_card').val(id);
submitBillingForm();
});
}); });

View file

@ -134,15 +134,3 @@ $(document).ready(function() {
$(this).find('.modal-footer .btn').addClass('hide'); $(this).find('.modal-footer .btn').addClass('hide');
}) })
}); });
window.onload = function () {
var locale_dates = document.getElementsByClassName("locale_date");
var formats = ['YYYY-MM-DD hh:mm a'];
var i;
for (i = 0; i < locale_dates.length; i++) {
var oldDate = moment.utc(locale_dates[i].textContent, formats);
var outputFormat = locale_dates[i].getAttribute('data-format') || oldDate._f;
locale_dates[i].innerHTML = oldDate.local().format(outputFormat);
locale_dates[i].className += ' done';
}
};

View file

@ -9,7 +9,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content="ungleich glarus ag"> <meta name="author" content="">
<title>{{ domain }} - {{ hosting }} hosting as easy as possible</title> <title>{{ domain }} - {{ hosting }} hosting as easy as possible</title>

View file

@ -1,5 +1,5 @@
{% load staticfiles i18n cms_tags sekizai_tags %} {% load staticfiles bootstrap3%}
{% load i18n %}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -29,9 +29,6 @@
{% block css_extra %} {% block css_extra %}
{% endblock css_extra %} {% endblock css_extra %}
{% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %}
{% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %}
<!-- Custom Fonts --> <!-- Custom Fonts -->
<link href='//fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> <link href='//fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
<link href="{% static 'datacenterlight/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet" type="text/css"> <link href="{% static 'datacenterlight/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet" type="text/css">
@ -51,7 +48,7 @@
</head> </head>
<body> <body>
{% cms_toolbar %}
{% block navbar %} {% block navbar %}
{% include "hosting/includes/_navbar_user.html" %} {% include "hosting/includes/_navbar_user.html" %}
@ -66,7 +63,7 @@
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<footer class="footer-vm"> <footer class="footer-vm">
<div class="container"> <div class="container">
<p class="copyright text-muted small">Copyright &copy; ungleich glarus ag {% now "Y" %}. {% trans "All Rights Reserved" %}</p> <p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. {% trans "All Rights Reserved" %}</p>
</div> </div>
</footer> </footer>
{% else %} {% else %}

View file

@ -1,9 +1,7 @@
{% extends "hosting/base_short.html" %} {% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 i18n cms_tags %} {% load staticfiles bootstrap3 i18n %}
{% block content %} {% block content %}
<div class="dashboard-container create-vm-container"> <div class="dashboard-container create-vm-container">
<div class="row"> <div class="row">
<div class="col-sm-5"> <div class="col-sm-5">
@ -19,8 +17,14 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="col-sm-6 hosting-calculator"> <div class="col-sm-6">
{% render_placeholder cms_integration.calculator_placeholder %} <div class="price-calc-section no-padding">
<div class="landing card">
<div class="caption">
{% include "hosting/calculator_form.html" %}
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -14,7 +14,7 @@
<table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;"> <table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;">
<tr> <tr>
<td> <td>
<img src="{{ base_url }}{% static 'datacenterlight/img/datacenterlight.png' %}" style="max-width: 200px;"> <img src="{{ base_url }}{% static 'datacenterlight/img/logo_black.png' %}" style="width: 200px; height: 50px;">
</td> </td>
</tr> </tr>
<tr> <tr>

View file

@ -14,7 +14,7 @@
<table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;"> <table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;">
<tr> <tr>
<td> <td>
<img src="{{ base_url }}{% static 'datacenterlight/img/datacenterlight.png' %}" style="max-width: 200px;"> <img src="{{base_url}}{% static 'datacenterlight/img/logo_black.png' %}" style="width: 200px; height: 50px;">
</td> </td>
</tr> </tr>
<tr> <tr>

View file

@ -14,7 +14,7 @@
<table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;"> <table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;">
<tr> <tr>
<td> <td>
<img src="{{ base_url }}{% static 'datacenterlight/img/datacenterlight.png' %}" style="max-width: 200px;"> <img src="{{ base_url }}{% static 'datacenterlight/img/logo_black.png' %}" style="width: 200px; height: 50px;">
</td> </td>
</tr> </tr>
<tr> <tr>
@ -25,7 +25,7 @@
<tr> <tr>
<td style="padding-top: 25px; font-size: 16px;"> <td style="padding-top: 25px; font-size: 16px;">
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin: 0;"> <p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin: 0;">
{% blocktrans %}You are receiving this email because your virtual machine <strong>{{ vm_name }}</strong> has been cancelled.{% endblocktrans %} {% blocktrans %}You are receiving this email because your virutal machine <strong>{{ vm_name }}</strong> has been cancelled.{% endblocktrans %}
</p> </p>
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin: 0;"> <p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin: 0;">
{% blocktrans %}You can always order a new VM by clicking the button below.{% endblocktrans %} {% blocktrans %}You can always order a new VM by clicking the button below.{% endblocktrans %}

View file

@ -2,7 +2,7 @@
{% trans "Virtual Machine Cancellation" %} {% trans "Virtual Machine Cancellation" %}
{% blocktrans %}You are receiving this email because your virtual machine {{vm_name}} has been cancelled.{% endblocktrans %} {% blocktrans %}You are receiving this email because your virutal machine {{vm_name}} has been cancelled.{% endblocktrans %}
{% blocktrans %}You can always order a new VM by following the link below.{% endblocktrans %} {% blocktrans %}You can always order a new VM by following the link below.{% endblocktrans %}
{{ base_url }}{% url 'hosting:create_virtual_machine' %} {{ base_url }}{% url 'hosting:create_virtual_machine' %}

View file

@ -74,7 +74,7 @@
<center style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> <center style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
<table cellpadding="0" cellspacing="0" width="600" class="w320" style="border-collapse: collapse !important; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"><tr style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> <table cellpadding="0" cellspacing="0" width="600" class="w320" style="border-collapse: collapse !important; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"><tr style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
<td class="pull-left mobile-header-padding-left" style="vertical-align: middle; border-collapse: collapse; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: left; line-height: 21px; width: 290px; padding-left: 10px;" align="left" valign="middle"> <td class="pull-left mobile-header-padding-left" style="vertical-align: middle; border-collapse: collapse; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: left; line-height: 21px; width: 290px; padding-left: 10px;" align="left" valign="middle">
<a href="{{base_url}}" style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; color: #676767; text-decoration: none !important;"><img width="137" src="{{base_url}}{% static 'hosting/img/datacenterlight.png' %}" alt="logo" style="max-width: 600px; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; border: none;"></a> <a href="{{base_url}}" style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; color: #676767; text-decoration: none !important;"><img width="137" src="{{base_url}}{% static "hosting/img/logo_black.png" %}" alt="logo" style="max-width: 600px; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; border: none;"></a>
</td> </td>
<td class="pull-right mobile-header-padding-right" style="color: #4d4d4d; border-collapse: collapse; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; text-align: right; line-height: 21px; width: 290px; padding-left: 10px;" align="right"> <td class="pull-right mobile-header-padding-right" style="color: #4d4d4d; border-collapse: collapse; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; text-align: right; line-height: 21px; width: 290px; padding-left: 10px;" align="right">
</td> </td>
@ -100,7 +100,7 @@
</tr> </tr>
<tr style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> <tr style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">
<td class="free-text" style="border-collapse: collapse; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; width: 100% !important; padding: 10px 60px 0px;" align="center"> <td class="free-text" style="border-collapse: collapse; font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important; font-size: 14px; color: #777777; text-align: center; line-height: 21px; width: 100% !important; padding: 10px 60px 0px;" align="center">
Your virtual machine {{vm.name}} subscription has been charged, <br/> you can view your invoice clicking on the button below. Your virtual machine {{vm.name}} subscription has been charged, <br/> you can view your invoice clicking on the button below.
</td> </td>
</tr> </tr>
<tr style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;"> <tr style="font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;">

View file

@ -1,50 +0,0 @@
{% load i18n %}
<form action="" id="payment-form-new" method="POST">
<input type="hidden" name="token"/>
<input type="hidden" name="id_card" id="id_card" value=""/>
<div class="group">
<div class="credit-card-goup">
<div class="card-element card-number-element">
<label>{%trans "Card Number" %}</label>
<div id="card-number-element" class="field my-input"></div>
</div>
<div class="row">
<div class="col-xs-5 card-element card-expiry-element">
<label>{%trans "Expiry Date" %}</label>
<div id="card-expiry-element" class="field my-input"></div>
</div>
<div class="col-xs-3 col-xs-offset-4 card-element card-cvc-element">
<label>{%trans "CVC" %}</label>
<div id="card-cvc-element" class="field my-input"></div>
</div>
</div>
<div class="card-element brand">
<label>{%trans "Card Type" %}</label>
<i class="pf pf-credit-card" id="brand-icon"></i>
</div>
</div>
</div>
<div id="card-errors"></div>
{% if not messages and not form.non_field_errors %}
<p class="card-warning-content">
{% trans "You are not making any payment yet. After placing your order, you will be taken to the Submit Payment Page." %}
</p>
{% endif %}
<div id='payment_error'>
{% for message in messages %}
{% if 'failed_payment' in message.tags or 'make_charge_error' in message.tags or 'error' in message.tags %}
<ul class="list-unstyled">
<li><p class="card-warning-content card-warning-error">{{ message|safe }}</p></li>
</ul>
{% endif %}
{% endfor %}
</div>
<div class="text-right">
<button class="btn btn-vm-contact btn-wide" type="submit" name="payment-form">{%trans "SUBMIT" %}</button>
</div>
<div style="display:none;">
<p class="payment-errors"></p>
</div>
</form>

View file

@ -1,5 +1,5 @@
{% load staticfiles %}
{% load i18n %} {% load i18n %}
<footer> <footer>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
@ -26,7 +26,7 @@
<a href="#contact">Contact</a> <a href="#contact">Contact</a>
</li> </li>
</ul> </ul>
<p class="copyright text-muted small">Copyright &copy; ungleich glarus ag {% now "Y" %}. {% trans "All Rights Reserved" %}</p> <p class="copyright text-muted small">Copyright &copy; ungleich GmbH {% now "Y" %}. {% trans "All Rights Reserved" %}</p>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,6 +1,7 @@
{% extends "hosting/base_short.html" %} {% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 humanize i18n custom_tags %} {% load staticfiles bootstrap3 %}
{% load i18n %}
{% load custom_tags %}
{% block content %} {% block content %}
<div id="order-detail{{order.pk}}" class="order-detail-container"> <div id="order-detail{{order.pk}}" class="order-detail-container">
@ -39,7 +40,7 @@
{% endif %} {% endif %}
</span> </span>
</p> </p>
{% if order and vm %} {% if order %}
<p> <p>
<strong>{% trans "Status" %}: </strong> <strong>{% trans "Status" %}: </strong>
<strong> <strong>
@ -93,106 +94,48 @@
<hr> <hr>
<div> <div>
<h4>{% trans "Order summary" %}</h4> <h4>{% trans "Order summary" %}</h4>
{% if vm %} <p>
<p> <strong>{% trans "Product" %}:</strong>&nbsp;
<strong>{% trans "Product" %}:</strong>&nbsp; {% if vm.name %}
{% if vm.name %} {{ vm.name }}
{{ vm.name }} {% else %}
{% else %} {{ request.session.template.name }}
{{ request.session.template.name }} {% endif %}
</p>
<div class="row">
<div class="col-sm-6">
{% if vm.created_at %}
<p>
<span>{% trans "Period" %}: </span>
<span>
<span class="locale_date" data-format="YYYY/MM/DD">{{ vm.created_at|date:'Y-m-d h:i a' }}</span> - <span class="locale_date" data-format="YYYY/MM/DD">{{ subscription_end_date|date:'Y-m-d h:i a' }}</span>
</span>
</p>
{% endif %} {% endif %}
</p> <p>
<div class="row"> <span>{% trans "Cores" %}: </span>
<div class="col-sm-6"> {% if vm.cores %}
{% if vm.created_at %} <span class="pull-right">{{vm.cores|floatformat}}</span>
<p> {% else %}
<span>{% trans "Period" %}: </span> <span class="pull-right">{{vm.cpu|floatformat}}</span>
<span>
<span class="locale_date" data-format="YYYY/MM/DD">{{ vm.created_at|date:'Y-m-d h:i a' }}</span> - <span class="locale_date" data-format="YYYY/MM/DD">{{ subscription_end_date|date:'Y-m-d h:i a' }}</span>
</span>
</p>
{% endif %} {% endif %}
<p> </p>
<span>{% trans "Cores" %}: </span> <p>
{% if vm.cores %} <span>{% trans "Memory" %}: </span>
<strong class="pull-right">{{vm.cores|floatformat}}</strong> <span class="pull-right">{{vm.memory}} GB</span>
{% else %} </p>
<strong class="pull-right">{{vm.cpu|floatformat}}</strong> <p>
{% endif %} <span>{% trans "Disk space" %}: </span>
</p> <span class="pull-right">{{vm.disk_size}} GB</span>
<p> </p>
<span>{% trans "Memory" %}: </span> <p>
<strong class="pull-right">{{vm.memory}} GB</strong> <span>{% trans "Total" %}</span>
</p> <span class="pull-right">{{vm.price}} CHF</span>
<p> </p>
<span>{% trans "Disk space" %}: </span>
<strong class="pull-right">{{vm.disk_size}} GB</strong>
</p>
</div>
<div class="col-sm-12">
<hr class="thin-hr">
</div>
{% if vm.vat > 0 or vm.discount.amount > 0 %}
<div class="col-sm-6">
<div class="subtotal-price">
{% if vm.vat > 0 %}
<p>
<strong>{% trans "Subtotal" %} </strong>
<strong class="pull-right">{{vm.price|floatformat:2|intcomma}} CHF</strong>
</p>
<p>
<small>{% trans "VAT" %} ({{ vm.vat_percent|floatformat:2|intcomma }}%) </small>
<strong class="pull-right">{{vm.vat|floatformat:2|intcomma}} CHF</strong>
</p>
{% endif %}
{% if vm.discount.amount > 0 %}
<p class="text-primary">
{%trans "Discount" as discount_name %}
<strong>{{ vm.discount.name|default:discount_name }} </strong>
<strong class="pull-right">- {{ vm.discount.amount }} CHF</strong>
</p>
{% endif %}
</div>
</div>
<div class="col-sm-12">
<hr class="thin-hr">
</div>
{% endif %}
<div class="col-sm-6">
<p class="total-price">
<strong>{% trans "Total" %} </strong>
<strong class="pull-right">{% if vm.total_price %}{{vm.total_price|floatformat:2|intcomma}}{% else %}{{vm.price|floatformat:2|intcomma}}{% endif %} CHF</strong>
</p>
</div>
</div> </div>
{% else %} </div>
<p>
<strong>{% trans "Product" %}:</strong>&nbsp;
{{ product_name }}
</p>
<div class="row">
<div class="col-sm-6">
<p>
<span>{% trans "Amount" %}: </span>
<strong class="pull-right">{{order.price|floatformat:2|intcomma}} CHF</strong>
</p>
{% if order.generic_payment_description %}
<p>
<span>{% trans "Description" %}: </span>
<strong class="pull-right">{{order.generic_payment_description}}</strong>
</p>
{% endif %}
{% if order.subscription_id %}
<p>
<span>{% trans "Recurring" %}: </span>
<strong class="pull-right">{{order.created_at|date:'d'|ordinal}} {% trans "of every month" %}</strong>
</p>
{% endif %}
</div>
</div>
{% endif %}
</div> </div>
<hr class="thin-hr"> <hr>
</div> </div>
{% if not order %} {% if not order %}
{% block submit_btn %} {% block submit_btn %}
@ -200,7 +143,7 @@
{% csrf_token %} {% csrf_token %}
<div class="row"> <div class="row">
<div class="col-sm-8"> <div class="col-sm-8">
<div class="dcl-place-order-text">{% blocktrans with vm_price=vm.total_price|floatformat:2|intcomma %}By clicking "Place order" this plan will charge your credit card account with {{ vm_price }} CHF/month{% endblocktrans %}.</div> <div class="dcl-place-order-text">{% blocktrans with vm_price=request.session.specs.price %}By clicking "Place order" this plan will charge your credit card account with the fee of {{ vm_price }}CHF/month{% endblocktrans %}.</div>
</div> </div>
<div class="col-sm-4 order-confirm-btn text-right"> <div class="col-sm-4 order-confirm-btn text-right">
<button class="btn choice-btn" id="btn-create-vm" data-href="{% url 'hosting:order-confirmation' %}" data-toggle="modal" data-target="#createvm-modal"> <button class="btn choice-btn" id="btn-create-vm" data-href="{% url 'hosting:order-confirmation' %}" data-toggle="modal" data-target="#createvm-modal">
@ -256,6 +199,17 @@
<script type="text/javascript"> <script type="text/javascript">
{% trans "Some problem encountered. Please try again later." as err_msg %} {% trans "Some problem encountered. Please try again later." as err_msg %}
var create_vm_error_message = '{{err_msg|safe}}'; var create_vm_error_message = '{{err_msg|safe}}';
window.onload = function () {
var locale_dates = document.getElementsByClassName("locale_date");
var formats = ['YYYY-MM-DD hh:mm a']
var i;
for (i = 0; i < locale_dates.length; i++) {
var oldDate = moment.utc(locale_dates[i].textContent, formats);
var outputFormat = locale_dates[i].getAttribute('data-format') || oldDate._f;
locale_dates[i].innerHTML = oldDate.local().format(outputFormat);
locale_dates[i].className += ' done';
}
};
</script> </script>
{%endblock%} {%endblock%}

Some files were not shown because too many files have changed in this diff Show more