1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Update static dependencies

This commit is contained in:
Jeremy Stretch
2020-07-16 15:22:31 -04:00
parent a4829198ff
commit 16f44305e4
702 changed files with 662 additions and 165 deletions

View File

@ -0,0 +1,50 @@
# v1.5.1
## xx/xx/2016
1. [](#improved)
* Removed Grav trait in favor of `Grav::instance()`
# v1.5.0
## 07/14/2016
1. [](#improved)
* non-routable pages are not linked
# v1.4.0
## 08/25/2015
1. [](#improved)
* Added blueprints for Grav Admin plugin
# v1.3.0
## 03/06/2015
1. [](#new)
* Added toggle for showing home item
* Added configurable home icon
* Added configurable divider icon
* Added toggle to link trailing item
# v1.2.3
## 02/05/2015
2. [](#improved)
* Added support for HHVM
# v1.2.2
## 01/23/2015
2. [](#improved)
* Added microdata information
# v1.2.1
## 01/09/2015
2. [](#improved)
* NOTE: BREAKING CHANGE: Moved templates into `partials/` subfolder for consistency.
# v1.2.0
## 11/30/2014
1. [](#new)
* ChangeLog started...

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Grav
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,82 @@
# Grav Breadcrumbs Plugin
![Breadcrumbs](assets/readme_1.png)
`Breadcrumbs` is a [Grav](http://github.com/getgrav/grav) plugin that adds links to the previous pages (following the hierarchical structure).
It is particularly useful if you are using Grav to run a blog.
# Installation
Installing the Breadcrumbs plugin can be done in one of two ways. Our GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
## GPM Installation (Preferred)
The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's Terminal (also called the command line). From the root of your Grav install type:
bin/gpm install breadcrumbs
This will install the Breadcrumbs plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/breadcrumbs`.
## Manual Installation
To install this plugin, just download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `breadcrumbs`. You can find these files either on [GitHub](https://github.com/getgrav/grav-plugin-breadcrumbs) or via [GetGrav.org](http://getgrav.org/downloads/plugins#extras).
You should now have all the plugin files under
/your/site/grav/user/plugins/breadcrumbs
>> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav), the [Error](https://github.com/getgrav/grav-plugin-error) and [Problems](https://github.com/getgrav/grav-plugin-problems) plugins, and a theme to be installed in order to operate.
# Usage
The `breadcrumbs` plugin doesn't require any configuration. The moment you install it, it is ready to use.
Something you might want to do is to override the look and feel of the breadcrumbs, and with Grav it is super easy.
Copy the template file [breadcrumbs.html.twig](templates/partials/breadcrumbs.html.twig) into the `templates` folder of your custom theme, and that is it.
```
/your/site/grav/user/themes/custom-theme/templates/partials/breadcrumbs.html.twig
```
You can now edit the override and tweak it however you prefer.
# Updating
As development for the Breadcrumbs plugin continues, new versions may become available that add additional features and functionality, improve compatibility with newer Grav releases, and generally provide a better user experience. Updating Breadcrumbs is easy, and can be done through Grav's GPM system, as well as manually.
## GPM Update (Preferred)
The simplest way to update this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm). You can do this with this by navigating to the root directory of your Grav install using your system's Terminal (also called command line) and typing the following:
bin/gpm update breadcrumbs
This command will check your Grav install to see if your Breadcrumbs plugin is due for an update. If a newer release is found, you will be asked whether or not you wish to update. To continue, type `y` and hit enter. The plugin will automatically update and clear Grav's cache.
## Manual Update
Manually updating Breadcrumbs is pretty simple. Here is what you will need to do to get this done:
* Delete the `your/site/user/plugins/breadcrumbs` directory.
* Downalod the new version of the Breadcrumbs plugin from either [GitHub](https://github.com/getgrav/grav-plugin-breadcrumbs) or [GetGrav.org](http://getgrav.org/downloads/plugins#extras).
* Unzip the zip file in `your/site/user/plugins` and rename the resulting folder to `breadcrumbs`.
* Clear the Grav cache. The simplest way to do this is by going to the root Grav directory in terminal and typing `bin/grav clear-cache`.
> Note: Any changes you have made to any of the files listed under this directory will also be removed and replaced by the new set. Any files located elsewhere (for example a YAML settings file placed in `user/config/plugins`) will remain intact.
## Configuration
Simply copy the `user/plugins/breadcrumbs/breadcrumbs.yaml` into `user/config/plugins/breadcrumbs.yaml` and make your modifications.
```
enabled: true
show_all: true
built_in_css: true
include_home: true
icon_home: ''
icon_divider_classes: 'fa fa-angle-right'
link_trailing: false
```
Options are pretty self explanatory.

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -0,0 +1,83 @@
name: Breadcrumbs
version: 1.5.0
description: The **Breadcrumbs** plugin provides a simple method to display the depth of your content/navigation structure.
icon: caret-square-o-right
author:
name: Team Grav
email: devs@getgrav.org
url: http://getgrav.org
homepage: https://github.com/getgrav/grav-plugin-breadcrumbs
demo: http://demo.getgrav.org/blog-skeleton
keywords: breadcrumbs, plugin, navigation, depth
bugs: https://github.com/getgrav/grav-plugin-breadcrumbs/issues
license: MIT
form:
validation: strict
fields:
enabled:
type: toggle
label: Plugin status
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
show_all:
type: toggle
label: Show even with one item
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
built_in_css:
type: toggle
label: Use built in CSS
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
include_home:
type: toggle
label: Include Home
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
icon_home:
type: text
size: medium
label: Icon Home
default: ''
icon_divider_classes:
type: text
size: medium
label: Icon Divider Classes
default: 'fa fa-angle-right'
link_trailing:
type: toggle
label: Link Trailing
highlight: 1
default: 0
options:
1: Enabled
0: Disabled
validate:
type: bool

View File

@ -0,0 +1,55 @@
<?php
namespace Grav\Plugin;
use \Grav\Common\Plugin;
class BreadcrumbsPlugin extends Plugin
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'onPluginsInitialized' => ['onPluginsInitialized', 0]
];
}
/**
* Initialize configuration
*/
public function onPluginsInitialized()
{
if ($this->isAdmin()) {
$this->active = false;
return;
}
$this->enable([
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
]);
}
/**
* Add current directory to twig lookup paths.
*/
public function onTwigTemplatePaths()
{
$this->grav['twig']->twig_paths[] = __DIR__ . '/templates';
}
/**
* Set needed variables to display breadcrumbs.
*/
public function onTwigSiteVariables()
{
require_once __DIR__ . '/classes/breadcrumbs.php';
$this->grav['twig']->twig_vars['breadcrumbs'] = new Breadcrumbs($this->config->get('plugins.breadcrumbs'));
if ($this->config->get('plugins.breadcrumbs.built_in_css')) {
$this->grav['assets']->add('plugin://breadcrumbs/css/breadcrumbs.css');
}
}
}

View File

@ -0,0 +1,7 @@
enabled: true
show_all: true
built_in_css: true
include_home: true
icon_home: ''
icon_divider_classes: 'fa fa-angle-right'
link_trailing: false

View File

@ -0,0 +1,68 @@
<?php
namespace Grav\Plugin;
use Grav\Common\Grav;
class Breadcrumbs
{
/**
* @var array
*/
protected $breadcrumbs;
protected $config;
/**
* @param $config
*/
public function __construct($config)
{
$this->config = $config;
}
/**
* Get all items in breadcrumbs.
*
* @return array
*/
public function get()
{
if (!$this->breadcrumbs) {
$this->build();
}
return $this->breadcrumbs;
}
/**
* Build breadcrumbs.
*
* @internal
*/
protected function build()
{
$hierarchy = array();
$grav = Grav::instance();
$current = $grav['page'];
while ($current && !$current->root()) {
$hierarchy[$current->url()] = $current;
$current = $current->parent();
}
// Page cannot be routed.
if (!$current) {
$this->breadcrumbs = array();
return;
}
if ($this->config['include_home']) {
$home = $grav['pages']->dispatch('/');
if ($home && !array_key_exists($home->url(), $hierarchy)) {
$hierarchy[] = $home;
}
}
$this->breadcrumbs = array_reverse($hierarchy);
}
}

View File

@ -0,0 +1,18 @@
#breadcrumbs {
height: 3rem;
line-height: 3rem;
padding-left: 3rem;
}
#breadcrumbs span {
display: inline-block;
padding: 0 1rem;
}
#breadcrumbs span:first-child {
padding-left: 0;
}
#breadcrumbs i {
display: inline-block;
width: 20px;
text-align: center;
}

View File

@ -0,0 +1,27 @@
{% set crumbs = breadcrumbs.get() %}
{% set breadcrumbs_config = config.plugins.breadcrumbs %}
{% set divider = breadcrumbs_config.icon_divider_classes %}
{% if crumbs|length > 1 or breadcrumbs_config.show_all %}
<div id="breadcrumbs" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
{% if breadcrumbs_config.icon_home %}
<i class="{{ breadcrumbs_config.icon_home }}"></i>
{% endif %}
{% for crumb in crumbs %}
{% if not loop.last %}
{% if crumb.routable %}
<a href="{{ crumb.url }}" itemprop="url"><span itemprop="title">{{ crumb.menu }}</span></a>
{% else %}
<span itemprop="title">{{ crumb.menu }}</span>
{% endif %}
<i class="{{ divider }}"></i>
{% else %}
{% if breadcrumbs_config.link_trailing %}
<a href="{{ crumb.url }}" itemprop="url"><span itemprop="title">{{ crumb.menu }}</span></a>
{% else %}
<span itemprop="title">{{ crumb.menu }}</span>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% endif %}