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

[1.4.x] Tabs disappear when clicked #2238

Closed
espaan opened this issue Feb 9, 2015 · 19 comments
Closed

[1.4.x] Tabs disappear when clicked #2238

espaan opened this issue Feb 9, 2015 · 19 comments

Comments

@espaan
Copy link
Contributor

espaan commented Feb 9, 2015

Just tried Content (4.2.0) so old style module etc with 1.4.x. Most things seem to work perfectly.
Of course layouts can be converted into col-md-x columns instead of the "hard coded" 62-38/etc% column divisions, but that is a small thing.

However the Tabs that are using {formtabbedpanel __title='Content'} is not all ok. There are 3 tabs, when you click one the 2nd the first dissappears, when you click on the 3rd the 2nd also dissappears, so in the end you're left with only the 3rd tab.

The tabs is hidden via jQuery call somehow it seems. Not checked in details where it could come from.

@craigh craigh added this to the 1.4.0 milestone Feb 9, 2015
@craigh
Copy link
Member

craigh commented Feb 9, 2015

I noticed this in EL also.

@espaan
Copy link
Contributor Author

espaan commented Feb 9, 2015

Weird, somehow the tab as well as the content div is hidden instead of only the content div not visible.
For the rest all works great. Also page editing and drag/drop of content items (that uses jQuery UI portlet BTW).

@Guite Guite added the Blocker label Feb 9, 2015
@craigh
Copy link
Member

craigh commented Feb 9, 2015

@phaidon - could this have something to do with some of the "magic" you added to help jQuery and bootstrap play well together?

@craigh craigh changed the title [1.4.x] Module Content with tabs issues [1.4.x] Tabs disappear when clicked Feb 9, 2015
@cmfcmf
Copy link
Contributor

cmfcmf commented Feb 9, 2015

Probably related to #1190.

@craigh
Copy link
Member

craigh commented Feb 9, 2015

refs 079df47

@cmfcmf
Copy link
Contributor

cmfcmf commented Feb 9, 2015

Random guess: It does not work because jQuery is loaded after prototype:

<script type="text/javascript" src="http://zikula.org/javascript/ajax/proto_scriptaculous.combined.min.js"></script>
<script type="text/javascript" src="http://zikula.org/web/jquery/jquery.min.js"></script>

@espaan
Copy link
Contributor Author

espaan commented Feb 9, 2015

And it should :-) http://api.jquery.com/jquery.noconflict/#jQuery-noConflict-removeAll
the noconflict is always adviced to load prototype first and then jQ

@craigh
Copy link
Member

craigh commented Feb 9, 2015

no it doesn't work.

@craigh
Copy link
Member

craigh commented Feb 9, 2015

And it should :-)

but the "fix" checks for jQuery - and now this happens BEFORE jQuery exists.

@craigh
Copy link
Member

craigh commented Feb 9, 2015

we need the sorcerer. ping @phaidon PLEASE HELP!

@espaan
Copy link
Contributor Author

espaan commented Feb 9, 2015

Ah right, that makes it more difficult indeed. mmhh. Then jQuery should be loaded first for the fix, but is adviced to load after prototype in noconflict description..

@craigh
Copy link
Member

craigh commented Feb 9, 2015

I wonder if the fix could be extracted from it's current location and loaded later.

@espaan
Copy link
Contributor Author

espaan commented Feb 9, 2015

In my case jQuery is loaded before prototype, see below. But still the tabs dissappear.

<script type="text/javascript" src="/zk140/web/jquery/jquery.js"></script>
<script type="text/javascript" src="/zk140/javascript/jquery_config.js"></script>
<script type="text/javascript" src="/zk140/web/jquery/jquery-migrate.min.js"></script>
<script type="text/javascript" src="/zk140/web/jquery-ui/jquery-ui.js"></script>
<script type="text/javascript" src="/zk140/javascript/ajax/original_uncompressed/prototype.js"></script>
...

@craigh
Copy link
Member

craigh commented Feb 9, 2015

I think this is the fix but am sort of clueless on implementation

http://softec.lu/site/DevelopersCorner/BootstrapPrototypeConflict

@espaan
Copy link
Contributor Author

espaan commented Feb 9, 2015

With

  jQuery('*').on('hide.bs.tab', function( event ) {
    isBootstrapEvent = true;
  });

I added that line to prototype.js (and in development mode) so that is loaded and now it works. Did you do a real re-load for JS ?

@craigh
Copy link
Member

craigh commented Feb 9, 2015

and not hide.bs.tabs

I don't see tabs plural in the fix?

@espaan
Copy link
Contributor Author

espaan commented Feb 9, 2015

No sorry, my bad. You had hide.bs.tab. Updated comment. We were only missing hide.bs.tab is seems in the prototype fix.

So going from (in prototype.js)

var isBootstrapEvent = false;
if (window.jQuery) {  
  jQuery('*').on('hide.bs.dropdown', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.collapse', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.modal', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.popover', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.tooltip', function( event ) {
    isBootstrapEvent = true;
  });
}

to

var isBootstrapEvent = false;
if (window.jQuery) {  
  jQuery('*').on('hide.bs.dropdown', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.collapse', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.modal', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.popover', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.tooltip', function( event ) {
    isBootstrapEvent = true;
  });
  jQuery('*').on('hide.bs.tab', function( event ) {
    isBootstrapEvent = true;
  });
}

works here. Firefox 35.0.1 on Win7

@espaan
Copy link
Contributor Author

espaan commented Feb 9, 2015

So also update line 514 in https://github.com/zikula/core/blob/1.4/src/lib/util/JCSSUtil.php#L514
and remove prototype "hack"
JCSSUtil line 514 should be updated

            $scripts = array_merge($jQueryUncompressed, $jQueryUiUncompressed, $prototypeUncompressed, $livepipeUncompressed, array_slice($scripts, 5));

into

            $scripts = array_merge($prototypeUncompressed, $jQueryUncompressed, $jQueryUiUncompressed, $livepipeUncompressed, array_slice($scripts, 5));

@craigh
Copy link
Member

craigh commented Feb 15, 2015

closed by #2242

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants