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' extra_classes += ' section-sm-center'
if self.background_gradient: if self.background_gradient:
extra_classes += ' section-gradient' extra_classes += ' section-gradient'
if self.plain_heading:
extra_classes += ' split-section-plain'
return extra_classes return extra_classes
def __str__(self): def __str__(self):

View file

@ -8,6 +8,7 @@ from .cms_models import (
DCLSectionIconPluginModel, DCLSectionImagePluginModel, DCLSectionIconPluginModel, DCLSectionImagePluginModel,
DCLSectionPluginModel, DCLSectionPluginModel,
) )
from .models import VMTemplate
@plugin_pool.register_plugin @plugin_pool.register_plugin
@ -49,6 +50,13 @@ class DCLCalculatorPlugin(CMSPluginBase):
render_template = "datacenterlight/cms/calculator.html" render_template = "datacenterlight/cms/calculator.html"
cache = False 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 @plugin_pool.register_plugin
class DCLBannerListPlugin(CMSPluginBase): class DCLBannerListPlugin(CMSPluginBase):

View file

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

View file

@ -436,11 +436,29 @@ textarea {
} }
.section-figure .section-image { .section-figure .section-image {
padding: 10px; padding: 25px 15px;
flex-basis: 50%; flex-basis: 50%;
flex-grow: 1; 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 { .section-image img {
margin: auto; margin: auto;
} }
@ -1236,12 +1254,12 @@ footer .dcl-link-separator::before {
content: ""; content: "";
position: absolute; position: absolute;
display: inline-block; display: inline-block;
top: 8px; top: 9px;
bottom: 0; bottom: 0;
left: -3px; left: -2px;
right: 0; right: 0;
width: 4px; width: 2px;
height: 4px; height: 2px;
border-radius: 100%; border-radius: 100%;
background: #777; background: #777;
} }

View file

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

View file

@ -1,5 +1,5 @@
{% load staticfiles i18n%} {% 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 %} {% csrf_token %}
<div class="title"> <div class="title">
<h3>{% trans "VM hosting" %} </h3> <h3>{% trans "VM hosting" %} </h3>

View file

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