Plone add-on to add AJAX navigation
Add AJAX navigation to a Plone site.
At the time of this writing, those were no options for me since I was still on Plone 4.3. Thus, I needed a working solution. Depending on the quality, I’ll switch to some Plone-5-ish solution when doing the leap, or I’ll stick with my own.
The general idea is:
Catch the click event for every a element on the page.
For some links, a special check will tell to proceed with the standard behaviour, i.e. load the target the standard way; this includes:
- Link targets outside of the current site (another hostname is given)
- Management pages (e.g. starting with manage_)
- Other pages which don’t load the navigation links etc. anyway, or wouldn’t work when loaded via AJAX
- Anchor elements with certain attributes
- Views for contexts which don’t have a suitable embedable view yet.
For such link targets, this function will simply return true, and the page is loaded in the standard way.
If that check function concludes, “let’s load the target via AJAX”, it will look for certain elements on the page and try to update them:
other page elements
It will also set the page url and title accordingly (from the @url and @title keys of the JSON reply, respectively), allowing for the browser history.
If the tried URLs fail to return a usable JSON answer, or if the target URL is inappropriate for other reasons (e.g. page-local, or leaving the current site), the target page is loaded the normal, non-AJAX way (i.e., loading the whole page).
- Tries up to two URLs for each a element (only one, it the target URL ends with “/”, or if the final path element can be considered a view method name rather than an object id)
- Can be configured using the Plone registry.
This add-on is currently under development and not yet used on public internet sites.
Full documentation for end users can be found in the “docs” folder.
Install visaplan.plone.ajaxnavigation by adding it to your buildout:
[buildout] ... eggs = visaplan.plone.ajaxnavigation
and then running bin/buildout.
Or, more likely:
Add it to the dependencies of your package, e.g. in your setup.py file.
You’ll need to provide @@embed views for your content types; ideally, you can use your already-existing BrowserView classes.
- Issue Tracker: https://github.com/visaplan/plone.ajaxnavigation/issues
- Source Code: https://github.com/visaplan/plone.ajaxnavigation
If you are having issues, please let us know; please use the issue tracker mentioned above.
The project is licensed under the GPLv2 (or later).
- Tobias Herp, firstname.lastname@example.org
- Initial release. [tobiasherp]
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size visaplan.plone.ajaxnavigation-1.0.dev12.tar.gz (47.0 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for visaplan.plone.ajaxnavigation-1.0.dev12.tar.gz