Added MultiLang support for within Page

This commit is contained in:
Djamil Legato
2016-02-05 12:38:22 -08:00
parent eff1efd3d6
commit 8b494f5842
2 changed files with 27 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ import './add';
import './move';
import './delete';
import './media';
import './multilang';
const switcher = $('input[type="radio"][name="mode-switch"]');

View File

@@ -0,0 +1,26 @@
import $ from 'jquery';
$('[name="task"][value="saveas"], [name="task"][value="switchlanguage"]').on('mousedown touchstart', (event) => {
let fields = ['lang', 'redirect'];
let element = $(event.currentTarget);
let form = $(`#${element.attr('form')}`);
if (!form.length) { return; }
fields.forEach((field) => {
let value = element.attr(field);
if (!value) { return; }
let input = form.find(`[name="${field}"]`);
if (!input.length) {
input = $(`<input type="hidden" name="${field}" value="" />`);
form.append(input);
}
input.val(value);
});
return true;
});