jonom / silverstripe-betternavigator Goto Github PK
View Code? Open in Web Editor NEWFront-end utility menu for SilverStripe websites featuring administration and development tools
Front-end utility menu for SilverStripe websites featuring administration and development tools
I noticed that in the latest release (v6) that the template paths/namespaces were updated. But I am still using Silverstripe 4 and so I'm stuck with version 5.4.1 and cannot seem to figure out how to add extra links to the developer tools section
I have tried templates/JonoM/BetterNavigator/Includes/BetterNavigatorExtraDevTools.ss
, templates/BetterNavigator/Includes/ BetterNavigatorExtraDevTools.ss
and templates/BetterNavigator/BetterNavigator/Includes/ BetterNavigatorExtraDevTools.ss
without any effect (and I made sure to flush after updating the template).
Am I using the wrong paths? Or does this have something to do with me trying to overwrite the template from my own module rather then the theme template folder?
Any chance we can start seeing some version numbering to be used with composer?
Semantic versioning would help to understand things about the module by just looking at the number. I've been trying to get in the habit with my modules. It pretty much comes down to creating a new tag on nearly each commit - unless you intentionally make a bunch of commits.
Docs advise using e.g. templates/JonoM/BetterNavigator/Includes/ BetterNavigatorExtraContent.ss
but code calls ->renderWith('BetterNavigator\\BetterNavigator')
, so in fact if the templates are in a JonoM
directory they get ignored.
afterCallActionHandler
's check of DBHTMLText means there are multiple reasons BetterNavigator might not be rendered, and the js still included.
I'm likely doing something wrong but I have a form "InfusionInputsForm" that gets filled out, the FormAction function (calculateInfusion) then does a bunch of calculations and then returns return $arrayData->renderWith(['Infusion']);
. That template is rendered correctly but the navigator isn't displayed.
I have defined a BetterNavigatorEditLink() in that pages controller that looks at the ID passed into the form and returns a URL to edit that object directly (i.e. not the page). I note that the URL remains the name of the form function localhost/page/InfusionInputsForm after submitting the form.
Just not sure where to go from here with regards to getting the navigator displayed. Thanks.
Is there an easy way to make the "Edit in CMS" link work for a page displaying a DataObject? e.g. to take you to editing that DataObject in the existing ModelAdmin/GridField? (Currently, it just takes you to editing the page).
Hi, the module looks great but it even would be greater if it could be translated.
If you decide to use Transifex i'd love to provide the german translation.
See http://doc.silverstripe.org/framework/en/trunk/misc/translation-process for some more information.
the static error pages are including the betternavigator code. need to exclude it.
I was recently working on a project that would break with better navigator because I had a member
controller action. This is also a variable that the better navigator looks for in the global template variable space.
Can I suggest that the data rendered here be wrapped inside another ArrayData
variable like BetterNavigatorData
? The template will need to be adjusted accordingly.
This will ensure that BetterNavigator doesn't pick up controller/model functions/fields that users have defined.
I can't imagine this will break backwards compatibility because the BetterNavigator
template is the one looking for these variables.
This should have a check to see if it exists before doing the onclick funciton
Hi added this and did a build but doesn't appear to be working?
composer require jonom/silverstripe-betternavigator dev-master
Only show Edit in CMS button if logged in user has CanEdit permissions for the current page.
Log out button doesn't instantly log out user in SS4. Login button doesn't work at all.
Better Navigator doesn't currently seem to work on UserDefinedForm
pages.
Looks like the instance of DBHTMLText
check is failing on these pages, so the HTML isn't getting injected:
https://github.com/jonom/silverstripe-betternavigator/blob/master/src/Extension/BetterNavigatorExtension.php#L54
That's as far as I managed to get in debugging it!
Hi @jonom
thanks for the great work. While implementing your module for a client the question arised if it would be possible to directly send the user to the CMS with the correct locale set when working in conjunction with the fluent module. It would need to append the locale to the url as an l parameter. I know it's currently using the $EditLink call in the template, but I am unsure if it makes sense to overload that method (could it have other implications?) or do a conditional in the template directly. Perhaps you have more insights or thoughts on this. Thanks.
Hi Jono,
I have created a fork and a branch of this module for myself with some minor features. I thought I would share the changes with you in case you were interested in merging in any of these.
This is the branch:
https://github.com/3Dgoo/silverstripe-betternavigator/tree/feature/navigator-location-config
When I use the better navigator I usually drop it down to the bottom right of the site so it doesn't clash with the site navigation. I also make it semi-transparent when not active.
I've created this branch that allows us to set the position (left-top, right-top, right-bottom or left-bottom) through the config. If the config value is not set it defaults to right-top.
In the branch, we can also toggle the semi-transparent styling on and off through the config too.
Let me know if you're keen on using any of this. If not, all cool. Feel free to close this issue either way.
Thanks.
The BetterNavigatorExtension->isAPage()
function introduced in #27 doesn't return return true when $this->owner
is a subclass of SiteTree
.
Changing the function like so seems to work
protected function isAPage() {
return $this->owner
- && $this->owner->dataRecord
- && $this->owner->dataRecord instanceof SiteTree
- && $this->owner->dataRecord->ID > 0;
+ && $this->owner instanceof SiteTree
+ && $this->owner->ID > 0;
}
However, this causes another error
Emergency] Uncaught TypeError: Argument 1 passed to SilverStripe\CMS\Controllers\SilverStripeNavigator::__construct() must implement interface SilverStripe\ORM\CMSPreviewable, null given
Not sure what has changed between SS3 and SS4 with the functionality of extensions, but
protected function isAPage() {
echo get_class($this->owner->dataRecord);
exit;
//...
}
prints JonoM\BetterNavigator\Extension\BetterNavigatorExtension
In 2.1 if I had a site in e.g. locahost/foo, if I click on any of the links this is run on the subfolder. However on 3.0 it removes this, so instead of e.g. localhost/foo/dev/build it gets localhost/dev/build.
BetterNavigatorExtraContent.ss and BetterNavigatorExtraDevTools.ss are empty, so they render $val .= '';
on the page.
I realise this is really a bug in framework, but its kind of annoying when you just want to install the module.
Silverstripe 3.6 just released which supports php7. Running this module with php7 throws this deprecation error:
[Deprecated] Methods with the same name as their class will not be constructors in a future version of PHP; BetterNavigator has a deprecated constructor
Changing the BetterNavigator method to getBetterNavigator fixes this issue and does not break anything in template files.
Want me to do a PR?
Some controllers don't have an associated model, such as when registering for an event using the eventregistration module. It constructs a controller with no associated page.
The navigator breaks in these cases.
Mind you, this appears to be an issue with the default SilverStripeNavigator.
Fatal error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]]) in /...../cms/code/controllers/SilverStripeNavigator.php on line 28
Call Stack
# Time Memory Function Location
1 0.0006 283848 {main}( ) ../main.php:0
2 0.0521 9456776 Director::direct( ) ../main.php:176
3 0.0569 10344664 Director::handleRequest( ) ../Director.php:153
4 0.0594 10546192 ModelAsController->handleRequest( ) ../Director.php:367
5 0.1307 16381000 ContentController->handleRequest( ) ../ModelAsController.php:78
6 0.1389 17450936 ContentController->handleRequest( ) ../ContentController.php:179
7 0.1463 18214624 ContentController->handleRequest( ) ../ContentController.php:179
8 0.1468 18220160 Controller->handleRequest( ) ../ContentController.php:198
9 0.1666 18515784 RequestHandler->handleRequest( ) ../Controller.php:153
10 0.1810 19350520 ContentController->handleRequest( ) ../RequestHandler.php:222
11 0.1832 19358920 Controller->handleRequest( ) ../ContentController.php:198
12 0.1885 19362800 RequestHandler->handleRequest( ) ../Controller.php:153
13 0.1900 19500856 ContentController->handleRequest( ) ../RequestHandler.php:222
14 0.1922 19507400 Controller->handleRequest( ) ../ContentController.php:198
15 0.2557 24304960 RequestHandler->handleRequest( ) ../Controller.php:153
16 0.2561 24307456 Controller->handleAction( ) ../RequestHandler.php:200
17 0.2561 24308800 RequestHandler->handleAction( ) ../Controller.php:194
18 0.2561 24309152 EventRegisterController->index( ) ../RequestHandler.php:288
19 0.3099 26044984 SSViewer->process( ) ../EventRegisterController.php:92
20 0.3734 29543016 SSViewer->includeGeneratedTemplate( ) ../SSViewer.php:1064
....
29 0.5139 29965032 ViewableData->obj( ) ../ViewableData.php:403
30 0.5139 29965080 ContentController->SilverStripeNavigator( ) ../ViewableData.php:363
31 0.5159 30270368 SilverStripeNavigator::get_for_record( ) ../ContentController.php:307
32 0.5159 30270864 SilverStripeNavigator->__construct( ) ../SilverStripeNavigator.php:81
33 0.5159 30326696 __construct ( )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.