Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Work on third calculator and other things

  • Loading branch information...
commit c23261a796c5365052bc0d3354cf52aee1d368c0 1 parent 3752eb1
@Guest007 authored
View
1  eurocard/settings.py
@@ -46,6 +46,7 @@
'articles',
'orders',
"mailshelf",
+ "sorl.thumbnail",
)
MIDDLEWARE_CLASSES = (
View
18 orders/views.py
@@ -189,11 +189,7 @@ def save_order(request, step=1):
if templ is None:
templ = OrderTemplate(name=(user if user else '')) # Создаем тело заказа. Название - имя заказчика
- if int(step) > 20:
- print request.POST
- print request.POST.get("id", False)
- # print request.POST.get("emboss", False)
- elif int(step) > 10:
+ if int(step) > 10:
# print request.POST
templ.color_back = None # Color(id=request.POST.get("color_back", None))
templ.color_front = Color(id=(request.POST.get("colors", None)))
@@ -298,7 +294,10 @@ def save_order1(request, step=1):
except (TypeError, ValueError):
id = 0
- print request.POST
+ # print request.POST
+ draw = request.POST.get("count", None) # количество в заказ
+ if not draw:
+ draw = 0
time = datetime.datetime.now()
@@ -307,22 +306,21 @@ def save_order1(request, step=1):
print price
templ.pk = None
- # templ.id = 0
+
templ.is_template = False
templ.name = str(time) + " " + templ.name
templ.price = None
templ.save() # взяли шаблон по id, обрали признак шаблона и скопировали.
- print "1234", templ.pk
order = Orders(template=templ)
- draw = request.POST.get("count", None)
+ # draw = request.POST.get("count", None)
order.draw = draw
order.cost = float(draw) * float(price)
order.save() # привязали заказ к шаблону, посчитали цену, записали. Теперь нужны остальные данные и всё.
print order.cost
- print order.template.name
+ # print order.template.name
# user = request.POST.get("user", None)
View
2  requirements.txt
@@ -7,4 +7,4 @@ django-debug-toolbar
django-menu
django-annoying==0.7.7
-e hg+https://bitbucket.org/anger/django-mailshelf@08649fb461d126d17b8569c2a763e5db835d6e1a#egg=django_mailshelf-dev
-
+sorl-thumbnail
View
51 templates/helpers.html
@@ -1,4 +1,4 @@
-<form id="final_form" class="jClever" method="post" action="{% url 'finish' %}">
+<form class="jClever last_step" method="post" action="{% url 'finish' %}">
<input type="hidden" name="id" value="{{ object.id }}">
<div class="order">
<span>Ваш заказ<small class="close_order"><i class="fa fa-times"></i></small></span>
@@ -51,18 +51,37 @@
</div>
</form>
-<script type="application/javascript">
-$('#final_form').submit(function(){
- var action = $(this).attr('action');
- var that = $(this);
- $.ajax({
- url: action,
- type: 'POST',
- data: that.serialize(),
- complete: function(result){
- document.location.href = "/";
- }
- });
- return false;
- });
-</script>
+<script>
+ $('.last_step').submit(function(){
+ var action = $(this).attr('action');
+ var that = $(this);
+ $.ajax({
+ url: action,
+ type: 'POST',
+ data: that.serialize(),
+ complete: function(result){
+ document.location.href = "/";
+ }
+ });
+ });
+</script>
+
+<form class="jClever user_info" method="post" action="{% url 'finish' %}">
+ <input type="hidden" name="id" value="{{ object.id }}">
+ <div class="order info">
+ <span>Информация к заказу<small class="close_order"><i class="fa fa-times"></i></small></span>
+ <ul class="info">
+ <li>
+ <input type="text" name="name" placeholder="ФИО">
+ <input type="email" name="email" placeholder="Email">
+ <input type="text" name="phone_" placeholder="Номер телефона">
+ </li>
+ </ul>
+ <ul>
+ <li>
+ <input type="submit" value="Отправить заказ">
+ </li>
+ </ul>
+ </div>
+</form>
+
View
1  templates/layout.html
@@ -57,7 +57,6 @@
self.addClass('hide');
}
});
- return false;
});
}
call_();
View
7 templates/tags/tag.active_news_block.html
@@ -1,3 +1,4 @@
+{% load thumbnail %}
<section class="news">
<span><span>Акции и спецпредложения</span></span>
<ul>
@@ -5,7 +6,11 @@
{% for item in objects %}
<li>
<a href="/article/{{ item.slug }}">{{ item.title }}</a>
- <img src="/media/{{ item.card }}" width="280px">
+ {% if item.card %}
+ {% thumbnail item.card "288" as im %}
+ <div style="background: url('{{ im.url }}') no-repeat center center"></div>
+ {% endthumbnail %}
+ {% endif %}
<span>{{ item.annotation|safe|truncatewords_html:35 }}</span>
</li>
View
46 theme/css/template.css
@@ -222,6 +222,30 @@ body.under_overlay > div.data_wrap > div > .data_container > .data_checking > fo
body.under_overlay > div.data_wrap > div > .data_container > .data_checking > form > div.order > ul.info > li:first-child > span > i.fa-check {
color: #33ae30;
}
+body.under_overlay > div.data_wrap > div > .data_container > .data_checking > form > div.order.info > ul {
+ width: 100%;
+ padding: 20px 0;
+}
+body.under_overlay > div.data_wrap > div > .data_container > .data_checking > form > div.order.info > ul > li {
+ width: 600px !important;
+ padding: 0 20px !important;
+ border: 0 !important;
+ padding: 0;
+}
+body.under_overlay > div.data_wrap > div > .data_container > .data_checking > form > div.order.info > ul > li > input {
+ height: 36px;
+ display: block;
+ position: relative;
+ margin: 20px 0;
+}
+body.under_overlay > div.data_wrap > div > .data_container > .data_checking > form > div.order.info > ul > li > input[type="text"],
+body.under_overlay > div.data_wrap > div > .data_container > .data_checking > form > div.order.info > ul > li > input[type="email"] {
+ background: #fff;
+ border: 2px solid #ddd;
+ border-radius: 6px;
+ padding: 0 10px;
+ width: 400px;
+}
body.under_overlay > div.data_wrap > div > .data_container > .data_checking > form > div.files > ul {
padding: 20px 0;
}
@@ -634,10 +658,20 @@ body.under_overlay > div.data_wrap > div > .data_container > .data_checking.file
height: 156px;
float: right;
border: 2px solid #dc3b3b;
- overflow: hidden;
border-radius: 6px;
+ position: relative;
margin: 0 250px 0 20px;
}
+.wrap_all > article > div.content > ul.card_way > li > span:after {
+ content: " ";
+ display: block;
+ width: 97px;
+ height: 116px;
+ background: url('../images/prod_arrow.png') no-repeat right top;
+ position: absolute;
+ right: -116px;
+ top: -30px;
+}
.wrap_all > article > div.content > ul.card_way > li > span > img {
width: 244px;
height: 156px;
@@ -658,6 +692,13 @@ body.under_overlay > div.data_wrap > div > .data_container > .data_checking.file
float: left;
margin: 0 20px 0 250px;
}
+.wrap_all > article > div.content > ul.card_way > li:nth-child(even) > span:after {
+ background: url('../images/prod_arrow.png') no-repeat left top;
+ position: absolute;
+ right: auto;
+ left: -116px;
+ top: -30px;
+}
.wrap_all > article > div.content > ul.card_way > li:nth-child(even) > p,
.wrap_all > article > div.content > ul.card_way > li:nth-child(even) > h2 {
text-align: left;
@@ -665,6 +706,9 @@ body.under_overlay > div.data_wrap > div > .data_container > .data_checking.file
.wrap_all > article > div.content > ul.card_way > li:first-child > span {
margin: 0 20px;
}
+.wrap_all > article > div.content > ul.card_way > li:first-child > span:after {
+ display: none;
+}
.wrap_all > article > div.contacts {
margin: 0 0 30px;
display: inline-block;
View
68 theme/css/template.less
@@ -256,6 +256,33 @@ body {
}
}
}
+ &.info {
+ & > ul {
+ width: 100%;
+ padding: 20px 0;
+ & > li {
+ width: 600px !important;
+ padding: 0 20px !important;
+ border: 0 !important;
+
+ padding: 0;
+ & > input {
+ height: 36px;
+ display: block;
+ position: relative;
+ margin: 20px 0;
+ &[type="text"],
+ &[type="email"] {
+ background: #fff;
+ border: 2px solid #ddd;
+ border-radius: 6px;
+ padding: 0 10px;
+ width: 400px;
+ }
+ }
+ }
+ }
+ }
}
&.files {
& > ul {
@@ -693,10 +720,23 @@ body {
height: 156px;
float: right;
border: 2px solid #dc3b3b;
- overflow: hidden;
+ //overflow: hidden;
border-radius: 6px;
+ position: relative;
margin: 0 250px 0 20px;
-
+ &:after {
+ content: " ";
+ display: block;
+ width: 97px;
+ height: 116px;
+ background: url('../images/prod_arrow.png') no-repeat right top;
+ position: absolute;
+ right: -116px;
+ top: -30px;
+
+
+ }
+
& > img {
//float: left;
width: 244px;
@@ -721,6 +761,15 @@ body {
& > span {
float: left;
margin: 0 20px 0 250px;
+ &:after {
+ background: url('../images/prod_arrow.png') no-repeat left top;
+ position: absolute;
+ right: auto;
+ left: -116px;
+ top: -30px;
+
+
+ }
}
& > p,
& > h2 {
@@ -730,6 +779,9 @@ body {
&:first-child {
& > span {
margin: 0 20px;
+ &:after {
+ display: none;
+ }
}
}
@@ -2008,18 +2060,6 @@ form.call {
padding: 0 10px;
width: 276px;
}
- &[type="submit"] {
- //background: #373333;
- //border: 1px solid #000;
- //border-bottom: 2px solid #000;
- //border-top: 0;
- //font: 600 18px/32px @main_font;
- //height: 38px !important;
- //top: 1px;
- //padding: 0 10px 2px;
- //color: #fff;
- //border-radius: 6px;
- }
}
& > textarea {
width: 276px;
View
73 theme/js/init.js
@@ -43,7 +43,7 @@
$('html').addClass('hidden');
$('body').addClass('under_overlay')
.append('<div class="overlay"></div><div class="data_wrap"><div><div class="data_container"><div class="data_checking"></div></div></div></div>');
- $('.data_checking').load('/second/'+result.id+'/');
+ $('.data_checking').load('/second/'+result.id+'/ .last_step');
}
if($(this).hasClass('calc')){
@@ -299,39 +299,34 @@
else{
valid = true;
}
- //console.log(valid);
}
}
$this.submit(function(){
-
-
- //console.log("Call AJAX", csrftoken);
$this.find('input[name="csrfmiddlewaretoken"]').val(csrftoken);
- //console.log($('#file_data'));
var action = $(this).attr('action'),
self = $(this),
selection = $this.find('input, select').not(' .ratio, input[name="colors"], input[name="materials"], input[name="count_hidden"], input[name="lamination"], input[name="color_front"], input[name="color_back"]').serialize();
- //console.log(selection);
- //console.log(action);
+
$.ajax({
url: action,
type: 'POST',
data: selection,
+
before_send: function(xhr, settings) {
- //console.log("Before SENT")
if (!csrf_safe_method(settings.type) && same_origin(settings.url)) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
},
success: function(result){
validate();
- //console.log(valid);
if(valid == true){
confirm_order(result);
+
}
}
});
+
return false;
});
}
@@ -342,7 +337,6 @@
count = parseFloat($(this).val())||0,
total = one_price*count,
total_fix = total.toFixed(2);
- //console.log(count, total, one_price);
if(count <= 0){
$(this).addClass('error').siblings('span').children('span').html('');
}
@@ -350,18 +344,12 @@
$(this).removeClass('error').siblings('span').children('span').html(total_fix+'руб.');
}
});
-
$(this).find('form').submit(function(){
-
- //console.log("Call AJAX", csrftoken);
$(this).find('input[name="csrfmiddlewaretoken"]').val(csrftoken);
- //console.log($('#file_data'));
var self = $(this),
action = $(this).attr('action'),
self = $(this);
- //selection = $this.find('input, select').not(' .ratio, input[name="colors"], input[name="materials"], input[name="count_hidden"], input[name="lamination"], input[name="color_front"], input[name="color_back"]').serialize();
- //console.log(selection);
- //console.log(action);
+
$.ajax({
url: action,
type: 'POST',
@@ -373,19 +361,21 @@
}
},
success: function(result){
-
- confirm_order(result);
-
+ confirm_order(result);
}
});
- return false;
+
+ return false;
});
});
-
-
+ function confirm_order(result) {
+ $(this).find('input#id').val(result.id);
+ $('html').addClass('hidden');
+ $('body').addClass('under_overlay')
+ .append('<div class="overlay"></div><div class="data_wrap"><div><div class="data_container"><div class="data_checking"></div></div></div></div>');
+ $('.data_checking').load('/second/'+result.id+'/ .user_info');
+ }
}
-
-
});
}
}());
@@ -597,7 +587,36 @@ $(document).ready(function(){
news_title_height();
//Обратный звонок
-
+ function call_() {
+ var self = $('form.call');
+ $('.location > a').click(function(){
+ self.removeClass('hide');
+ return false;
+ });
+ self.find('.close_form').click(function(){
+ self.addClass('hide');
+ });
+ self.submit(function(){
+ var action = self.attr('action');
+ console.log(action);
+ $.ajax({
+ url: action,
+ type: 'POST',
+ data: self.serialize(),
+ complete: function(result){
+ self.trigger( 'reset' );
+ self.addClass('hide');
+ }
+ });
+ });
+ function confirm_answer() {
+ $('html').addClass('hidden');
+ $('body').addClass('under_overlay')
+ .append('<div class="overlay"></div><div class="data_wrap"><div><div class="data_container"><div class="data_checking"></div></div></div></div>');
+ $('.data_checking').html('<h2>Спасибо, Ваш запрос принят, в ближайшее время </h2>');
+ }
+ }
+ call_();
$('.location > a').click(function(){
$(this).siblings('form').removeClass('hide');
Please sign in to comment.
Something went wrong with that request. Please try again.