I've just installed dev version of navbar (2013-May-02) and backbone library sits in libraries folder. I've got Libraries 2.0 module enabled. The console says:

Uncaught ReferenceError: Backbone is not defined

in navbar.js:519.

Is there a bug in current dev or this is my site configuration problem?

CommentFileSizeAuthor
#15 navbar-1989794-14.diff1.07 KBdesignerbrent
#1 navbar-1989794-1.patch1012 byteschi

Comments

chi’s picture

StatusFileSize
new1012 bytes

Where did you place the blackbone js file? I found inconsistency in navbar_requirements().

hass’s picture

Priority: Normal » Critical
Status: Active » Reviewed & tested by the community

Thanks for sharing your patch. Requires a new release asap.

philipz’s picture

My backbone js file is in libraries/backbone/backbone-min.js.
I applied this patch, cleared caches and uninstalled/re enabled the navbar module but problem still exists.
Looks like backbone js is not included at all.

philipz’s picture

navbar_convert_libraries_to_library function detects that backbone library was not loaded and returns empty array for backbone.
This might be library_load not the navbar/backbone problem.

philipz’s picture

Well I don't know what happened but now it works fine. I was trying to debug this using dpm and clearing caches multiple times - maybe those extra clear caches did it.

saltednut’s picture

Status: Reviewed & tested by the community » Fixed
hass’s picture

Status: Fixed » Reviewed & tested by the community

There is no commit. Why are you changing the status?

saltednut’s picture

Status: Reviewed & tested by the community » Active

Sorry, I changed it to fixed based on.

Well I don't know what happened but now it works fine. I was trying to debug this using dpm and clearing caches multiple times - maybe those extra clear caches did it.

I didn't think the patch was necessary.

saltednut’s picture

Status: Active » Reviewed & tested by the community
hass’s picture

The patch fixes an inconsistency bug in the code for sure.

azarzag’s picture

I had the same problem, but it went away by installing the underscore.js library

justkristin’s picture

Patch in #1 worked for me.

mathieso’s picture

Code is:

if (!empty($path) && file_exists($path . '/backbone.js')) {

Should it be:

if (!empty($path) && ( file_exists($path . '/backbone.js') || file_exists($path . '/backbone-min.js')) {

Kieran

saltednut’s picture

@mathieso can you provide a little more info for the patch writer along with your code review?

designerbrent’s picture

StatusFileSize
new1.07 KB

Patch #1 worked fine for me, however it the patch in #13 might be a good idea to ensure compatibility with people using the un-minified version. I've attached a patch that includes this.

designerbrent’s picture

Status: Reviewed & tested by the community » Needs review

Updating the status.

hass’s picture

Status: Needs review » Reviewed & tested by the community

This patch introduces inconsistencies again. Patch from #1 makes it consistent and is RTBC, the last patch CNW.

recidive’s picture

Title: Backbone is not defined » Status report page looking for wrong backbone and underscore files

Patch in #1 worked for me too.

The module includes the *-min.js files while the status reports page looks the *.js files.

While this is not critical since it doesn't actually breaks anything if you have the correct *-min.js files in the libraries directory, it may be misleading for developers trying to debug navbar, so I'm keeping this as critical for now.

hass’s picture

I have only added the files the status page complained about and this has not worked as I have not added the min.js file to the folder.

recidive’s picture

@hass, yes the module includes the min.js whilst the status page looks for the .js.

That patch is for bringing consistency, since it looks like only the min.js file matters to the module.

hass’s picture

I know what this patch does.

recidive’s picture

Alright, dungeon master.

amirtaiar’s picture

I have tried #1 patch and it's helping.
I have also download the underscore library and the report log is all green yet the menu isn't working.

jessebeach’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all. Committed to 7.x-1.x in ecefe8c288d999269e993c0a1cc537411a98bd43.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

andregriffin’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

I just installed the most recent dev version of navbar, and my status report indicated that backbone was not present, even though it was located at sites/all/libraries/backbone/backbone-min.js -- And it was not loaded by the module. After renaming the file to "backbone.js" (even though it was minified/production), everything worked as expected. Perhaps there's been a regression here?

eshta’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

@andregriffin: I'm not able to reproduce with the most recent version based on the steps you indicate. Did you have any resolution to your issue and do you have more information?

Note: I'm changing the priority as the critical fix was already committed.

hass’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

This can only be wrong file names.