-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a09f00
commit a7cb191
Showing
6 changed files
with
184 additions
and
102 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# History Extesnion | ||
|
||
Utilizes History API implemented in HTML 5. | ||
|
||
## Installation | ||
|
||
1. Link `history/history.ajax.js` after `nette.ajax.js`. | ||
2. Register config extension in `app/bootstrap.php`: | ||
|
||
```php | ||
$configurator->onCompile[] = function ($configurator, $compiler) { | ||
$compiler->addExtension('ajax', new VojtechDobes\NetteAjax\Extension); | ||
}; | ||
``` | ||
|
||
## Usage | ||
|
||
Write your application as normal. All redirects and forwards will be properly handled. | ||
|
||
To correctly update UI, use snippets. If you plan to ajaxify whole application, consider adding this snippet to your `beforeRender()` method in `BasePresenter`. | ||
|
||
```php | ||
if ($this->isAjax()) { | ||
$this->invalidateControl('title'); | ||
$this->invalidateControl('content'); | ||
} | ||
``` | ||
|
||
And `app/@layout.latte` might be upgraded accordingly: | ||
|
||
```html | ||
<title n:inner-snippet="title">... | ||
``` | ||
|
||
```html | ||
{snippet content} | ||
{include content} | ||
{/snippet} | ||
``` | ||
|
||
## UI Caching | ||
|
||
Extension will automatically cache your UI and restore it on *Back* and *Forward* buttons without communication with server. If you wish to call server on every *Back* and *Forward*, turn caching off. | ||
|
||
```js | ||
$.nette.ext('history').cache = false; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters