Initial commit
This commit is contained in:
commit
65e0da7e11
1397 changed files with 596542 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue