Recent Topics

6.7.7 Bug: JavaScript blog_widgets.js

Started by on Oct 08, 2016 – Contents updated: Oct 13, 2016

Oct 08, 2016 15:34    

If widgets are edited in standalone mode (Collections>CollectionName>Widgets [rightclick open new tab])

The JavaScript breaks for:

rsc/js/blog_widgets.js

on line: 65

crumb_url = crumb_url.match(/crumb_.*?$/);

Produces Error: TypeError: crumb_url is undefined

This is because the widget is not being edited in the Ajax Form. It would probably be a good idea to fix that with something like:

if( typeof crumb_url !== 'undefined' ){
	crumb_url = crumb_url.match(/crumb_.*?$/);
	}

Then also on line 353:

var r = 'blog='+blog+'&'+query_string+'container_list='+containers_list;

Produces Error: ReferenceError: blog is not defined

perhaps add:

if( typeof blog == 'undefined' ){
	blog = 1;
	}
	var r = 'blog='+blog+'&'+query_string+'container_list='+containers_list;

Adding this shouldn't matter because you are not on the widgets page, however if it remains unfixed then other JavaScript won't run.

Oct 11, 2016 06:00

@achillis I confirm the js issue. However, I think that instead of checking the existence of individual variables right after defining them, we can just avoid loading the whole file blog_widgets.js when not needed.

I mean, that file includes UI functions that makes sense only if we are in the list page (drag and drop, colouring, delete, etc). So, we can load it just if we are in that list. Maybe this way: https://github.com/mgsolipa/b2evolution/commit/7af93a0c0cd1d878ff059632d4b1bb4e7a347515

@fplanque what do you think?

Oct 11, 2016 15:30

Actually the individual file will/should be concatenated with other backoffice scripts and minified in grunt.

So we need to fix the JS I guess.


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.