mirror of
https://github.com/e107inc/e107.git
synced 2025-08-28 16:50:07 +02:00
Issue #3912 Typing ':' now pops-up a menu of available routes. Bootstrap-suggest library added for this and other areas in future.
This commit is contained in:
@@ -31,6 +31,79 @@ if(!empty($_GET['iframe']))
|
||||
}
|
||||
|
||||
|
||||
//e107::js('core','bootstrap-suggest/dist/bootstrap-suggest.min.js');
|
||||
//e107::css('core','bootstrap-suggest/dist/bootstrap-suggest.css');
|
||||
//e107::js('core','bootstrap-suggest/bootstrap-suggest.js');
|
||||
//e107::css('core','bootstrap-suggest/bootstrap-suggest.css');
|
||||
e107::library('load', 'bootstrap-suggest');
|
||||
/*
|
||||
e107::js('footer-inline', "
|
||||
$('textarea').suggest(':', {
|
||||
data: function(q, lookup) {
|
||||
|
||||
$.getJSON('theme.php', {q : q }, function(data) {
|
||||
console.log(data);
|
||||
console.log(lookup);
|
||||
lookup.call(data);
|
||||
});
|
||||
|
||||
// we aren't returning any
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
");*/
|
||||
|
||||
|
||||
e107::js('footer-inline', "
|
||||
|
||||
$('textarea.input-custompages').suggest(':', {
|
||||
|
||||
data: function() {
|
||||
|
||||
var i = $.ajax({
|
||||
type: 'GET',
|
||||
url: 'theme.php',
|
||||
async: false,
|
||||
data: {
|
||||
mode: 'suggest'
|
||||
}
|
||||
}).done(function(data) {
|
||||
// console.log(data);
|
||||
return data;
|
||||
}).responseText;
|
||||
|
||||
try
|
||||
{
|
||||
var d = $.parseJSON(i);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
// Not JSON.
|
||||
return;
|
||||
}
|
||||
|
||||
return d;
|
||||
},
|
||||
filter: {
|
||||
casesensitive: false,
|
||||
limit: 300
|
||||
},
|
||||
endKey: \"\\n\",
|
||||
map: function(item) {
|
||||
return {
|
||||
value: item.value,
|
||||
text: item.value
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
");
|
||||
|
||||
|
||||
|
||||
class theme_admin extends e_admin_dispatcher
|
||||
{
|
||||
/**
|
||||
@@ -78,6 +151,18 @@ class theme_admin extends e_admin_dispatcher
|
||||
function init()
|
||||
{
|
||||
|
||||
|
||||
if(e_AJAX_REQUEST)
|
||||
{
|
||||
|
||||
$newRoutes = $this->getAllRoutes();
|
||||
|
||||
echo json_encode($newRoutes);
|
||||
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +254,57 @@ class theme_admin extends e_admin_dispatcher
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getAllRoutes(): array
|
||||
{
|
||||
|
||||
$legacy = array(
|
||||
'gallery/index/category',
|
||||
'gallery/index/list',
|
||||
'news/list/items',
|
||||
'news/list/category',
|
||||
'news/list/all',
|
||||
'news/list/short',
|
||||
'news/list/day',
|
||||
'news/list/month',
|
||||
'news/list/tag',
|
||||
'news/list/author',
|
||||
'news/view/item',
|
||||
'page/chapter/index',
|
||||
'page/book/index',
|
||||
'page/view/index',
|
||||
'page/view/other',
|
||||
'page/list/index',
|
||||
'search/index/index',
|
||||
'system/error/notfound',
|
||||
'user/myprofile/view',
|
||||
'user/myprofile/edit',
|
||||
'user/profile/list',
|
||||
'user/profile/view',
|
||||
'user/login/index',
|
||||
'user/register/index'
|
||||
);
|
||||
|
||||
|
||||
$newRoutes = e107::getUrlConfig('route');
|
||||
|
||||
foreach($legacy as $v)
|
||||
{
|
||||
$newRoutes[$v] = $v;
|
||||
}
|
||||
|
||||
ksort($newRoutes);
|
||||
|
||||
$ret = [];
|
||||
foreach($newRoutes as $k => $v)
|
||||
{
|
||||
$ret[] = array('value' => $k, 'label' => $k);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user