Error in ccm.app.js if C5 toolbar not loaded

Permalink 4 users found helpful
I use the jQuery dialog in my site's theme (as a login box). I include the necessary scripts in my theme like so:
<head>
   <?php
   $html = Loader::helper('html');
   $this->addHeaderItem($html->javascript('jquery.ui.js'));
   $this->addHeaderItem($html->css('jquery.ui.css'));
   $this->addHeaderItem($html->css('ccm.dialog.css'));
   $this->addHeaderItem($html->javascript('ccm.dialog.js'));
   Loader::element('header_required');
   ?>
   ...
</head>


Just upgraded to version 5.6.0.2 yesterday, and noticed that the login box dialog no longer works. Firebug reports this error:
TypeError: $("#ccm-page-help").popover is not a function
ccm.app.js, line 9


I'm thinking this is because when I'm not logged into the C5 site, there's no C5 toolbar and hence no "Help" link at the top. ccm.app.js is just assuming that it's there...

It would be nice if the next update fixes this issue, so C5's jQuery dialog can be used in theme even if visitors are not logged in.

Thanks!

tomreitz
 
peterrr replied on at Permalink Reply 1 Attachment
I had the same issue and checked whether certain jQuery plugins were loaded:

if(jQuery().tooltip){

}

See attachment for a new ccm.app.js file.
Kiesel replied on at Permalink Reply
Thank you kodde, that fixed it for me without that I need to load an unnecessary additional .js
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
bootstrap.js may have been taken out of ccm.app.js on the latest build.

If so, anything that uses bootstrap.js or ccm.app.js facilities that use bootstrap.js code will need to load it separately.
tomreitz replied on at Permalink Reply
tomreitz
Thanks guys, adding
$this->addHeaderItem($html->javascript('bootstrap.js'));

fixed my problem. Awesome!
nknadmin replied on at Permalink Reply
Saved my butt. thanks!
triplei replied on at Permalink Reply
triplei
Thanks, I was running into an issue where I was getting a js error saying

Uncaught TypeError: Object [object Object] has no method 'popover'


This would only show up when not signed in as an administrator. Loading /concrete/js/bootstrap.js cleared up the issue, but seems strange since the site isn't using anything bootstrapy. However, I've updated about a dozen or so sites to 5.6.0.2 without the same issue.

Thanks again for pointing me in the right direction.
andrew replied on at Permalink Reply
andrew
Yeah. In an effort to make concrete5 and bootstrap integrate more smoothly, we've moved their libraries into bootstrap.js (that way, if you're building a bootstrap site you can include more bootstrap stuff at js/bootstrap.js in your root and override the core bootstrap.js library without affecting ccm.app.js)
tomrice replied on at Permalink Reply
tomrice
I have custom content on my "profile" view page and was getting this error in Internet Explorer on profiles (and also on the "edit profile" page). This screwed up any JS features I tried to add to profiles when using IE:

SCRIPT438: Object doesn't support property or method 'popover'
ccm.app.js?v=e29b3ccdd6ac0550cc41f1f2477b3471, line 9 character 15276

Adding bootstrap.js to the controller for those pages fixed the problem, but seems I shouldn't really need to do that? I've not added anything that strange or bootstrap-related to profiles, and the edit page just has form fields (one being a simple rich text field).

Thanks for the fix though!

I'm on Concrete 5.6.0.2 and only got the error when logged in.