whydcl section style fix, footer style fix

This commit is contained in:
Arvind Tiwari 2018-03-05 18:41:13 +05:30
parent a895f7caa7
commit 883118e050
7 changed files with 76 additions and 43 deletions

View file

@ -47,6 +47,8 @@ class DCLSectionPluginModel(CMSPlugin):
extra_classes += ' section-sm-center'
if self.background_gradient:
extra_classes += ' section-gradient'
if self.plain_heading:
extra_classes += ' split-section-plain'
return extra_classes
def __str__(self):

View file

@ -8,6 +8,7 @@ from .cms_models import (
DCLSectionIconPluginModel, DCLSectionImagePluginModel,
DCLSectionPluginModel,
)
from .models import VMTemplate
@plugin_pool.register_plugin
@ -49,6 +50,13 @@ class DCLCalculatorPlugin(CMSPluginBase):
render_template = "datacenterlight/cms/calculator.html"
cache = False
def render(self, context, instance, placeholder):
context = super(DCLCalculatorPlugin, self).render(
context, instance, placeholder
)
context['templates'] = VMTemplate.objects.all()
return context
@plugin_pool.register_plugin
class DCLBannerListPlugin(CMSPluginBase):

View file

@ -52,7 +52,10 @@
/* only for editing mode */
.section-figure .cms-plugin {
padding: 10px;
flex-basis: 50%;
flex-grow: 1;
}
.split-section-plain .section-figure .cms-plugin {
flex-grow: 0;
}

View file

@ -436,11 +436,29 @@ textarea {
}
.section-figure .section-image {
padding: 10px;
padding: 25px 15px;
flex-basis: 50%;
flex-grow: 1;
}
.split-section-plain .section-figure .section-image {
flex-grow: 0;
}
.split-section-plain .section-figure {
justify-content: flex-start;
}
@media (min-width: 768px) {
.split-section-plain .split-figure {
width: 41.66666667%;
}
.split-section-plain .split-text {
width: 58.33333333%;
}
}
.section-image img {
margin: auto;
}
@ -1236,12 +1254,12 @@ footer .dcl-link-separator::before {
content: "";
position: absolute;
display: inline-block;
top: 8px;
top: 9px;
bottom: 0;
left: -3px;
left: -2px;
right: 0;
width: 4px;
height: 4px;
width: 2px;
height: 2px;
border-radius: 100%;
background: #777;
}

View file

@ -3,24 +3,20 @@
<div class="split-section {{ instance.get_extra_classes }}" id="{{ instance.html_id }}">
<div class="container">
<div class="row">
<div class="col-sm-6 {% if instance.text_direction == 'left' %}col-sm-push-6{% endif %}">
{% block section-feature %}
<div class="section-figure">
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
</div>
{% endblock section-feature %}
<div class="col-sm-6 {% if instance.text_direction == 'left' %}col-sm-push-6{% endif %} split-figure">
<div class="section-figure">
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
</div>
</div>
<div class="col-sm-6 {% if instance.text_direction == 'left' %}col-sm-pull-6{% endif %}">
<div class="split-text">
<div class="{% if not instance.plain_heading %}split-title{% endif %}">
<h2>{{ instance.heading }}</h2>
</div>
<div class="split-description">
<div class="lead">
{{ instance.content }}
</div>
<div class="col-sm-6 {% if instance.text_direction == 'left' %}col-sm-pull-6{% endif %} split-text">
<div class="{% if not instance.plain_heading %}split-title{% endif %}">
<h2>{{ instance.heading }}</h2>
</div>
<div class="split-description">
<div class="lead">
{{ instance.content }}
</div>
</div>
</div>

View file

@ -1,5 +1,5 @@
{% load staticfiles i18n%}
<form id="order_form" method="POST" action="" data-toggle="validator" role="form">
<form id="order_form" method="POST" action="{% url 'datacenterlight:index' %}" data-toggle="validator" role="form">
{% csrf_token %}
<div class="title">
<h3>{% trans "VM hosting" %} </h3>

View file

@ -112,37 +112,41 @@ class IndexView(CreateView):
storage_field = forms.IntegerField(validators=[self.validate_storage])
template_id = int(request.POST.get('config'))
template = VMTemplate.objects.filter(
opennebula_vm_template_id=template_id).first()
opennebula_vm_template_id=template_id
).first()
template_data = VMTemplateSerializer(template).data
referer_url = request.META['HTTP_REFERER']
try:
cores = cores_field.clean(cores)
except ValidationError as err:
msg = '{} : {}.'.format(cores, str(err))
messages.add_message(self.request, messages.ERROR, msg,
extra_tags='cores')
return HttpResponseRedirect(
reverse('datacenterlight:index') + "#order_form")
messages.add_message(
self.request, messages.ERROR, msg, extra_tags='cores'
)
return HttpResponseRedirect(referer_url + "#order_form")
try:
memory = memory_field.clean(memory)
except ValidationError as err:
msg = '{} : {}.'.format(memory, str(err))
messages.add_message(self.request, messages.ERROR, msg,
extra_tags='memory')
return HttpResponseRedirect(
reverse('datacenterlight:index') + "#order_form")
messages.add_message(
self.request, messages.ERROR, msg, extra_tags='memory'
)
return HttpResponseRedirect(referer_url + "#order_form")
try:
storage = storage_field.clean(storage)
except ValidationError as err:
msg = '{} : {}.'.format(storage, str(err))
messages.add_message(self.request, messages.ERROR, msg,
extra_tags='storage')
return HttpResponseRedirect(
reverse('datacenterlight:index') + "#order_form")
amount_to_be_charged = get_vm_price(cpu=cores, memory=memory,
disk_size=storage)
messages.add_message(
self.request, messages.ERROR, msg, extra_tags='storage'
)
return HttpResponseRedirect(referer_url + "#order_form")
amount_to_be_charged = get_vm_price(
cpu=cores, memory=memory, disk_size=storage
)
specs = {
'cpu': cores,
'memory': memory,
@ -161,8 +165,9 @@ class IndexView(CreateView):
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
context.update({
'base_url': "{0}://{1}".format(self.request.scheme,
self.request.get_host()),
'base_url': "{0}://{1}".format(
self.request.scheme, self.request.get_host()
),
'contact_form': ContactForm
})
return context
@ -231,8 +236,9 @@ class PaymentOrderView(FormView):
def post(self, request, *args, **kwargs):
if 'login_form' in request.POST:
login_form = HostingUserLoginForm(data=request.POST,
prefix='login_form')
login_form = HostingUserLoginForm(
data=request.POST, prefix='login_form'
)
if login_form.is_valid():
email = login_form.cleaned_data.get('email')
password = login_form.cleaned_data.get('password')