Fix the Backup module where it was not working if user changes its preference language other than english. Fixes #2354

This commit is contained in:
Murtuza Zabuawala 2017-05-04 16:06:10 +01:00 committed by Dave Page
parent 95f763463f
commit 155348d712
4 changed files with 30 additions and 20 deletions

View File

@ -123,10 +123,10 @@ TODO LIST FOR BACKUP:
width: "100%" width: "100%"
}, },
options: [ options: [
{label: "Custom", value: "custom"}, {label: '{{ _('Custom') }}', value: "custom"},
{label: "Tar", value: "tar"}, {label: '{{ _('Tar') }}', value: "tar"},
{label: "Plain", value: "plain"}, {label: '{{ _('Plain') }}', value: "plain"},
{label: "Directory", value: "directory"} {label: '{{ _('Directory') }}', value: "directory"}
] ]
},{ },{
id: 'ratio', label: '{{ _('Compression ratio') }}', id: 'ratio', label: '{{ _('Compression ratio') }}',
@ -447,9 +447,11 @@ TODO LIST FOR BACKUP:
url: '{{ url_for('help.static', filename='backup_dialog.html') }}' url: '{{ url_for('help.static', filename='backup_dialog.html') }}'
} }
},{ },{
text: '{{ _('Backup') }}', key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button' text: '{{ _('Backup') }}', key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button',
'data-btn-name': 'backup'
},{ },{
text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button' text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button',
'data-btn-name': 'cancel'
}], }],
// Set options for dialog // Set options for dialog
options: { options: {
@ -537,7 +539,7 @@ TODO LIST FOR BACKUP:
return; return;
} }
if (e.button.text === '{{ _('Backup') }}') { if (e.button['data-btn-name'] === "backup") {
if (!d) if (!d)
return; return;
@ -660,9 +662,11 @@ TODO LIST FOR BACKUP:
attrs:{name:'dialog_help', type:'button', label: '{{ _('Backup') }}', attrs:{name:'dialog_help', type:'button', label: '{{ _('Backup') }}',
url: '{{ url_for('help.static', filename='backup_dialog.html') }}'} url: '{{ url_for('help.static', filename='backup_dialog.html') }}'}
},{ },{
text: '{{ _('Backup') }}', key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button' text: '{{ _('Backup') }}', key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button',
'data-btn-name': 'backup'
},{ },{
text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button' text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button',
'data-btn-name': 'cancel'
}], }],
// Set options for dialog // Set options for dialog
options: { options: {
@ -748,7 +752,7 @@ TODO LIST FOR BACKUP:
return; return;
} }
if (e.button.text === "Backup") { if (e.button['data-btn-name'] === "backup") {
if (!d) if (!d)
return; return;

View File

@ -374,10 +374,12 @@ define(
return { return {
buttons:[{ buttons:[{
text: "{{ _('OK') }}", key: 27, disable: true, text: "{{ _('OK') }}", key: 27, disable: true,
'data-btn-name': 'ok',
className: className:
"btn btn-primary fa fa-lg fa-save pg-alertify-button" "btn btn-primary fa fa-lg fa-save pg-alertify-button"
}, { }, {
text: "{{ _('Cancel') }}", key: 27, text: "{{ _('Cancel') }}", key: 27,
'data-btn-name': 'cancel',
className: className:
"btn btn-danger fa fa-lg fa-times pg-alertify-button" "btn btn-danger fa fa-lg fa-times pg-alertify-button"
}], }],
@ -393,7 +395,7 @@ define(
// Callback functions when click on the buttons of the Alertify dialogs // Callback functions when click on the buttons of the Alertify dialogs
callback: function(e) { callback: function(e) {
if (e.button.text === "{{ _('OK') }}") { if (e.button['data-btn-name'] === "ok") {
var n = this.settings['pg_node'], var n = this.settings['pg_node'],
i = this.settings['pg_item'], i = this.settings['pg_item'],

View File

@ -269,9 +269,11 @@ define(
attrs:{name:'dialog_help', type:'button', label: '{{ _('Maintenance') }}', attrs:{name:'dialog_help', type:'button', label: '{{ _('Maintenance') }}',
url: '{{ url_for('help.static', filename='maintenance_dialog.html') }}'} url: '{{ url_for('help.static', filename='maintenance_dialog.html') }}'}
},{ },{
text: "{{ _('OK') }}", key: 27, className: "btn btn-primary fa fa-lg fa-save pg-alertify-button" text: "{{ _('OK') }}", key: 27, className: "btn btn-primary fa fa-lg fa-save pg-alertify-button",
'data-btn-name': 'ok',
},{ },{
text: "{{ _('Cancel') }}", key: 27, className: "btn btn-danger fa fa-lg fa-times pg-alertify-button" text: "{{ _('Cancel') }}", key: 27, className: "btn btn-danger fa fa-lg fa-times pg-alertify-button",
'data-btn-name': 'cancel',
}], }],
options: { modal: 0, pinnable: false} options: { modal: 0, pinnable: false}
}; };
@ -289,7 +291,7 @@ define(
return; return;
} }
if (e.button.text === "{{ _('OK') }}") { if (e.button['data-btn-name'] === "ok") {
var schema = undefined, var schema = undefined,
table = undefined, table = undefined,

View File

@ -36,7 +36,7 @@ define([
custom: false, custom: false,
file: undefined, file: undefined,
role: undefined, role: undefined,
format: 'Custom or tar', format: 'custom',
verbose: true, verbose: true,
blobs: true, blobs: true,
encoding: undefined, encoding: undefined,
@ -81,8 +81,8 @@ define([
width: "100%" width: "100%"
}, },
options: [ options: [
{label: "Custom or tar", value: "custom"}, {label: '{{ _('Custom or tar') }}', value: "custom"},
{label: "Directory", value: "directory"} {label: '{{ _('Directory') }}', value: "directory"}
] ]
},{ },{
id: 'file', label: '{{ _('Filename') }}', id: 'file', label: '{{ _('Filename') }}',
@ -374,10 +374,12 @@ define([
url: '{{ url_for('help.static', filename='restore_dialog.html') }}'} url: '{{ url_for('help.static', filename='restore_dialog.html') }}'}
},{ },{
text: '{{ _('Restore') }}', key: 27, text: '{{ _('Restore') }}', key: 27,
className: 'btn btn-primary fa fa-upload pg-alertify-button', restore: true className: 'btn btn-primary fa fa-upload pg-alertify-button', restore: true,
'data-btn-name': 'restore'
},{ },{
text: '{{ _('Cancel') }}', key: 27, text: '{{ _('Cancel') }}', key: 27,
className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button', restore: false className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button', restore: false,
'data-btn-name': 'cancel'
}], }],
// Set options for dialog // Set options for dialog
options: { options: {
@ -473,7 +475,7 @@ define([
return; return;
} }
if (e.button.restore) { if (e.button['data-btn-name'] === "restore") {
if (!d) if (!d)
return; return;