LIL-629 Попап с выбором дней перед покупкой показывать не авторизованным

remotes/origin/hotfix/LIL-661
gzbender 8 years ago
parent 191d2886cd
commit 2bc26ee02b
  1. 4
      apps/school/templates/blocks/day_pay_btn.html
  2. 12
      apps/school/templates/blocks/schedule_item.html
  3. 4
      apps/school/templates/summer/promo.html
  4. 12
      project/templates/blocks/popup_auth.html
  5. 2
      project/templates/blocks/popup_buy.html
  6. 29
      web/src/js/modules/auth.js
  7. 37
      web/src/js/modules/popup.js

@ -1,7 +1,5 @@
<a
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% endif %}
data-popup=".js-popup-buy"
class="timing__btn btn"
href="{% url 'school-checkout' %}?weekdays={{ school_schedule.weekday }}&add_days=true"
>купить</a>

@ -5,17 +5,17 @@
<div class="timing__day{% if school_schedule.is_online %} active{% endif %}">
{{ school_schedule }}
</div>
{% if purchased and live_lesson %}
{% if is_purchased and live_lesson %}
<div class="timing__date">{{ live_lesson.date }}</div>
{% endif %}
<div class="timing__time">{{ school_schedule.start_at }} (МСК)</div>
<div class="timing__buy">
{% if purchased %}
{% if school_schedule.weekday in school_schedules_purchased %}
{% if live_lesson and live_lesson.title %}
{% include './open_lesson.html' %}
{% endif %}
{% if is_purchased %}
{% if school_schedule.weekday in school_schedules_purchased and live_lesson and live_lesson.title %}
{% include './open_lesson.html' %}
{% endif %}
{% else %}
{% include './day_pay_btn.html' %}
{% endif %}
</div>
</div>

@ -10,11 +10,7 @@
<div class="main__actions">
<a
{% if not is_purchased_future %}
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% else %}
data-popup=".js-popup-buy"
{% endif %}
{% endif %}
class="main__btn btn"
href="#"

@ -37,10 +37,10 @@
<div class="field__password-show">
<button class="password-toggle" type="button">
<svg class="icon icon-password-eye">
<use xlink:href={% static "img/sprite.svg" %}#icon-password-eye></use>
<use xlink:href="{% static 'img/sprite.svg' %}#icon-password-eye"></use>
</svg>
<svg class="icon icon-password-hidden-eye">
<use xlink:href={% static "img/sprite.svg" %}#icon-password-hidden-eye></use>
<use xlink:href="{% static 'img/sprite.svg' %}#icon-password-hidden-eye"></use>
</svg>
</button>
</div>
@ -53,7 +53,7 @@
<div class="auth__or">или</div>
<button type="button" class="auth__btn btn btn_fb">
<svg class="icon icon-facebook">
<use xlink:href={% static "img/sprite.svg" %}#icon-facebook></use>
<use xlink:href="{% static 'img/sprite.svg' %}#icon-facebook"></use>
</svg>
<span class="btn__title">ЧЕРЕЗ FACEBOOK</span>
</button>
@ -96,10 +96,10 @@
<div class="field__password-show">
<button class="password-toggle" type="button">
<svg class="icon icon-password-eye">
<use xlink:href={% static "img/sprite.svg" %}#icon-password-eye></use>
<use xlink:href="{% static 'img/sprite.svg' %}#icon-password-eye"></use>
</svg>
<svg class="icon icon-password-hidden-eye">
<use xlink:href={% static "img/sprite.svg" %}#icon-password-hidden-eye></use>
<use xlink:href="{% static 'img/sprite.svg' %}#icon-password-hidden-eye"></use>
</svg>
</button>
</div>
@ -122,7 +122,7 @@
<div class="auth__or">или</div>
<button type="button" class="auth__btn btn btn_fb">
<svg class="icon icon-facebook">
<use xlink:href={% static "img/sprite.svg" %}#icon-facebook></use>
<use xlink:href="{% static 'img/sprite.svg' %}#icon-facebook"></use>
</svg>
<span class="btn__title">ЧЕРЕЗ FACEBOOK</span>
</button>

