Git Product home page Git Product logo

back-button's Introduction

Back Button

Build Status Licence Latest stable PHPStan

Installation

The recommended way to is via Composer:

composer require surda/back-button

After that you have to register extension in config.neon:

extensions:
    backButton: Surda\BackButton\BackButtonExtension

Configuration

Default

backButton:
    defaultPresenterLink: 'default'
    templates:
        default: bootstrap4.default.latte
        secondary: bootstrap4.secondary.latte

List of all configuration options:

backButton:
    defaultPresenterLink: 'default'
    useAjax: false
    template: path/to/your/latte/file.latte
    # or
    templates:
        default: path/to/your/latte/file.latte
        foo: path/to/your/latte/foo.latte
        ...

Usage

Presenter

use Nette\Application\UI\Presenter;
use Surda\BackButton\InjectBackButton;

abstract class ProductPresenter extends Presenter
{
    use InjectBackButton;
}

Template

Source page (e.g. Product:default) add link to default.latte

<a n:href="detail $id, destination => $currentLink">Detail</a>

Destination page (Product:detail) add component to detail.latte

{control backButton}

Destination

Presenter

$this->template->destination = $this->link('detail', $id);

Latte

{control backButton destination:$destination}

Select control template file

Default template

{control backButton} or {control backButton default}  

Set control template by type of template (see config.neon)

{control backButton templateType}

Reset

Reset persistent parameter $destination in URL ...?destination=%2Fproduct

<a n:href="default, destination => NULL">Products</a>

or all (defined) persistent parameters

<a n:href="default, (expand) $resetPersistentParameters">Products</a>

back-button's People

Contributors

surda avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.