Avoid translation conflicts by setting the interal text value of message dialog butons.
This commit is contained in:
parent
de23443559
commit
f166feb32f
3 changed files with 73 additions and 52 deletions
|
@ -459,13 +459,13 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
|
|||
.add({ minutes: -minuteDelta })
|
||||
.toString('yyyy-MM-dd HH:mm:ss');
|
||||
|
||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_unavailable';
|
||||
var postData = {
|
||||
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_unavailable';
|
||||
var data = {
|
||||
csrfToken: GlobalVariables.csrfToken,
|
||||
unavailable: JSON.stringify(unavailable)
|
||||
};
|
||||
|
||||
$.post(postUrl, postData, function(response) {
|
||||
$.post(url, data, function(response) {
|
||||
$('#notification').hide('blind');
|
||||
revertFunc();
|
||||
}, 'json').fail(GeneralFunctions.ajaxFailureHandler);
|
||||
|
|
|
@ -318,8 +318,10 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
|
|||
$(this).parents().eq(2).popover('destroy'); // Hide the popover
|
||||
|
||||
if (lastFocusedEventData.is_unavailable == false) {
|
||||
var messageButtons = {};
|
||||
messageButtons['OK'] = function() {
|
||||
var buttons = [
|
||||
{
|
||||
text: 'OK',
|
||||
click: function() {
|
||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_appointment';
|
||||
var postData = {
|
||||
csrfToken: GlobalVariables.csrfToken,
|
||||
|
@ -348,26 +350,39 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
|
|||
// Refresh calendar event items.
|
||||
$('#select-filter-item').trigger('change');
|
||||
}, 'json').fail(GeneralFunctions.ajaxFailureHandler);
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
messageButtons[EALang.cancel] = function() {
|
||||
{
|
||||
text: EALang.cancel,
|
||||
click: function() {
|
||||
$('#message_box').dialog('close');
|
||||
};
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
GeneralFunctions.displayMessageBox(EALang.delete_appointment_title,
|
||||
EALang.write_appointment_removal_reason, messageButtons);
|
||||
EALang.write_appointment_removal_reason, buttons);
|
||||
|
||||
$('#message_box').append('<textarea id="delete-reason" rows="3"></textarea>');
|
||||
$('#delete-reason').css('width', '100%');
|
||||
var $formGroup = $('<div/>', {
|
||||
'class': 'form-group'
|
||||
})
|
||||
.appendTo('#message_box');
|
||||
|
||||
$('<textarea/>', {
|
||||
'id': 'delete-reason',
|
||||
'class': 'form-control'
|
||||
})
|
||||
.appendTo($formGroup);
|
||||
} else {
|
||||
// Do not display confirmation promt.
|
||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_unavailable';
|
||||
var postData = {
|
||||
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_delete_unavailable';
|
||||
var data = {
|
||||
csrfToken: GlobalVariables.csrfToken,
|
||||
unavailable_id : lastFocusedEventData.id
|
||||
};
|
||||
|
||||
$.post(postUrl, postData, function(response) {
|
||||
$.post(url, data, function(response) {
|
||||
$('#message_box').dialog('close');
|
||||
|
||||
if (response.exceptions) {
|
||||
|
|
|
@ -279,22 +279,28 @@ window.FrontendBook = window.FrontendBook || {};
|
|||
* @param {jQuery.Event} event
|
||||
*/
|
||||
$('#cancel-appointment').click(function(event) {
|
||||
var dialogButtons = {};
|
||||
dialogButtons['OK'] = function() {
|
||||
var buttons = [
|
||||
{
|
||||
text: 'OK',
|
||||
click: function() {
|
||||
if ($('#cancel-reason').val() === '') {
|
||||
$('#cancel-reason').css('border', '2px solid red');
|
||||
return;
|
||||
}
|
||||
$('#cancel-appointment-form textarea').val($('#cancel-reason').val());
|
||||
$('#cancel-appointment-form').submit();
|
||||
};
|
||||
|
||||
dialogButtons[EALang.cancel] = function() {
|
||||
}
|
||||
},
|
||||
{
|
||||
text: EALang.cancel,
|
||||
click: function() {
|
||||
$('#message_box').dialog('close');
|
||||
};
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
GeneralFunctions.displayMessageBox(EALang.cancel_appointment_title,
|
||||
EALang.write_appointment_removal_reason, dialogButtons);
|
||||
EALang.write_appointment_removal_reason, buttons);
|
||||
|
||||
$('#message_box').append('<textarea id="cancel-reason" rows="3"></textarea>');
|
||||
$('#cancel-reason').css('width', '100%');
|
||||
|
|
Loading…
Reference in a new issue