mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add docs for using a base template (#8939)
* Add docs for using a base template * Updated readme
This commit is contained in:
committed by
Tony Murray
parent
3b6fbd99ee
commit
da58c91dd9
@@ -65,6 +65,46 @@ Placeholders can be used within the subjects for templates as well although $fau
|
||||
|
||||
The Default Template is a 'one-size-fit-all'. We highly recommend defining your own templates for your rules to include more specific information.
|
||||
|
||||
## Base Templates
|
||||
If you'd like to reuse a common template for your alerts follow below
|
||||
|
||||
create a file in
|
||||
` resources/views/alerts/template.blade.php`
|
||||
As an example, add the following:
|
||||
|
||||
```
|
||||
<html>
|
||||
<head>
|
||||
<title>LibreNMS Alert</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
From the template master
|
||||
</div>
|
||||
<div class="container">
|
||||
@yield('content')
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
The important part being the `@yield('content')`
|
||||
|
||||
You can use plain text or html as per Alert templates and this will form the basis of your common template.
|
||||
|
||||
In your alert template just use
|
||||
|
||||
```
|
||||
@extends('alerts.template');
|
||||
|
||||
@section('content')
|
||||
{{ $alert->title }}
|
||||
Severity: {{ $alert->severity }}
|
||||
...
|
||||
@endsection
|
||||
```
|
||||
|
||||
More info: https://laravel.com/docs/5.4/blade#extending-a-layout
|
||||
|
||||
## Examples
|
||||
|
||||
Default Template:
|
||||
|
||||
2
resources/views/alerts/.gitignore
vendored
Normal file
2
resources/views/alerts/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
Reference in New Issue
Block a user