bug fix when select the homepage
This commit is contained in:
parent
d89e742fdf
commit
ec88e52aad
|
@ -33,6 +33,12 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
|
||||||
'name'=>'tokenCSRF',
|
'name'=>'tokenCSRF',
|
||||||
'value'=>$security->getTokenCSRF()
|
'value'=>$security->getTokenCSRF()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Homepage
|
||||||
|
echo Bootstrap::formInputHidden(array(
|
||||||
|
'name'=>'homepage',
|
||||||
|
'value'=>$site->homepage()
|
||||||
|
));
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- TABS GENERAL -->
|
<!-- TABS GENERAL -->
|
||||||
|
@ -108,12 +114,21 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
|
||||||
|
|
||||||
echo Bootstrap::formTitle(array('title'=>$L->g('Predefined pages')));
|
echo Bootstrap::formTitle(array('title'=>$L->g('Predefined pages')));
|
||||||
|
|
||||||
|
// Homepage
|
||||||
|
try {
|
||||||
|
$homeKey = $site->homepage();
|
||||||
|
$home = new Page($homeKey);
|
||||||
|
$homeValue = $home->title();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$homeValue = '';
|
||||||
|
}
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'homepage',
|
'name'=>'homepageTMP',
|
||||||
'label'=>$L->g('Homepage'),
|
'label'=>$L->g('Homepage'),
|
||||||
'value'=>(Text::isEmpty($site->homepage())?'':$site->homepage()),
|
'value'=>$homeValue,
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'placeholder'=>'Start writing the title of the page',
|
'placeholder'=>$L->g('Start typing a page title to see a list of suggestions.'),
|
||||||
'tip'=>$L->g('Returning page for the main page')
|
'tip'=>$L->g('Returning page for the main page')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -419,7 +434,7 @@ $(document).ready(function() {
|
||||||
// Parent autocomplete
|
// Parent autocomplete
|
||||||
var homepageXHR;
|
var homepageXHR;
|
||||||
var homepageList; // Keep the parent list returned to get the key by the title page
|
var homepageList; // Keep the parent list returned to get the key by the title page
|
||||||
$("#jshomepage").autoComplete({
|
$("#jshomepageTMP").autoComplete({
|
||||||
minChars: 1,
|
minChars: 1,
|
||||||
source: function(term, response) {
|
source: function(term, response) {
|
||||||
// Prevent call inmediatly another ajax request
|
// Prevent call inmediatly another ajax request
|
||||||
|
@ -438,18 +453,19 @@ $(document).ready(function() {
|
||||||
},
|
},
|
||||||
onSelect: function(e, term, item) {
|
onSelect: function(e, term, item) {
|
||||||
// homepageList = array( pageTitle => pageKey )
|
// homepageList = array( pageTitle => pageKey )
|
||||||
var pageKey = homepageList[term];
|
var key = homepageList[term];
|
||||||
$("#jsparent").attr("value", pageKey);
|
$("#jshomepage").attr("value", key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#jshomepage").change(function() {
|
$("#jshomepageTMP").change(function() {
|
||||||
if ($(this).val()) {
|
if ($(this).val()) {
|
||||||
$("#jsuriBlog").removeAttr('disabled');
|
$("#jsuriBlog").removeAttr('disabled');
|
||||||
$("#jsuriBlog").attr('value', '/blog/');
|
$("#jsuriBlog").attr('value', '/blog/');
|
||||||
} else {
|
} else {
|
||||||
$("#jsuriBlog").attr('value', '');
|
$("#jsuriBlog").attr('value', '');
|
||||||
$("#jsuriBlog").attr('disabled', 'disabled');
|
$("#jsuriBlog").attr('disabled', 'disabled');
|
||||||
|
$("#jshomepage").attr("value", '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue