PHRAS-2761 #comment Port of PHRAS-2801 (Fix on firefox)

This commit is contained in:
Harrys Ravalomanana
2019-10-29 18:11:46 +04:00
parent df86aac2ba
commit 02e670880d

View File

@@ -176,25 +176,32 @@
emptying = true; emptying = true;
f(); f();
}); });
var data;
//add lazaret file click action //add lazaret file click action
$("button.add-lazaret", scope).bind('click', function () { $("button.add-lazaret", scope).bind('click', function () {
var that = $(this); var that = $(this);
var lazaretId = getLazaretId(that); var lazaretId = getLazaretId(that);
var destinationCollectionId = getDestinationId(that); var destinationCollectionId = getDestinationId(that);
var container = $(this).closest('.wrapper-item');
var form = $(this).closest("form"); var form = $(this).closest("form");
/*fix POST on firefox*/
data = form.serializeArray();
var allData = that.parent().closest('.wrapper-item').find(".change-record-wrapper").html();
that.closest(".form-backup ").append(allData);
that.parent().closest('.wrapper-item').find(".change-record ").remove();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/prod/lazaret/' + lazaretId + '/force-add/', url: '/prod/lazaret/' + lazaretId + '/force-add/',
dataType: 'json', dataType: 'json',
data: form.serializeArray(), data: data,
beforeSend: function () { beforeSend: function () {
startAjax(that); startAjax(that);
}, },
success: function (data) { success: function (data) {
if (data.success) { if (data.success) {
that.closest(".wrapper-item").remove(); container.remove();
} else { } else {
var html = _.template($("#alert_error_tpl").html(), { var html = _.template($("#alert_error_tpl").html(), {
content: data.message content: data.message
@@ -219,6 +226,12 @@
$("button.delete-lazaret", scope).bind('click', function () { $("button.delete-lazaret", scope).bind('click', function () {
var that = $(this); var that = $(this);
var lazaretId = getLazaretId(that); var lazaretId = getLazaretId(that);
var container = $(this).closest('.wrapper-item');
var form = $(this).closest("form");
data = form.serializeArray();
var allData = that.parent().closest('.wrapper-item').find(".change-record-wrapper").html();
that.closest(".form-backup ").append(allData);
that.parent().closest('.wrapper-item').find(".change-record ").remove();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
@@ -229,7 +242,7 @@
}, },
success: function (data) { success: function (data) {
if (data.success) { if (data.success) {
that.closest(".wrapper-item").remove(); container.remove();
} else { } else {
var html = _.template($("#alert_error_tpl").html(), { var html = _.template($("#alert_error_tpl").html(), {
content: data.message content: data.message
@@ -362,17 +375,24 @@
var form = $(this).closest("form"); var form = $(this).closest("form");
$(".record_id").val(recordId); $(".record_id").val(recordId);
var form = $(this).closest("form");
data = form.serializeArray();
var allData = that.parent().closest('.wrapper-item').find(".change-record-wrapper").html();
that.closest(".form-backup ").append(allData);
that.parent().closest('.wrapper-item').find(".change-record ").remove();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/prod/lazaret/' + lazaretId + '/accept/', url: '/prod/lazaret/' + lazaretId + '/accept/',
dataType: 'json', dataType: 'json',
data: form.serializeArray(), data: data,
beforeSend: function () { beforeSend: function () {
startAjax(that); startAjax(that);
}, },
success: function (data) { success: function (data) {
if (data.success) { if (data.success) {
that.closest(".wrapper-item").remove(); container.remove();
} else { } else {
var html = _.template($("#alert_error_tpl").html(), { var html = _.template($("#alert_error_tpl").html(), {
content: data.message content: data.message
@@ -425,7 +445,8 @@
<p>{{ border_checker_from_fqcn(check.getCheckClassname()).getMessage(app['translator']) }}</p> <p>{{ border_checker_from_fqcn(check.getCheckClassname()).getMessage(app['translator']) }}</p>
{% endfor %} {% endfor %}
</div> </div>
<form name="change-records-status" action="/" method="POST"> <form class="change-record" name="change-records-status" action="/" method="POST">
<div class="change-record-wrapper">
{% set collection = file.getCollection(app) %} {% set collection = file.getCollection(app) %}
<input type="hidden" name="bas_id" value="{{ collection.get_base_id() }}"> <input type="hidden" name="bas_id" value="{{ collection.get_base_id() }}">
<input type="hidden" name="keep_attributes" value="1"> <input type="hidden" name="keep_attributes" value="1">
@@ -497,10 +518,12 @@
</button> </button>
{% endif %} {% endif %}
</div> </div>
</div>
</form> </form>
<div class="hidden form-backup"></div>
{# bloc to backup initial value of status list#} {# bloc to backup initial value of status list#}
<table class="hidden"> <table class="hidden">
<tbody class="status-backup" <tbody class="status-backup">
{% if file.getStatus(app) is not null %} {% if file.getStatus(app) is not null %}
{% for bit, status in file.getStatus(app) %} {% for bit, status in file.getStatus(app) %}
<tr> <tr>