mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
Use tabs for indention
This commit is contained in:
parent
da6fdbb09b
commit
5d0266edad
56
javascript/CMSMain.Translatable.js
Executable file → Normal file
56
javascript/CMSMain.Translatable.js
Executable file → Normal file
@ -40,35 +40,35 @@
|
|||||||
var locale = {locale: $(e.target).val()};
|
var locale = {locale: $(e.target).val()};
|
||||||
var url = document.location.href;
|
var url = document.location.href;
|
||||||
|
|
||||||
// Check existing url
|
// Check existing url
|
||||||
search = /locale=[^&]*/;
|
search = /locale=[^&]*/;
|
||||||
if(url.match(search)) {
|
if(url.match(search)) {
|
||||||
// Replace locale code
|
// Replace locale code
|
||||||
url = url.replace(search, $.param(locale));
|
url = url.replace(search, $.param(locale));
|
||||||
} else {
|
} else {
|
||||||
// Add locale code
|
// Add locale code
|
||||||
url = $.path.addSearchParams(url, locale);
|
url = $.path.addSearchParams(url, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get id for translation and fix redirect url
|
// Get id for translation and fix redirect url
|
||||||
var selectedTreeItem = $('.cms-tree').jstree('get_selected');
|
var selectedTreeItem = $('.cms-tree').jstree('get_selected');
|
||||||
if(selectedTreeItem.length > 0) {
|
if(selectedTreeItem.length > 0) {
|
||||||
selectedTreeItem = selectedTreeItem.eq(0);
|
selectedTreeItem = selectedTreeItem.eq(0);
|
||||||
$.get(
|
$.get(
|
||||||
$.path.addSearchParams(this.data('translationUrl'), {
|
$.path.addSearchParams(this.data('translationUrl'), {
|
||||||
'requestedLocale': $(e.target).val(),
|
'requestedLocale': $(e.target).val(),
|
||||||
'id': selectedTreeItem.data('id'),
|
'id': selectedTreeItem.data('id'),
|
||||||
'class': selectedTreeItem.data('pagetype')
|
'class': selectedTreeItem.data('pagetype')
|
||||||
}),
|
}),
|
||||||
function(data) {
|
function(data) {
|
||||||
if(data != '') {
|
if(data != '') {
|
||||||
url = data;
|
url = data;
|
||||||
}
|
}
|
||||||
$('.cms-container').loadPanel(url);
|
$('.cms-container').loadPanel(url);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.cms-container').loadPanel(url);
|
$('.cms-container').loadPanel(url);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user