diff --git a/Changelog b/Changelog index d48a5346..b58871b6 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,12 @@ +1.0.12: 2017-06-13 + * [datacenterlight] Added from address for EmailMessage that was missing +1.0.11: 2017-06-12 + * [datacenterlight] month added to landing calculator box + * [datacenterlight] dcl_email from address fixed to come from support@dcl +1.0.10: 2017-06-11 + * [datacenterlight] Send plain text email only for new orders +1.0.9: 2017-06-11 + * [datacenterlight] Moved calculator to the landing page 1.0.8: 2017-06-08 * [datacenterlight] Fixed german typos * [datacenterlight] Refactored dcl order/success templates diff --git a/datacenterlight/locale/de/LC_MESSAGES/django.po b/datacenterlight/locale/de/LC_MESSAGES/django.po index 253325be..4b76eb49 100644 --- a/datacenterlight/locale/de/LC_MESSAGES/django.po +++ b/datacenterlight/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,6 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-03 21:51-0500\n" "POT-Creation-Date: 2017-06-07 02:09+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" @@ -78,40 +77,34 @@ msgstr "Vielen Dank!" #: templates/datacenterlight/index.html:62 #: templates/datacenterlight/index.html:160 -#: templates/datacenterlight/index.html:345 -#: templates/datacenterlight/new-order.html:62 -#: templates/datacenterlight/new-order.html:203 -#: templates/datacenterlight/order.html:62 -#: templates/datacenterlight/order.html:203 +#: templates/datacenterlight/index.html:383 +#: templates/datacenterlight/order.html:24 +#: templates/datacenterlight/order.html:165 #: templates/datacenterlight/pricing.html:62 #: templates/datacenterlight/pricing.html:190 -#: templates/datacenterlight/success.html:62 +#: templates/datacenterlight/success.html:23 msgid "What is it" msgstr "Was ist es?" #: templates/datacenterlight/index.html:65 #: templates/datacenterlight/index.html:189 -#: templates/datacenterlight/index.html:348 -#: templates/datacenterlight/new-order.html:65 -#: templates/datacenterlight/new-order.html:206 -#: templates/datacenterlight/order.html:65 -#: templates/datacenterlight/order.html:206 +#: templates/datacenterlight/index.html:386 +#: templates/datacenterlight/order.html:27 +#: templates/datacenterlight/order.html:168 #: templates/datacenterlight/pricing.html:65 #: templates/datacenterlight/pricing.html:193 -#: templates/datacenterlight/success.html:65 +#: templates/datacenterlight/success.html:26 msgid "Scale out" msgstr "Skalierung" #: templates/datacenterlight/index.html:68 #: templates/datacenterlight/index.html:215 -#: templates/datacenterlight/index.html:351 -#: templates/datacenterlight/new-order.html:68 -#: templates/datacenterlight/new-order.html:209 -#: templates/datacenterlight/order.html:68 -#: templates/datacenterlight/order.html:209 +#: templates/datacenterlight/index.html:389 +#: templates/datacenterlight/order.html:30 +#: templates/datacenterlight/order.html:171 #: templates/datacenterlight/pricing.html:68 #: templates/datacenterlight/pricing.html:196 -#: templates/datacenterlight/success.html:68 +#: templates/datacenterlight/success.html:29 msgid "Reliable and light" msgstr "Zuverlässig und leicht" @@ -120,14 +113,12 @@ msgid "Order VM" msgstr "VM bestellen" #: templates/datacenterlight/index.html:74 -#: templates/datacenterlight/index.html:358 -#: templates/datacenterlight/new-order.html:74 -#: templates/datacenterlight/new-order.html:216 -#: templates/datacenterlight/order.html:74 -#: templates/datacenterlight/order.html:216 +#: templates/datacenterlight/index.html:396 +#: templates/datacenterlight/order.html:36 +#: templates/datacenterlight/order.html:178 #: templates/datacenterlight/pricing.html:74 #: templates/datacenterlight/pricing.html:203 -#: templates/datacenterlight/success.html:74 +#: templates/datacenterlight/success.html:35 msgid "Contact" msgstr "Kontakt" @@ -219,11 +210,12 @@ msgstr "" "Angebot ist aufgrund unserer leichten Infrastruktur überaus kostengünstig." #: templates/datacenterlight/index.html:236 -#: templates/datacenterlight/new-order.html:106 -#: templates/datacenterlight/order.html:106 -#: templates/datacenterlight/pricing.html:106 -msgid "We are cutting down the costs significantly!" -msgstr "Wir sorgen dafür, dass die Kosten für Sie signifikant abnehmen" +#: templates/datacenterlight/order.html:143 +#: templates/datacenterlight/pricing.html:168 +msgid "Simple and affordable: Try our virtual machine with featherlight price." +msgstr "" +"Einfach und bezahlbar: Teste nun unsere virtuellen Maschinen mit " +"federleichten Preisen." #: templates/datacenterlight/index.html:260 msgid "More Info" @@ -233,25 +225,31 @@ msgstr "Weitere Informationen" msgid "Affordable VM hosting based in Switzerland" msgstr "Bezahlbares VM Hosting in der Schweiz" -#: templates/datacenterlight/index.html:244 -#: templates/datacenterlight/new-order.html:119 -#: templates/datacenterlight/order.html:119 +#: templates/datacenterlight/index.html:248 +#: templates/datacenterlight/order.html:81 #: templates/datacenterlight/pricing.html:119 msgid "VM hosting" msgstr "VM Hosting" -#: templates/datacenterlight/index.html:286 -#: templates/datacenterlight/index.html:251 -msgid "Based in Switzerland" + +#: templates/datacenterlight/index.html:252 +msgid "month" +msgstr "Monat" + +#: templates/datacenterlight/index.html:256 +#: templates/datacenterlight/order.html:89 +#: templates/datacenterlight/pricing.html:127 +msgid "Hosted in Switzerland" msgstr "Standort des Datacenters ist in der Schweiz" -#: templates/datacenterlight/index.html:260 -msgid "10 GB Storage (SSD)" -msgstr "10 GB Storage (SSD)" +#: templates/datacenterlight/index.html:273 +#: templates/datacenterlight/order.html:106 +#: templates/datacenterlight/pricing.html:144 +msgid "GB Storage (SSD)" +msgstr "GB Storage (SSD)" -#: templates/datacenterlight/index.html:263 -#: templates/datacenterlight/new-order.html:171 -#: templates/datacenterlight/order.html:171 +#: templates/datacenterlight/index.html:297 +#: templates/datacenterlight/order.html:133 #: templates/datacenterlight/pricing.html:161 msgid "Order Now!" msgstr "Bestelle jetzt!" @@ -262,24 +260,24 @@ msgstr "Willst du mehr wissen? Abonniere unseren Newsletter!" #: templates/datacenterlight/index.html:364 #: templates/datacenterlight/index.html:279 +#: templates/datacenterlight/index.html:317 msgid "I want to have it!" msgstr "Das möchte ich haben!" -#: templates/datacenterlight/index.html:306 +#: templates/datacenterlight/index.html:344 msgid "Switzerland " msgstr "Schweiz" -#: templates/datacenterlight/index.html:323 +#: templates/datacenterlight/index.html:361 msgid "Questions?" msgstr "Fragen?" -#: templates/datacenterlight/index.html:323 +#: templates/datacenterlight/index.html:361 msgid "Contact us!" msgstr "Kontaktiere uns!" -#: templates/datacenterlight/index.html:341 -#: templates/datacenterlight/new-order.html:199 -#: templates/datacenterlight/order.html:199 +#: templates/datacenterlight/index.html:379 +#: templates/datacenterlight/order.html:161 #: templates/datacenterlight/pricing.html:186 msgid "Home" msgstr "Home" @@ -288,39 +286,24 @@ msgstr "Home" #: templates/datacenterlight/index.html:354 #: templates/datacenterlight/new-order.html:212 #: templates/datacenterlight/order.html:212 +#: templates/datacenterlight/index.html:392 +#: templates/datacenterlight/order.html:174 #: templates/datacenterlight/pricing.html:199 msgid "Pricing" msgstr "Preise" -#: templates/datacenterlight/new-order.html:71 -#: templates/datacenterlight/order.html:71 +#: templates/datacenterlight/order.html:33 #: templates/datacenterlight/pricing.html:71 -#: templates/datacenterlight/success.html:71 +#: templates/datacenterlight/success.html:32 msgid "Buy VM" msgstr "VM Kaufen" -#: templates/datacenterlight/new-order.html:127 -#: templates/datacenterlight/order.html:127 -#: templates/datacenterlight/pricing.html:127 -msgid "Hosted in Switzerland" -msgstr "Standort des Datacenters ist in der Schweiz" +#: templates/datacenterlight/order.html:68 +#: templates/datacenterlight/pricing.html:106 +msgid "We are cutting down the costs significantly!" +msgstr "Wir sorgen dafür, dass die Kosten für Sie signifikant abnehmen" -#: templates/datacenterlight/new-order.html:144 -#: templates/datacenterlight/order.html:144 -#: templates/datacenterlight/pricing.html:144 -msgid "GB Storage (SSD)" -msgstr "GB Storage (SSD)" - -#: templates/datacenterlight/new-order.html:181 -#: templates/datacenterlight/order.html:181 -#: templates/datacenterlight/pricing.html:168 -msgid "Simple and affordable: Try our virtual machine with featherlight price." -msgstr "" -"Einfach und bezahlbar: Testen Sie unsere virtuellen Maschinen mit " -"federleichten Preisen" - -#: templates/datacenterlight/new-order.html:184 -#: templates/datacenterlight/order.html:184 +#: templates/datacenterlight/order.html:146 #: templates/datacenterlight/pricing.html:171 msgid "" "Our VMs are hosted in Glarus, Switzerland, and our website is currently " @@ -337,16 +320,22 @@ msgstr "" "uns unter support@datacenterlight.ch. Unser Team wird sich umgehend um dein " "Anliegen kümmern!" -#: templates/datacenterlight/success.html:101 +#: templates/datacenterlight/success.html:62 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 " "Ihnen via E-Mail in Verbindung." -#: templates/datacenterlight/success.html:103 +#: templates/datacenterlight/success.html:64 msgid "as soon as possible!" msgstr "" +#~ msgid "Based in Switzerland" +#~ msgstr "Standort des Datacenters ist in der Schweiz" + +#~ msgid "10 GB Storage (SSD)" +#~ msgstr "10 GB Storage (SSD)" + #~ msgid "Request Newsletter" #~ msgstr "Newsletter abonnieren" diff --git a/datacenterlight/static/datacenterlight/css/landing-page.css b/datacenterlight/static/datacenterlight/css/landing-page.css index 1754b6b6..c6b734d1 100755 --- a/datacenterlight/static/datacenterlight/css/landing-page.css +++ b/datacenterlight/static/datacenterlight/css/landing-page.css @@ -636,6 +636,12 @@ h6 { max-width: 400px; position: relative; } +.price-calc-section .landing { + width: 100% !important; +} +.no-padding{ + padding:0 !important; +} .price-calc-section .card .img-beta{ position: absolute; top: 5px; diff --git a/datacenterlight/templates/datacenterlight/emails/new_order_notification.html b/datacenterlight/templates/datacenterlight/emails/new_order_notification.html deleted file mode 100644 index 5f14c983..00000000 --- a/datacenterlight/templates/datacenterlight/emails/new_order_notification.html +++ /dev/null @@ -1,137 +0,0 @@ -{% load static from staticfiles %} - - - - - - -Oxygen Invoice - - - - - - - - - - - - - -
-
- - -
- -
- - - -
- logo - -
-
- -
-
-
-
- - - - - - - - - - -
- We have received a new order. -
-

-

User details

- Name: {{name}}
- Email: {{email}}
- -

VM details

- Cores: {{cores}}
- Memory: {{memory}}
- Storage: {{storage}}
- Price: {{price}}
- Template: {{template}}
- -

 
-
-
-
- - -
Your data center light team
-
-
-
- - - diff --git a/datacenterlight/templates/datacenterlight/emails/new_order_notification.txt b/datacenterlight/templates/datacenterlight/emails/new_order_notification.txt deleted file mode 100644 index 5f14c983..00000000 --- a/datacenterlight/templates/datacenterlight/emails/new_order_notification.txt +++ /dev/null @@ -1,137 +0,0 @@ -{% load static from staticfiles %} - - - - - - -Oxygen Invoice - - - - - - - - - - - - - -
-
- - -
- -
- - - -
- logo - -
-
- -
-
-
-
- - - - - - - - - - -
- We have received a new order. -
-

-

User details

- Name: {{name}}
- Email: {{email}}
- -

VM details

- Cores: {{cores}}
- Memory: {{memory}}
- Storage: {{storage}}
- Price: {{price}}
- Template: {{template}}
- -

 
-
-
-
- - -
Your data center light team
-
-
-
- - - diff --git a/datacenterlight/templates/datacenterlight/index.html b/datacenterlight/templates/datacenterlight/index.html index ccc47d42..8175edd0 100755 --- a/datacenterlight/templates/datacenterlight/index.html +++ b/datacenterlight/templates/datacenterlight/index.html @@ -255,37 +255,75 @@
-

