Merge branch 'hotfix/LIL-629' into 'master'

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

See merge request lilcity/backend!120
remotes/origin/hotfix/LIL-661
cfwme 8 years ago
commit d10b301e43
  1. 4
      apps/school/templates/blocks/day_pay_btn.html
  2. 12
      apps/school/templates/blocks/schedule_item.html
  3. 6
      apps/school/templates/summer/promo.html
  4. 16
      project/templates/blocks/about.html
  5. 12
      project/templates/blocks/popup_auth.html
  6. 2
      project/templates/blocks/popup_buy.html
  7. 15
      project/templates/blocks/promo.html
  8. 28
      web/src/js/modules/auth.js
  9. 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>

@ -5,16 +5,12 @@
<span class="main__bold">Lil School</span> — первая образовательная онлайн-платформа креативного мышления для детей
</div>
<div class="main__subtitle">
Присоединяйтесь к школе с 1 сентября
Старт школы - 1 сентября
</div>
<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="#"

@ -43,20 +43,6 @@
<div class="school__text">Хранится 7 дней</div>
</div>
</div>
<div class="letsgo">
{% if not is_purchased and not is_purchased_future %}
<a
{% if not user.is_authenticated %}
data-popup=".js-popup-auth"
{% else %}
data-popup=".js-popup-buy"
{% endif %}
class="main__btn btn"
href="#"
>
купить доступ от {{ min_school_price }} руб./месяц
</a>
{% endif %}
</div>
<div class="letsgo"></div>
</div>
</div>

@ -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>

@ -46,27 +46,20 @@
</div>
{% else %}
<div class="main__subtitle">
Приглашаем вас на месяц открытых дверей в Lil School
Приглашаем вас присоединиться к онлайн-школе с 1 сентября!
</div>
<div class="main__actions">
{% comment %}
{% if not is_purchased and not is_purchased_future %}
<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="#"
>
Получить доступ
купить доступ от {{ min_school_price }} руб./месяц
</a>
{% else %}
<a class="main__btn btn btn_white" href="{% url 'school:school' %}">Подробнее</a>
{% endif %}
{% endcomment %}
<a class="main__btn btn btn_white" href="{% url 'course' pk=50 %}">Подробнее</a>
</div>
{% endif %}
</div>

@ -5,6 +5,7 @@ import isLength from 'validator/lib/isLength';
$(document).ready(function () {
let auth = $('.js-auth'),
popup = $('.js-popup-auth'),
type = auth.find('.js-auth-type'),
tab = auth.find('.js-auth-tab'),
login = auth.find('.js-auth-login'),
@ -153,7 +154,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 +241,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 +288,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 +318,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