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
6f2bd698
Commit
6f2bd698
authored
Oct 17, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(theme) add support for custom theme.js hook
parent
d82608e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
services.php
src/opnsense/mvc/app/config/services.php
+6
-0
default.volt
src/opnsense/mvc/app/views/layouts/default.volt
+8
-6
head.inc
src/www/head.inc
+5
-0
No files found.
src/opnsense/mvc/app/config/services.php
View file @
6f2bd698
...
...
@@ -41,6 +41,12 @@ $di->set('view', function () use ($config) {
'compiledPath'
=>
$config
->
application
->
cacheDir
,
'compiledSeparator'
=>
'_'
));
// register additional volt template functions
$volt
->
getCompiler
()
->
addFunction
(
'javascript_include_when_exists'
,
function
(
$local_url
)
{
$chk_path
=
"str_replace('/ui/','/usr/local/opnsense/www/',"
.
$local_url
.
")"
;
$js_tag
=
"'<script type=
\"
text/javascript
\"
src=
\"
'.
$local_url
.'
\"
></script>'"
;
return
"file_exists("
.
$chk_path
.
") ? "
.
$js_tag
.
" :''"
;
});
return
$volt
;
},
...
...
src/opnsense/mvc/app/views/layouts/default.volt
View file @
6f2bd698
...
...
@@ -14,9 +14,10 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
/>
<title>
{{title|default("OPNsense") }}
</title>
{% set theme_name = ui_theme|default('opnsense') %}
<!-- include (theme) style -->
<link
href=
"/ui/themes/{{
ui_theme|default('opnsense')
}}/build/css/main.css"
rel=
"stylesheet"
>
<link
href=
"/ui/themes/{{
theme_name
}}/build/css/main.css"
rel=
"stylesheet"
>
<!-- TODO: move to theme style -->
<style>
...
...
@@ -30,13 +31,13 @@
</style>
<!-- Favicon -->
<link
href=
"/ui/themes/{{
ui_theme|default('opnsense')
}}/build/images/favicon.png"
rel=
"shortcut icon"
>
<link
href=
"/ui/themes/{{
theme_name
}}/build/images/favicon.png"
rel=
"shortcut icon"
>
<!-- Stylesheet for fancy select/dropdown -->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/ui/themes/{{
ui_theme|default('opnsense')
}}/build/css/bootstrap-select.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/ui/themes/{{
theme_name
}}/build/css/bootstrap-select.css"
>
<!-- bootstrap dialog -->
<link
href=
"/ui/themes/{{
ui_theme|default('opnsense')
}}/build/css/bootstrap-dialog.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"/ui/themes/{{
theme_name
}}/build/css/bootstrap-dialog.css"
rel=
"stylesheet"
type=
"text/css"
/>
<!-- Font awesome -->
<link
rel=
"stylesheet"
href=
"/ui/css/font-awesome.min.css"
>
...
...
@@ -179,6 +180,7 @@
<script
type=
"text/javascript"
src=
"/ui/js/opnsense.js"
></script>
<script
type=
"text/javascript"
src=
"/ui/js/opnsense_ui.js"
></script>
<script
type=
"text/javascript"
src=
"/ui/js/opnsense_bootgrid_plugin.js"
></script>
{{javascript_include_when_exists('/ui/themes/' ~ theme_name ~ '/build/js/theme.js')}}
</head>
<body>
...
...
@@ -187,8 +189,8 @@
<div
class=
"container-fluid"
>
<div
class=
"navbar-header"
>
<a
class=
"navbar-brand"
href=
"/"
>
<img
class=
"brand-logo"
src=
"/ui/themes/{{
ui_theme|default('opnsense')
}}/build/images/default-logo.png"
height=
"30"
alt=
"logo"
/>
<img
class=
"brand-icon"
src=
"/ui/themes/{{
ui_theme|default('opnsense')
}}/build/images/icon-logo.png"
height=
"30"
alt=
"icon"
/>
<img
class=
"brand-logo"
src=
"/ui/themes/{{
theme_name
}}/build/images/default-logo.png"
height=
"30"
alt=
"logo"
/>
<img
class=
"brand-icon"
src=
"/ui/themes/{{
theme_name
}}/build/images/icon-logo.png"
height=
"30"
alt=
"icon"
/>
</a>
<button
type=
"button"
class=
"navbar-toggle collapsed"
data-toggle=
"collapse"
data-target=
"#navigation"
>
<span
class=
"sr-only"
>
Toggle navigation
</span>
...
...
src/www/head.inc
View file @
6f2bd698
...
...
@@ -237,4 +237,9 @@ $pagetitle .= sprintf(' | %s.%s', $config['system']['hostname'], $config['system
});
//]]>
</script>
<?php
if
(
file_exists
(
"/usr/local/opnsense/www/themes/"
.
$themename
.
"/build/js/theme.js"
))
:?>
<
script
type
=
"text/javascript"
src
=
"/ui/themes/<?=
$themename
?>/build/js/theme.js"
></
script
>
<?
php
endif
;
?>
</head>
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