{% trans "We are cutting down the costs significantly!" %}

+

{% trans "Simple and affordable: Try our virtual machine with featherlight price." %}

{% trans "Affordable VM hosting based in Switzerland" %}

{% trans "More Info" %}
-
-
-
-

{% trans "VM hosting" %}

+
+
+ +
+
+ {% csrf_token %} +
+

{% trans "VM hosting" %}

+
+
+ 15 + CHF/{% trans "month" %} +
+
+
+

{% trans "Hosted in Switzerland" %}

+
+
+ + + Core + +
+
+ + + GB RAM + +
+
+ + + {% trans "GB Storage (SSD)" %} + +
+
+ + +
+ + +
+ + +
+
+ + +
+
+ +
-
- 15 CHF/month -
-
-
-

{% trans "Based in Switzerland" %}

-
-
-

1 Core,

-
-
-

2 GB RAM,

-
-
-

{% trans "10 GB Storage (SSD)" %}

-
-
- {% trans "Order Now!" %} -
- +
+
+
+
@@ -389,22 +427,48 @@ - - + + window.onload=function(){ + $('.selectpicker').selectpicker({ + style: 'btn-link', + windowPadding: 10, + }); + $.ajax({ + url: "{% url 'datacenterlight:beta_access' %}", + context: document.body + }).done(function(response) { + $('#beta_access_form').html(response); + }); + }; + diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 3c8741eb..d23c4231 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -4,6 +4,7 @@ from .forms import BetaAccessForm from .models import BetaAccess, BetaAccessVMType, BetaAccessVM from django.contrib import messages from django.core.urlresolvers import reverse_lazy, reverse +from django.core.mail import EmailMessage from utils.mailer import BaseEmail from django.shortcuts import render from django.shortcuts import redirect @@ -59,7 +60,7 @@ class PricingView(TemplateView): if not request.user.is_authenticated(): request.session['next'] = reverse('hosting:payment') - request.session['specs'] = { + request.session['specs'] = { 'cpu':cores, 'memory': memory, 'disk_size': storage, @@ -101,7 +102,7 @@ class OrderView(TemplateView): manager = OpenNebulaManager() template = manager.get_template(template_id) template_data = VirtualMachineTemplateSerializer(template).data - + name = request.POST.get('name') email = request.POST.get('email') name_field = forms.CharField() @@ -112,17 +113,13 @@ class OrderView(TemplateView): messages.add_message(self.request, messages.ERROR, '%(value) is not a proper name.'.format(name)) return HttpResponseRedirect(reverse('datacenterlight:order')) - try: + try: email = email_field.clean(email) except ValidationError as err: messages.add_message(self.request, messages.ERROR, '%(value) is not a proper email.'.format(email)) return HttpResponseRedirect(reverse('datacenterlight:order')) - - # We have valid email and name of the customer, hence send an - # email to the admin - + context = { - 'base_url': "{0}://{1}".format(self.request.scheme, self.request.get_host()), 'name': name, 'email': email, 'cores': cores, @@ -132,13 +129,14 @@ class OrderView(TemplateView): 'template': template_data['name'], } email_data = { - 'subject': 'New Order Received', + 'subject': "Data Center Light Order from %s" % context['email'], + 'from_address': '(datacenterlight) datacenterlight Support ', 'to': 'info@ungleich.ch', 'context': context, 'template_name': 'new_order_notification', 'template_path': 'datacenterlight/emails/' } - email = BaseEmail(**email_data) + email = EmailMessage(**email_data) email.send() return HttpResponseRedirect(reverse('datacenterlight:order_success')) @@ -157,6 +155,7 @@ class BetaAccessView(FormView): email_data = { 'subject': 'DatacenterLight Beta Access Request', + 'from_address': '(datacenterlight) datacenterlight Support ', 'to': form.cleaned_data.get('email'), 'from': '(datacenterlight) DatacenterLight Support support@datacenterlight.ch', 'context': context, @@ -172,8 +171,8 @@ class BetaAccessView(FormView): email_data = { 'subject': 'DatacenterLight Beta Access Request', - 'to': 'support@datacenterlight.ch', - 'from': '(datacenterlight) DatacenterLight Support support@datacenterlight.ch', + 'from_address': '(datacenterlight) datacenterlight Support ', + 'to': 'info@ungleich.ch', 'context': context, 'template_name': 'request_access_notification', 'template_path': 'datacenterlight/emails/' @@ -223,6 +222,7 @@ class BetaProgramView(CreateView): email_data = { 'subject': 'DatacenterLight Beta Access Request', + 'from_address': '(datacenterlight) datacenterlight Support ', 'to': 'info@ungleich.ch', 'context': context, 'template_name': 'request_beta_access_notification', @@ -241,6 +241,70 @@ class IndexView(CreateView): form_class = BetaAccessForm success_url = "/datacenterlight#requestform" success_message = "Thank you, we will contact you as soon as possible" + + def get(self, request, *args, **kwargs): + try: + manager = OpenNebulaManager() + templates = manager.get_templates() + context = { + 'templates': VirtualMachineTemplateSerializer(templates, many=True).data, + } + except: + messages.error( request, + 'We have a temporary problem to connect to our backend. \ + Please try again in a few minutes' + ) + context = { + 'error' : 'connection' + } + return render(request, self.template_name, context) + + def post(self, request): + cores = request.POST.get('cpu') + memory = request.POST.get('ram') + storage = request.POST.get('storage') + price = request.POST.get('total') + template_id = int(request.POST.get('config')) + manager = OpenNebulaManager() + template = manager.get_template(template_id) + template_data = VirtualMachineTemplateSerializer(template).data + + name = request.POST.get('name') + email = request.POST.get('email') + name_field = forms.CharField() + email_field = forms.EmailField() + try: + name = name_field.clean(name) + except ValidationError as err: + messages.add_message(self.request, messages.ERROR, '%(value) is not a proper name.'.format(name)) + return HttpResponseRedirect(reverse('datacenterlight:order')) + + try: + email = email_field.clean(email) + except ValidationError as err: + messages.add_message(self.request, messages.ERROR, '%(value) is not a proper email.'.format(email)) + return HttpResponseRedirect(reverse('datacenterlight:order')) + + context = { + 'name': name, + 'email': email, + 'cores': cores, + 'memory': memory, + 'storage': storage, + 'price': price, + 'template': template_data['name'], + } + email_data = { + 'subject': "Data Center Light Order from %s" % context['email'], + 'from_email': '(datacenterlight) datacenterlight Support ', + 'to': ['info@ungleich.ch'], + 'body': "\n".join(["%s=%s" % (k, v) for (k, v) in context.items()]), + 'reply_to': [context['email']], + } + email = EmailMessage(**email_data) + email.send() + + return HttpResponseRedirect(reverse('datacenterlight:order_success')) def get_success_url(self): success_url = reverse('datacenterlight:index') @@ -262,6 +326,7 @@ class IndexView(CreateView): email_data = { 'subject': 'DatacenterLight Beta Access Request', + 'from_address': '(datacenterlight) datacenterlight Support ', 'to': form.cleaned_data.get('email'), 'from': '(datacenterlight) DatacenterLight Support support@datacenterlight.ch', 'context': context, @@ -277,8 +342,8 @@ class IndexView(CreateView): email_data = { 'subject': 'DatacenterLight Beta Access Request', - 'to': 'support@datacenterlight.ch', - 'from': '(datacenterlight) DatacenterLight Support support@datacenterlight.ch', + 'from_address': '(datacenterlight) datacenterlight Support ', + 'to': 'info@ungleich.ch', 'context': context, 'template_name': 'request_access_notification', 'template_path': 'datacenterlight/emails/' diff --git a/utils/mailer.py b/utils/mailer.py index b2a06a6c..5dc24b04 100644 --- a/utils/mailer.py +++ b/utils/mailer.py @@ -21,10 +21,10 @@ class BaseEmail(object): self.email = EmailMultiAlternatives(self.subject, text_content) self.email.attach_alternative(html_content, "text/html") - self.email.from_email = kwargs.get( - 'from', - '(ungleich) ungleich Support ' - ) + if 'from_address' in kwargs: + self.email.from_email = kwargs.get('from_address') + else: + self.email.from_email = '(ungleich) ungleich Support ' self.email.to = [kwargs.get('to', 'info@ungleich.com')] def send(self):