Merge branch 'master' into task/3354/modal_restyling
This commit is contained in:
commit
d3e1204446
11 changed files with 192 additions and 135 deletions
|
@ -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: 2017-07-01 02:15+0530\n"
|
"POT-Creation-Date: 2017-07-02 23:08+0530\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"
|
||||||
|
@ -18,14 +18,6 @@ msgstr ""
|
||||||
"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"
|
||||||
|
|
||||||
#: templates/datacenterlight/base.html:72
|
|
||||||
msgid "Please enter your name"
|
|
||||||
msgstr "Bitte gib Deinen Namen ein"
|
|
||||||
|
|
||||||
#: templates/datacenterlight/base.html:73
|
|
||||||
msgid "Please enter a valid email address"
|
|
||||||
msgstr "Bitte gib eine gültige E-Mail-Adresse ein"
|
|
||||||
|
|
||||||
#: templates/datacenterlight/beta_access.html:13
|
#: templates/datacenterlight/beta_access.html:13
|
||||||
msgid "Enter name"
|
msgid "Enter name"
|
||||||
msgstr "Name"
|
msgstr "Name"
|
||||||
|
@ -264,41 +256,61 @@ msgstr "MwSt. inklusive"
|
||||||
msgid "Hosted in Switzerland"
|
msgid "Hosted in Switzerland"
|
||||||
msgstr "Standort: Schweiz"
|
msgstr "Standort: Schweiz"
|
||||||
|
|
||||||
#: templates/datacenterlight/index.html:173
|
#: templates/datacenterlight/index.html:161
|
||||||
|
msgid "Please enter a value greater than or equal to 1."
|
||||||
|
msgstr "Bitte gib einen Wert größer oder gleich 1 ein."
|
||||||
|
|
||||||
|
#: templates/datacenterlight/index.html:170
|
||||||
|
msgid "Please enter a value greater than or equal to 2."
|
||||||
|
msgstr "Bitte gib einen Wert größer oder gleich 2 ein."
|
||||||
|
|
||||||
|
#: templates/datacenterlight/index.html:179
|
||||||
|
msgid "Please enter a value greater than or equal to 10."
|
||||||
|
msgstr "Bitte gib einen Wert größer oder gleich 10 ein"
|
||||||
|
|
||||||
|
#: templates/datacenterlight/index.html:180
|
||||||
#: templates/datacenterlight/pricing.html:50
|
#: templates/datacenterlight/pricing.html:50
|
||||||
msgid "GB Storage (SSD)"
|
msgid "GB Storage (SSD)"
|
||||||
msgstr "GB Storage (SSD)"
|
msgstr "GB Storage (SSD)"
|
||||||
|
|
||||||
#: templates/datacenterlight/index.html:189
|
#: templates/datacenterlight/index.html:199
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: templates/datacenterlight/index.html:190
|
#: templates/datacenterlight/index.html:200
|
||||||
msgid "Your Name"
|
msgid "Your Name"
|
||||||
msgstr "Dein Name"
|
msgstr "Dein Name"
|
||||||
|
|
||||||
#: templates/datacenterlight/index.html:193
|
#: templates/datacenterlight/index.html:200
|
||||||
|
msgid "Please enter your name"
|
||||||
|
msgstr "Bitte gib Deinen Namen ein"
|
||||||
|
|
||||||
|
#: templates/datacenterlight/index.html:214
|
||||||
msgid "Email"
|
msgid "Email"
|
||||||
msgstr "E-Mail-Adresse"
|
msgstr "E-Mail-Adresse"
|
||||||
|
|
||||||
#: templates/datacenterlight/index.html:194
|
#: templates/datacenterlight/index.html:215
|
||||||
msgid "Your Email"
|
msgid "Your Email"
|
||||||
msgstr "Deine E-Mail"
|
msgstr "Deine E-Mail"
|
||||||
|
|
||||||
#: templates/datacenterlight/index.html:197
|
#: templates/datacenterlight/index.html:215
|
||||||
|
msgid "Please enter a valid email address"
|
||||||
|
msgstr "Bitte gib eine gültige E-Mailadresse ein"
|
||||||
|
|
||||||
|
#: templates/datacenterlight/index.html:228
|
||||||
#: templates/datacenterlight/pricing.html:79
|
#: templates/datacenterlight/pricing.html:79
|
||||||
msgid "Order Now!"
|
msgid "Order Now!"
|
||||||
msgstr "Bestelle jetzt!"
|
msgstr "Bestelle jetzt!"
|
||||||
|
|
||||||
#: templates/datacenterlight/index.html:226
|
#: templates/datacenterlight/index.html:254
|
||||||
msgid "Switzerland "
|
msgid "Switzerland "
|
||||||
msgstr "Schweiz"
|
msgstr "Schweiz"
|
||||||
|
|
||||||
#: templates/datacenterlight/index.html:243
|
#: templates/datacenterlight/index.html:271
|
||||||
msgid "Questions?"
|
msgid "Questions?"
|
||||||
msgstr "Fragen?"
|
msgstr "Fragen?"
|
||||||
|
|
||||||
#: templates/datacenterlight/index.html:243
|
#: templates/datacenterlight/index.html:271
|
||||||
msgid "Contact us!"
|
msgid "Contact us!"
|
||||||
msgstr "Kontaktiere uns!"
|
msgstr "Kontaktiere uns!"
|
||||||
|
|
||||||
|
@ -380,6 +392,14 @@ msgstr ""
|
||||||
msgid "as soon as possible!"
|
msgid "as soon as possible!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: views.py:234
|
||||||
|
msgid "is not a proper name"
|
||||||
|
msgstr "ist kein gültiger Name"
|
||||||
|
|
||||||
|
#: views.py:241
|
||||||
|
msgid "is not a proper email"
|
||||||
|
msgstr "ist keine gültige E-Mailadresse"
|
||||||
|
|
||||||
#~ msgid "Buy VM"
|
#~ msgid "Buy VM"
|
||||||
#~ msgstr "VM Kaufen"
|
#~ msgstr "VM Kaufen"
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,6 @@ h6 {
|
||||||
}
|
}
|
||||||
.pricing-section .card .description{
|
.pricing-section .card .description{
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
border-bottom: 1px solid rgba(128, 128, 128, 0.3);
|
|
||||||
}
|
}
|
||||||
.pricing-section .card .descriptions{
|
.pricing-section .card .descriptions{
|
||||||
padding: 10px 30px;
|
padding: 10px 30px;
|
||||||
|
@ -646,11 +645,10 @@ h6 {
|
||||||
}
|
}
|
||||||
.price-calc-section .card .description{
|
.price-calc-section .card .description{
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
border-bottom: 1px solid rgba(128, 128, 128, 0.3);
|
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around !important;
|
||||||
align-items: center;
|
align-items: center !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.price-calc-section .card .description span {
|
.price-calc-section .card .description span {
|
||||||
|
@ -661,7 +659,7 @@ h6 {
|
||||||
width: 30%;
|
width: 30%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
.price-calc-section .card .description input{
|
.price-calc-section .card .description .select-number{
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 60px;
|
width: 60px;
|
||||||
|
@ -701,8 +699,8 @@ h6 {
|
||||||
.price-calc-section .card .check-ip{
|
.price-calc-section .card .check-ip{
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
.price-calc-section .card .description.input{
|
.price-calc-section .card .justify-center{
|
||||||
justify-content: center;
|
justify-content: center !important;
|
||||||
}
|
}
|
||||||
.price-calc-section .card .description.input label{
|
.price-calc-section .card .description.input label{
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
|
@ -711,7 +709,8 @@ h6 {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
}
|
}
|
||||||
.price-calc-section .card .description.input input{
|
/*Changed class****.price-calc-section .card .description.input input*/
|
||||||
|
.price-calc-section .card .description input{
|
||||||
width: 200px;
|
width: 200px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
@ -726,6 +725,18 @@ h6 {
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
margin: 0 8px;
|
margin: 0 8px;
|
||||||
}
|
}
|
||||||
|
.help-block.with-errors {
|
||||||
|
text-align: center;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.has-error .checkbox, .has-error .checkbox-inline, .has-error .control-label, .has-error .help-block, .has-error .radio, .has-error .radio-inline, .has-error.checkbox label, .has-error.checkbox-inline label, .has-error.radio label, .has-error.radio-inline label{
|
||||||
|
color: #eb4d5c;
|
||||||
|
}
|
||||||
|
.form-group {
|
||||||
|
margin: 0;
|
||||||
|
border-bottom: 1px solid rgba(128, 128, 128, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
@media(max-width:990px) {
|
@media(max-width:990px) {
|
||||||
.pricing-section .text {
|
.pricing-section .text {
|
||||||
|
@ -911,7 +922,7 @@ h6 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.price-calc-section .card .description input {
|
.price-calc-section .card .description .select-number{
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 60px;
|
width: 60px;
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
<!-- Google analytics -->
|
||||||
|
{% include "google_analytics.html" %}
|
||||||
|
<!-- End Google Analytics -->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -60,53 +63,5 @@
|
||||||
<script src="{% static 'datacenterlight/js/form.js' %}"></script>
|
<script src="{% static 'datacenterlight/js/form.js' %}"></script>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.5.4/bootstrap-select.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.5.4/bootstrap-select.js"></script>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.16.0/jquery.validate.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.16.0/jquery.validate.min.js"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.9/validator.min.js"></script>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.5.4/bootstrap-select.js"></script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function(){
|
|
||||||
$.validator.setDefaults({
|
|
||||||
ignore: []
|
|
||||||
});
|
|
||||||
|
|
||||||
var name_message = "{% trans 'Please enter your name' %}";
|
|
||||||
var email_message = "{% trans 'Please enter a valid email address' %}";
|
|
||||||
$('#order_form').validate({
|
|
||||||
wrapper: 'div',
|
|
||||||
errorLabelContainer: "#error_message_box",
|
|
||||||
rules: {
|
|
||||||
name: {
|
|
||||||
required: true,
|
|
||||||
minlength: 3
|
|
||||||
},
|
|
||||||
email: {
|
|
||||||
required: true,
|
|
||||||
email: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
messages: {
|
|
||||||
name: name_message,
|
|
||||||
email: email_message
|
|
||||||
},
|
|
||||||
submitHandler: function (form) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// window.onload=function(){
|
|
||||||
// $('.selectpicker').selectpicker({
|
|
||||||
// style: 'btn-link',
|
|
||||||
// windowPadding: 10,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// var hash = window.location.hash.substr(1);
|
|
||||||
// console.log(hash);
|
|
||||||
// if (hash == 'requestform'){
|
|
||||||
// $('#reques-success-message').modal('show');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// };
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -139,7 +139,7 @@
|
||||||
<div class="landing card">
|
<div class="landing card">
|
||||||
<img class="img-beta" src="{% static 'datacenterlight/img/beta-img.png' %}" alt="">
|
<img class="img-beta" src="{% static 'datacenterlight/img/beta-img.png' %}" alt="">
|
||||||
<div class="caption">
|
<div class="caption">
|
||||||
<form id="order_form" method="POST" action="">
|
<form id="order_form" method="POST" action="" data-toggle="validator" role="form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h3>{% trans "VM hosting" %} </h3>
|
<h3>{% trans "VM hosting" %} </h3>
|
||||||
|
@ -152,28 +152,37 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="descriptions">
|
<div class="descriptions">
|
||||||
<div class="description">
|
<div class="description form-group">
|
||||||
<p>{% trans "Hosted in Switzerland" %}</p>
|
<p>{% trans "Hosted in Switzerland" %}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="description">
|
<div class="form-group">
|
||||||
|
<div class="description input">
|
||||||
<i class="fa fa-minus-circle left" data-minus="cpu" aria-hidden="true"></i>
|
<i class="fa fa-minus-circle left" data-minus="cpu" aria-hidden="true"></i>
|
||||||
<input class="input-price" type="number" min="1" max="42" id="coreValue" name="cpu">
|
<input class="input-price select-number" type="number" min="1" max="42" id="coreValue" name="cpu" data-error="{% trans 'Please enter a value greater than or equal to 1.' %}" required>
|
||||||
<span> Core</span>
|
<span> Core</span>
|
||||||
<i class="fa fa-plus-circle right" data-plus="cpu" aria-hidden="true"></i>
|
<i class="fa fa-plus-circle right" data-plus="cpu" aria-hidden="true"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="description">
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<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" type="number" min="2" max="200" name="ram">
|
<input id="ramValue" class="input-price select-number" type="number" min="2" max="200" name="ram" data-error="{% trans 'Please enter a value greater than or equal to 2.' %}" 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>
|
||||||
<div class="description">
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="description input">
|
||||||
<i class="fa fa-minus-circle left" data-minus="storage" aria-hidden="true"></i>
|
<i class="fa fa-minus-circle left" data-minus="storage" aria-hidden="true"></i>
|
||||||
<input id="storageValue" class="input-price" type="number" min="10" max="500" step="10" name="storage">
|
<input id="storageValue" class="input-price select-number" type="number" min="10" max="500" step="10" name="storage" data-error="{% trans 'Please enter a value greater than or equal to 10.' %}" required>
|
||||||
<span>{% trans "GB Storage (SSD)" %}</span>
|
<span>{% trans "GB Storage (SSD)" %}</span>
|
||||||
<i class="fa fa-plus-circle right" data-plus="storage" aria-hidden="true"></i>
|
<i class="fa fa-plus-circle right" data-plus="storage" aria-hidden="true"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="description select-configuration input">
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
<div class="description select-configuration input form-group justify-center">
|
||||||
<label for="config">OS</label>
|
<label for="config">OS</label>
|
||||||
<select name="config" id="">
|
<select name="config" id="">
|
||||||
{% for template in templates %}
|
{% for template in templates %}
|
||||||
|
@ -185,21 +194,40 @@
|
||||||
<!--<div class="description check-ip">
|
<!--<div class="description check-ip">
|
||||||
<input type="checkbox" name="ipv6"> Ipv6 Only<br>
|
<input type="checkbox" name="ipv6"> Ipv6 Only<br>
|
||||||
</div>-->
|
</div>-->
|
||||||
<div class="description input">
|
<div class="form-group">
|
||||||
<label for="name">{% trans "Name"%}</label>
|
<div class="description input justify-center">
|
||||||
<input type="text" name="name" placeholder="{% trans "Your Name" %}">
|
<label for="name" class="control-label">{% trans "Name"%}</label>
|
||||||
|
<input type="text" name="name" class="form-control" placeholder="{% trans 'Your Name'%}" data-minlength="3" data-error="{% trans 'Please enter your name' %}" required>
|
||||||
|
</div>
|
||||||
|
<div class="help-block with-errors">
|
||||||
|
{% for message in messages %}
|
||||||
|
{% if 'name' in message.tags %}
|
||||||
|
<ul class="list-unstyled"><li>
|
||||||
|
{{ message|safe }}
|
||||||
|
</li></ul>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="description input justify-center">
|
||||||
|
<label for="email" class="control-label">{% trans "Email"%}</label>
|
||||||
|
<input name="email" type="email" pattern="^[^@\s]+@([^@\s]+\.)+[^@\s]+$" class="form-control" placeholder="{% trans 'Your Email' %}" data-error="{% trans 'Please enter a valid email address' %}" required>
|
||||||
|
</div>
|
||||||
|
<div class="help-block with-errors">
|
||||||
|
{% for message in messages %}
|
||||||
|
{% if 'email' in message.tags %}
|
||||||
|
<ul class="list-unstyled"><li>
|
||||||
|
{{ message|safe }}
|
||||||
|
</li></ul>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="description input">
|
|
||||||
<label for="email">{% trans "Email" %}</label>
|
|
||||||
<input type="email" name="email" placeholder="{% trans "Your Email" %}">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="submit" class="btn btn-primary" value="{% trans 'Order Now!' %}"></input>
|
<input type="submit" class="btn btn-primary" value="{% trans 'Order Now!' %}"></input>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<div id="error_message_box" class="error-message-box"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ from django import forms
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.views.decorators.cache import cache_control
|
from django.views.decorators.cache import cache_control
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from utils.forms import BillingAddressForm, UserBillingAddressForm
|
from utils.forms import BillingAddressForm, UserBillingAddressForm
|
||||||
from utils.models import BillingAddress
|
from utils.models import BillingAddress
|
||||||
from membership.models import StripeCustomer
|
from membership.models import StripeCustomer
|
||||||
|
@ -194,12 +195,9 @@ 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):
|
||||||
if 'specs' in request.session :
|
for session_var in ['specs', 'user', 'billing_address_data']:
|
||||||
del request.session['specs']
|
if session_var in request.session:
|
||||||
if 'user' in request.session :
|
del request.session[session_var]
|
||||||
del request.session['user']
|
|
||||||
if 'billing_address_data' in request.session :
|
|
||||||
del request.session['billing_address_data']
|
|
||||||
try:
|
try:
|
||||||
manager = OpenNebulaManager()
|
manager = OpenNebulaManager()
|
||||||
templates = manager.get_templates()
|
templates = manager.get_templates()
|
||||||
|
@ -233,14 +231,16 @@ class IndexView(CreateView):
|
||||||
try:
|
try:
|
||||||
name = name_field.clean(name)
|
name = name_field.clean(name)
|
||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
messages.add_message(self.request, messages.ERROR, '%(value) is not a proper name.'.format(name))
|
msg='{} {}.'.format(name, _('is not a proper name'))
|
||||||
return HttpResponseRedirect(reverse('datacenterlight:index'))
|
messages.add_message(self.request, messages.ERROR, msg, extra_tags='name')
|
||||||
|
return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
email = email_field.clean(email)
|
email = email_field.clean(email)
|
||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
messages.add_message(self.request, messages.ERROR, '%(value) is not a proper email.'.format(email))
|
msg='{} {}.'.format(email, _('is not a proper email'))
|
||||||
return HttpResponseRedirect(reverse('datacenterlight:index'))
|
messages.add_message(self.request, messages.ERROR, msg, extra_tags='email')
|
||||||
|
return HttpResponseRedirect(reverse('datacenterlight:index') + "#order_form")
|
||||||
|
|
||||||
specs = {
|
specs = {
|
||||||
'cpu': cores,
|
'cpu': cores,
|
||||||
|
|
|
@ -43,23 +43,9 @@
|
||||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
||||||
<script>
|
<!-- Google analytics -->
|
||||||
(function (i, s, o, g, r, a, m) {
|
{% include 'google_analytics.html' %}
|
||||||
i['GoogleAnalyticsObject'] = r;
|
<!-- End Google Analytics -->
|
||||||
i[r] = i[r] || function () {
|
|
||||||
(i[r].q = i[r].q || []).push(arguments)
|
|
||||||
}, i[r].l = 1 * new Date();
|
|
||||||
a = s.createElement(o),
|
|
||||||
m = s.getElementsByTagName(o)[0];
|
|
||||||
a.async = 1;
|
|
||||||
a.src = g;
|
|
||||||
m.parentNode.insertBefore(a, m)
|
|
||||||
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
|
||||||
|
|
||||||
ga('create', 'UA-62285904-2', 'auto');
|
|
||||||
ga('send', 'pageview');
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -118,6 +118,7 @@ INSTALLED_APPS = (
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'utils.middleware.MultipleProxyMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
@ -138,6 +139,7 @@ TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [os.path.join(PROJECT_DIR, 'cms_templates/'),
|
'DIRS': [os.path.join(PROJECT_DIR, 'cms_templates/'),
|
||||||
|
os.path.join(PROJECT_DIR, 'templates'),
|
||||||
os.path.join(PROJECT_DIR, 'cms_templates/djangocms_blog/'),
|
os.path.join(PROJECT_DIR, 'cms_templates/djangocms_blog/'),
|
||||||
os.path.join(PROJECT_DIR, 'membership'),
|
os.path.join(PROJECT_DIR, 'membership'),
|
||||||
os.path.join(PROJECT_DIR, 'hosting/templates/'),
|
os.path.join(PROJECT_DIR, 'hosting/templates/'),
|
||||||
|
@ -161,6 +163,7 @@ TEMPLATES = [
|
||||||
"django.contrib.messages.context_processors.messages",
|
"django.contrib.messages.context_processors.messages",
|
||||||
'sekizai.context_processors.sekizai',
|
'sekizai.context_processors.sekizai',
|
||||||
'cms.context_processors.cms_settings',
|
'cms.context_processors.cms_settings',
|
||||||
|
'utils.context_processor.google_analytics',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -509,3 +512,12 @@ OPENNEBULA_ENDPOINT = env('OPENNEBULA_ENDPOINT')
|
||||||
# dcl email configurations
|
# dcl email configurations
|
||||||
DCL_TEXT = env('DCL_TEXT')
|
DCL_TEXT = env('DCL_TEXT')
|
||||||
DCL_SUPPORT_FROM_ADDRESS = env('DCL_SUPPORT_FROM_ADDRESS')
|
DCL_SUPPORT_FROM_ADDRESS = env('DCL_SUPPORT_FROM_ADDRESS')
|
||||||
|
|
||||||
|
# Settings for Google analytics
|
||||||
|
GOOGLE_ANALYTICS_PROPERTY_IDS = {
|
||||||
|
'datacenterlight.ch': 'UA-62285904-9',
|
||||||
|
'digitalglarus.ch': 'UA-62285904-2',
|
||||||
|
'127.0.0.1:8000': 'localhost',
|
||||||
|
'dynamicweb-development.ungleich.ch': 'development',
|
||||||
|
'dynamicweb-staging.ungleich.ch': 'staging'
|
||||||
|
}
|
||||||
|
|
13
templates/google_analytics.html
Normal file
13
templates/google_analytics.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{% if GOOGLE_ANALYTICS_PROPERTY_ID %}
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', '{{ GOOGLE_ANALYTICS_PROPERTY_ID }}', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
</script>
|
||||||
|
{% else %}
|
||||||
|
<!-- Empty analytics -->
|
||||||
|
{% endif %}
|
15
utils/context_processor.py
Normal file
15
utils/context_processor.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
def google_analytics(request):
|
||||||
|
"""
|
||||||
|
Use the variables returned in this function to
|
||||||
|
render your Google Analytics tracking code template.
|
||||||
|
"""
|
||||||
|
host = request.get_host()
|
||||||
|
ga_prop_id = getattr(settings, 'GOOGLE_ANALYTICS_PROPERTY_IDS', False).get(host)
|
||||||
|
if not settings.DEBUG and ga_prop_id:
|
||||||
|
return {
|
||||||
|
'GOOGLE_ANALYTICS_PROPERTY_ID': ga_prop_id
|
||||||
|
}
|
||||||
|
return {}
|
17
utils/middleware.py
Normal file
17
utils/middleware.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
class MultipleProxyMiddleware(object):
|
||||||
|
FORWARDED_FOR_FIELDS = [
|
||||||
|
'HTTP_X_FORWARDED_FOR',
|
||||||
|
'HTTP_X_FORWARDED_HOST',
|
||||||
|
'HTTP_X_FORWARDED_SERVER',
|
||||||
|
]
|
||||||
|
|
||||||
|
def process_request(self, request):
|
||||||
|
"""
|
||||||
|
Rewrites the proxy headers so that only the most
|
||||||
|
recent proxy is used.
|
||||||
|
"""
|
||||||
|
for field in self.FORWARDED_FOR_FIELDS:
|
||||||
|
if field in request.META:
|
||||||
|
if ',' in request.META[field]:
|
||||||
|
parts = request.META[field].split(',')
|
||||||
|
request.META[field] = parts[-1].strip()
|
Loading…
Reference in a new issue