[FIX] website_event: avoid double subscription
Before this commit, you was able to double click on the button when
are in registration flow. In this case, you subscribe 2 times and so
take 2x more seats, what can be annoying when you have a limited room.
In the same time, we fix the form in the form that generate
strange behaviour like some events not bubbled correctly.
The attendee form (into the modal) was inside the registration form.
$'attendee_form).on('submit') obviously failed due to this bad dom.
This commit closes opw-778191
This commit is contained in:
@@ -228,7 +228,7 @@ base.ready().then(function () {
|
|||||||
init_kanban(this);
|
init_kanban(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.js_website_submit_form').on('submit', function() {
|
$('body').on('submit', '.js_website_submit_form', function() {
|
||||||
var $buttons = $(this).find('button[type="submit"], a.a-submit');
|
var $buttons = $(this).find('button[type="submit"], a.a-submit');
|
||||||
_.each($buttons, function(btn) {
|
_.each($buttons, function(btn) {
|
||||||
$(btn).attr('data-loading-text', '<i class="fa fa-spinner fa-spin"></i> ' + $(btn).text()).button('loading');
|
$(btn).attr('data-loading-text', '<i class="fa fa-spinner fa-spin"></i> ' + $(btn).text()).button('loading');
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ $(document).ready(function () {
|
|||||||
.off('click')
|
.off('click')
|
||||||
.removeClass('a-submit')
|
.removeClass('a-submit')
|
||||||
.click(function (ev) {
|
.click(function (ev) {
|
||||||
|
$(this).attr('disabled', true);
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
var $form = $(ev.currentTarget).closest('form');
|
var $form = $(ev.currentTarget).closest('form');
|
||||||
@@ -18,7 +19,8 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
ajax.jsonRpc($form.attr('action'), 'call', post).then(function (modal) {
|
ajax.jsonRpc($form.attr('action'), 'call', post).then(function (modal) {
|
||||||
var $modal = $(modal);
|
var $modal = $(modal);
|
||||||
$modal.appendTo($form).modal();
|
$modal.find('.modal-body > div').removeClass('container'); // retrocompatibility - REMOVE ME in master / saas-19
|
||||||
|
$modal.after($form).modal();
|
||||||
$modal.on('click', '.js_goto_event', function () {
|
$modal.on('click', '.js_goto_event', function () {
|
||||||
$modal.modal('hide');
|
$modal.modal('hide');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -441,7 +441,7 @@
|
|||||||
<template id="registration_attendee_details" name="Registration Attendee Details">
|
<template id="registration_attendee_details" name="Registration Attendee Details">
|
||||||
<div id="modal_attendees_registration" class="modal fade" tabindex="-1" role="dialog">
|
<div id="modal_attendees_registration" class="modal fade" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog modal-lg">
|
<div class="modal-dialog modal-lg">
|
||||||
<form id="attendee_registration" t-attf-action="/event/#{slug(event)}/registration/confirm" method="post">
|
<form id="attendee_registration" t-attf-action="/event/#{slug(event)}/registration/confirm" method="post" class="js_website_submit_form">
|
||||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@@ -449,7 +449,7 @@
|
|||||||
<h4 class="modal-title" id="myModalLabel"><strong>Attendees</strong></h4>
|
<h4 class="modal-title" id="myModalLabel"><strong>Attendees</strong></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="container">
|
<div class="">
|
||||||
<t t-set="counter_type" t-value="1"/>
|
<t t-set="counter_type" t-value="1"/>
|
||||||
<t t-set="counter" t-value="0"/>
|
<t t-set="counter" t-value="0"/>
|
||||||
<t t-foreach="tickets" t-as="ticket">
|
<t t-foreach="tickets" t-as="ticket">
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<!-- Generic questions -->
|
<!-- Generic questions -->
|
||||||
<xpath expr="//div[@class='container']/t[last()]" position="after">
|
<xpath expr="//div[hasclass('modal-body')]/div/t[last()]" position="after">
|
||||||
<t t-if="event.general_question_ids">
|
<t t-if="event.general_question_ids">
|
||||||
<h4 class="page-header mt32"><strong>Last questions</strong></h4>
|
<h4 class="page-header mt32"><strong>Last questions</strong></h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
Reference in New Issue
Block a user