[FIX] website: fix edit master when using old template
When no update has been done on website, we don't have this default-lang data/attribute. So we use an hack to find the default lang which one is the shortest because no lang is present in the url.
This commit is contained in:
@@ -31,6 +31,14 @@ website.TopBar.include({
|
||||
edit_master: function (ev) {
|
||||
ev.preventDefault();
|
||||
var $link = $('.js_language_selector a[data-default-lang]');
|
||||
if (!$link.length) {
|
||||
// Fallback for old website
|
||||
var l = false;
|
||||
_.each($('.js_language_selector a'), function(a) {
|
||||
if (!l || a.href.length < l.href.length) { l = a; }
|
||||
});
|
||||
$link = $(l);
|
||||
}
|
||||
$link[0].search += ($link[0].search ? '&' : '?') + 'enable_editor=1';
|
||||
$link.click();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user