Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu: loading page for a custom plugin's menu triggers javascript error #6666

Open
efiorello opened this issue Nov 13, 2014 · 8 comments
Open
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. c: Usability For issues that let users achieve a defined goal more effectively or efficiently.

Comments

@efiorello
Copy link

If you refresh (F5) the page, solves the problem.

I found a javascript error:
Uncaught TypeError: Cannot read property 'substr' of undefined
broadcast.propagateAjax( $(item).attr('href').substr(1) ); (menu.js line 43)

$(item).attr('href') return undefined

@tsteur
Copy link
Member

tsteur commented Nov 13, 2014

With the first time you mean after a fresh installation? After updating it?

Which Piwik version are you using?

@efiorello
Copy link
Author

I investigated more, and found that the problem exists when I activate a menu of my own plugin.

I'm using the latest version, but I got it all

@tsteur
Copy link
Member

tsteur commented Nov 16, 2014

Sweet. I'm closing it. Let me know in case you need any help or if anything is wrong/buggy with our API's

@tsteur tsteur closed this as completed Nov 16, 2014
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Nov 16, 2014
@tsteur tsteur added this to the Piwik 2.10.0 milestone Nov 16, 2014
@tsteur tsteur self-assigned this Nov 16, 2014
@efiorello
Copy link
Author

Tsteur, the problem is not my implementation.
I followed steps 1, 2 and 3 of the Getting started guide and the problem already appears

@tsteur tsteur reopened this Nov 19, 2014
@tsteur tsteur added Bug For errors / faults / flaws / inconsistencies etc. and removed answered For when a question was asked and we referred to forum or answered it. labels Nov 19, 2014
@tsteur
Copy link
Member

tsteur commented Nov 19, 2014

Thx a lot. I haven't tried it but by having a look at the code I can kinda reproduce it (here: https://github.com/piwik/piwik/blob/master/plugins/CoreHome/templates/_menu.twig#L43)

I guess you have defined your own "Report Category Name"?

Internal note: I think we only do add a "2nd level item" here but never a "1st level item" for a custom category: https://github.com/piwik/piwik/blob/master/core/Plugin/Report.php#L338 Not sure how to fix this as when there are 10 reports using this custom category we do not want to add 10 1st level item etc.

Maybe we can make Menu builder a bit more smart to add a new first level item category automatically (here https://github.com/piwik/piwik/blob/master/core/Menu/MenuAbstract.php#L153) in case there is none yet. In case one gets set later, we would overwrite only the first level item details.

@tsteur tsteur removed their assignment Nov 19, 2014
@mattab mattab modified the milestones: Short term, Piwik 2.10.0 Dec 5, 2014
@mattab mattab added the c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. label Apr 7, 2015
@mattab mattab modified the milestones: Mid term, Short term Apr 7, 2015
@mattab
Copy link
Member

mattab commented Apr 7, 2015

please leave a comment or +1 if you also experience this issue

@mattab mattab modified the milestone: Mid term Apr 7, 2015
@tsteur
Copy link
Member

tsteur commented Apr 7, 2015

See my comment, I could reproduce it but there could be another bug.

@mattab
Copy link
Member

mattab commented Apr 8, 2015

Maybe we can make Menu builder a bit more smart to add a new first level item category automatically (here https://github.com/piwik/piwik/blob/master/core/Menu/MenuAbstract.php#L153) in case there is none yet. In case one gets set later, we would overwrite only the first level item details.

it sounds like an easy fix and will help plugin developers so definitely 👍

@mattab mattab added this to the Short term milestone Apr 8, 2015
@mattab mattab changed the title The first time that you visit piwik, this broken the javascript Menu: loading page for a custom plugin's menu triggers javascript error Apr 9, 2015
@mattab mattab added the c: Usability For issues that let users achieve a defined goal more effectively or efficiently. label Apr 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. c: Usability For issues that let users achieve a defined goal more effectively or efficiently.
Projects
None yet
Development

No branches or pull requests

3 participants