Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
1bf660a4
Commit
1bf660a4
authored
Jan 22, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) add menu search box in legacy template, we may need to consolidate some JS code later
parent
c759e92f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
fbegin.inc
src/www/fbegin.inc
+10
-1
head.inc
src/www/head.inc
+25
-0
No files found.
src/www/fbegin.inc
View file @
1bf660a4
...
...
@@ -111,9 +111,18 @@ if($need_alert_display == true) {
</div>
<div
class=
"collapse navbar-collapse"
>
<ul
class=
"nav navbar-nav navbar-right"
>
<li>
<form
class=
"navbar-form"
role=
"search"
>
<div
class=
"input-group"
>
<input
type=
"text"
style=
"width: 250px;"
class=
"form-control"
placeholder=
"Search"
data-provide=
"typeahead"
id=
"menu_search_box"
>
<div
class=
"input-group-btn"
>
<button
class=
"btn btn-default"
type=
"button"
><i
class=
"glyphicon glyphicon-search"
></i></button>
</div>
</div>
</form>
</li>
<li
id=
"menu_messages"
>
<?=
get_menu_messages
()
?>
</li>
</ul>
</div>
</div>
</nav>
...
...
src/www/head.inc
View file @
1bf660a4
...
...
@@ -108,6 +108,9 @@ $pagetitle .= sprintf(' | %s.%s', $config['system']['hostname'], $config['system
<!-- append some helper functions to integrate into the legacy code -->
<script
type=
"text/javascript"
src=
"/javascript/opnsense_legacy.js"
></script>
<!-- Bootstrap type ahead -->
<script
type=
"text/javascript"
src=
"/ui/js/bootstrap3-typeahead.min.js"
></script>
<?php
/*
* Find all javascript files that need to be included
...
...
@@ -182,6 +185,28 @@ $pagetitle .= sprintf(' | %s.%s', $config['system']['hostname'], $config['system
});
}
});
// hook in live menu search
$
.
ajax
(
"
/api/core/menu/search/
"
,
{
type
:
'
get
'
,
cache
:
false
,
dataType
:
"
json
"
,
data
:
{},
success
:
function
(
data
)
{
var
menusearch_items
=
[];
$
.
each
(
data
,
function
(
idx
,
menu_item
){
if
(
menu_item
.
Url
!=
""
)
{
menusearch_items
.
push
({
id
:
menu_item
.
Url
,
name
:
menu_item
.
breadcrumb
});
}
});
$
(
"
#menu_search_box
"
).
typeahead
({
source
:
menusearch_items
,
afterSelect
:
function
(
item
){
window
.
location
.
href
=
item
.
id
;
}
});
}
});
});
//]]>
</script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment