Initial commit
This commit is contained in:
commit
65e0da7e11
1397 changed files with 596542 additions and 0 deletions
1
site/OFF_plugins/kirby-panel-prevnext/definition.yml
Normal file
1
site/OFF_plugins/kirby-panel-prevnext/definition.yml
Normal file
|
|
@ -0,0 +1 @@
|
|||
type: prevnext
|
||||
BIN
site/OFF_plugins/kirby-panel-prevnext/docs/prevnext.gif
Normal file
BIN
site/OFF_plugins/kirby-panel-prevnext/docs/prevnext.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
|
|
@ -0,0 +1,32 @@
|
|||
.plugin-prevnext {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.plugin-prevnext a {
|
||||
margin: .5em;
|
||||
}
|
||||
|
||||
.plugin-prevnext .prev i {
|
||||
margin-right: .5em;
|
||||
}
|
||||
.plugin-prevnext .next i {
|
||||
margin-left: .5em;
|
||||
}
|
||||
|
||||
.plugin-prevnext a {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.plugin-prevnext a:hover {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.plugin-prevnext .prev {
|
||||
margin-right: .5em;
|
||||
}
|
||||
|
||||
.plugin-prevnext .next {
|
||||
margin-left: .5em;
|
||||
}
|
||||
53
site/OFF_plugins/kirby-panel-prevnext/field/prevnext.php
Normal file
53
site/OFF_plugins/kirby-panel-prevnext/field/prevnext.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
/*
|
||||
class pagejump {
|
||||
// Reverse one
|
||||
public static function reverse( $item ) {
|
||||
//echo $steps;
|
||||
echo $item->url();
|
||||
|
||||
$obj = ( $item->hasPrev() ) ? $item->prev() : $item->siblings()->last();
|
||||
|
||||
echo $obj->url();
|
||||
return $obj;
|
||||
}
|
||||
// Forward one
|
||||
public static function forward( $item ) {
|
||||
$obj = ( $item->hasNext() ) ? $item->next() : $item->siblings()->first();
|
||||
return $obj;
|
||||
}
|
||||
// Jump
|
||||
public static function jump( $steps, $item = null ) {
|
||||
//$item = ( ! empty( $item ) ) ? $item : page();
|
||||
for( $i = 0; $i < abs( $steps ); $i++ ) {
|
||||
if( $steps <= 0 ) {
|
||||
$item = self::reverse( $item );
|
||||
} else {
|
||||
$item = self::forward( $item );
|
||||
}
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
// Wrapper function for template
|
||||
page::$methods['jump'] = function($page, $steps) {
|
||||
return pagejump::jump( $steps, $page );
|
||||
};*/
|
||||
|
||||
class PrevnextField extends BaseField {
|
||||
static public $fieldname = 'prevnext';
|
||||
static public $assets = array(
|
||||
'css' => array(
|
||||
'style.css',
|
||||
)
|
||||
);
|
||||
|
||||
public function input() {
|
||||
#echo $this->page->prev()->slug();
|
||||
#echo page($this->page->id())->prev()->slug();
|
||||
$html = tpl::load( __DIR__ . DS . 'template.php', $data = array(
|
||||
'page' => $this->page
|
||||
));
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
37
site/OFF_plugins/kirby-panel-prevnext/field/template.php
Normal file
37
site/OFF_plugins/kirby-panel-prevnext/field/template.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
$page_obj = page($page->id());
|
||||
|
||||
if( $page_obj->siblings()->count() > 1 ) {
|
||||
if ( $page_obj->hasPrev() ) {
|
||||
$prev = $page_obj->prev();
|
||||
} else {
|
||||
$prev = $page_obj->siblings()->last();
|
||||
}
|
||||
|
||||
if ( $page_obj->hasNext() ) {
|
||||
$next = $page_obj->next();
|
||||
} else {
|
||||
$next = $page_obj->siblings()->first();
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="plugin-prevnext">
|
||||
<a class="prev" href="<?php echo panel()->urls()->index() . '/pages/' . $prev->id() . '/edit'; ?>">
|
||||
<i class="fa fa-chevron-left" aria-hidden="true"></i>
|
||||
<?php echo $prev->title(); ?>
|
||||
</a>
|
||||
|
||||
<a class="next" href="<?php echo panel()->urls()->index() . '/pages/' . $next->id() . '/edit'; ?>">
|
||||
<?php echo $next->title(); ?>
|
||||
<i class="fa fa-chevron-right" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
<?php } else {
|
||||
?>
|
||||
<style>
|
||||
.field-name-prevnext {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
$kirby->set('field', 'prevnext', __DIR__ . DS . 'field');
|
||||
$kirby->set('blueprint', 'fields/prevnext', __DIR__ . '/definition.yml');
|
||||
8
site/OFF_plugins/kirby-panel-prevnext/package.json
Normal file
8
site/OFF_plugins/kirby-panel-prevnext/package.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "kirby-panel-prevnext",
|
||||
"description": "Panel siblings navigation",
|
||||
"author": "Jens Törnell <jens.tornell@gmail.com>",
|
||||
"version": "0.1",
|
||||
"type": "kirby-plugin",
|
||||
"license": "MIT"
|
||||
}
|
||||
75
site/OFF_plugins/kirby-panel-prevnext/readme.md
Normal file
75
site/OFF_plugins/kirby-panel-prevnext/readme.md
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# Kirby Panel Prevnext
|
||||
|
||||
*Version 0.1*
|
||||
|
||||
Navigate to siblings in the panel. Multilanguage support.
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
Use one of the alternatives below.
|
||||
|
||||
### 1. Kirby CLI
|
||||
|
||||
If you are using the [Kirby CLI](https://github.com/getkirby/cli) you can install this plugin by running the following commands in your shell:
|
||||
|
||||
```
|
||||
$ cd path/to/kirby
|
||||
$ kirby plugin:install jenstornell/kirby-panel-prevnext
|
||||
```
|
||||
|
||||
### 2. Clone or download
|
||||
|
||||
1. [Clone](https://github.com/jenstornell/kirby-panel-prevnext.git) or [download](https://github.com/jenstornell/kirby-panel-prevnext/archive/master.zip) this repository.
|
||||
2. Unzip the archive if needed and rename the folder to `kirby-panel-prevnext`.
|
||||
|
||||
**Make sure that the plugin folder structure looks like this:**
|
||||
|
||||
```
|
||||
site/plugins/kirby-panel-prevnext/
|
||||
```
|
||||
|
||||
### 3. Git Submodule
|
||||
|
||||
If you know your way around Git, you can download this plugin as a submodule:
|
||||
|
||||
```
|
||||
$ cd path/to/kirby
|
||||
$ git submodule add https://github.com/jenstornell/kirby-panel-prevnext site/plugins/kirby-panel-prevnext
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
### 1. Blueprint
|
||||
|
||||
To make it work as expected, add the following code to your blueprint:
|
||||
|
||||
```
|
||||
fields:
|
||||
prevnext: prevnext
|
||||
```
|
||||
|
||||
## Changelog
|
||||
|
||||
**0.1**
|
||||
|
||||
- Inital release
|
||||
|
||||
## Requirements
|
||||
|
||||
- [**Kirby**](https://getkirby.com/) 2.3+
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please [create a new issue](https://github.com/jenstornell/kirby-panel-prevnext/issues/new).
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://opensource.org/licenses/MIT)
|
||||
|
||||
It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.
|
||||
|
||||
## Credits
|
||||
|
||||
- [Jens Törnell](https://github.com/jenstornell)
|
||||
Loading…
Add table
Add a link
Reference in a new issue