@ -89,7 +89,7 @@
</div>
</div>
<div class="buy__foot">
<a class="buy__btn btn btn_md but_btn_popup" data-link="{% url 'school-checkout' %}" href="{% url 'school-checkout' %}?weekdays=1&weekdays=2">ПЕРЕЙТИ К ОПЛАТЕ</a>
<a class="buy__btn btn btn_md but_btn_popup" data-link="{% url 'school-checkout' %}">ПЕРЕЙТИ К ОПЛАТЕ</a>
</div>
</div>
</div>

@ -4,7 +4,7 @@ import isEmpty from 'validator/lib/isEmpty';
import isLength from 'validator/lib/isLength';
$(document).ready(function () {
let auth = $('.js-auth'),
let popup = $('.js-popup-auth'),
type = auth.find('.js-auth-type'),
tab = auth.find('.js-auth-tab'),
login = auth.find('.js-auth-login'),
@ -153,7 +153,13 @@ $(document).ready(function () {
})
.done(function (data) {
if (data.success === true) {
location.reload();
const nextUrl = popup.data('next-url');
if(nextUrl){
window.location.href = nextUrl;
}
else{
window.location.reload();
}
} else {
authButton.removeClass('loading');
}
@ -234,7 +240,13 @@ $(document).ready(function () {
})
.done(function (data) {
if (data.success === true) {
location.reload();
const nextUrl = popup.data('next-url');
if(nextUrl){
window.location.href = nextUrl;
}
else{
window.location.reload();
}
} else {
registrationButton.removeClass('loading');
}
@ -275,7 +287,7 @@ $(document).ready(function () {
if (facebookResponse) {
if (facebookResponse.status === 'connected') {
login_with_facebook(facebookResponse.authResponse.accessToken);
login_with_facebook(facebookResponse.authResponse.accessToken, popup.data('next-url'));
return;
}
}
@ -305,14 +317,19 @@ function load_facebook() {
});
}
function login_with_facebook(accessToken) {
function login_with_facebook(accessToken, nextUrl) {
$.ajax('/auth/facebook_login/', {
method: 'POST',
data: {'access_token': accessToken},
})
.done(function (data) {
if (data.success === true) {
location.reload();
if(nextUrl){
window.location.href = nextUrl;
}
else{
window.location.reload();
}
}
})
.fail(function (xhr) {

@ -31,6 +31,24 @@ $(document).ready(function () {
});
is_extend = true;
}
if(! window.LIL_STORE.user.id) {
const $btn = popup.find('.buy__btn');
$btn.click(function(event) {
event.preventDefault();
hidePopup().then(() => {
popup = $('.js-popup-auth');
popup.data('next-url', $btn.attr('href'));
showPopup();
});
});
}
}
if( data === '.js-popup-auth') {
let nextUrl = $(this).data('auth-next-url');
if(nextUrl === 'href') {
nextUrl = $(this).attr('href');
}
popup.data('next-url', nextUrl);
}
if($(this).data('day')) {
@ -70,21 +88,28 @@ $(document).ready(function () {
function showPopup(){
body.addClass('no-scroll');
popup.addClass('open');
setTimeout(function(){
popup.addClass('visible');
}, 100);
return new Promise((resolve) => {
setTimeout(function(){
popup.addClass('visible');
resolve();
}, 100);
});
}
function hidePopup(){
body.removeClass('no-scroll');
popup.removeClass('visible');
setTimeout(function(){
popup.removeClass('open');
}, 300);
popup.data('next-url', null);
if($('#password-reset__sent').is(':visible')) {
window.location.reload();
}
return new Promise((resolve) => {
setTimeout(function(){
popup.removeClass('open');
resolve();
}, 300);
});
}
$(document).on('change', '[data-day]', function(){

Loading…
Cancel
Save