Hello,

How can i make the first panel open by default. if i add the class .in to <div id="collapse<?php print $key ?>" class="panel-collapse collapse in"> and it opens them all by default instead of the first one. Any tips? Cheers Kevin

Comments

waverate’s picture

Any update with a solution for this?

Chitmin’s picture

I add this
<div id="collapse<?php print $key ?>" class="panel-collapse collapse <?php if ($key == '0'): ?>in<?php endif; ?>>
So, its only on first one but its also not open by default.

Update,

Sorry, my mistake.
This one works.
<div id="collapse<?php print $key ?>" class="panel-collapse collapse <?php if($key == '0'): ?>in<?php endif; ?>">

waverate’s picture

#2 is a good workaround until this is available through the Views UI.

I copied views_bootstrap/templates/accordian/views-bootstrap-accordion-plugin-style.tpl.php to my theme templates override folder and renamed it to the correct Views override. From the View theme information, I re-scanned the template files.

The line to change is line 15.

chris mcgrath’s picture

this is great Chitmin thanks!

I was wondering if you might have a solution to closing the open accordion that your code enables on page load when then next item in the group is clicked

kyletaylored’s picture

Status: Active » Needs review
StatusFileSize
new3.14 KB

Attached a patch. Adds a checkbox to the accordion option in the Views UI.

kyletaylored’s picture

StatusFileSize
new2.48 KB

Heh, fixed the patch against dev.

waverate’s picture

Status: Needs review » Reviewed & tested by the community

#6 Works

kingfisher64’s picture

Tried patch #6 against latest dev, get offset hunk failed notice. Could somebody else test this again?

Noticed that patch #5 has the filepaths prefixed with "/profiles/openenterprise/modules/contrib/" before the bootstrap module is reached. So didn't attempt a patch with this.

Would it be possible to re-roll these for the latest stable version 7.x-3.1? - then try get them committed?

Many thanks for any help

kyletaylored’s picture

StatusFileSize
new2.55 KB

I re-rolled the patch against 7.x-3.x-dev

kingfisher64’s picture

Thank you kyletaylored applied the patch successfully against latest 7.x-3.x-dev. Option appears correctly in views backend as well.

However the accordions now are both closed and when clicked just go to the node page and won't open at all. So tried the dev without the patch reveals it still doesn't open - so nothing to do with your patch.

For me only the 3.1 version works, the latest dev breaks the accordion use. I'm using 1.9 jQuery.

kingfisher64’s picture

Tried on new install - switching jquery versions and it works fine - so my issue was only a jquery version issue and the patch on #9 works.

Thanks kyletaylored for the re-roll :)

Can this be committed please?

pgraell’s picture

I make another implementation (patch base 7.x-3.1+24-dev) that can select collapse/uncollapse and first/middle/last elements in Views UI accordion option.

It works for me, but can somebody else review this patch?

iamfredrik’s picture

Re-rolled #12 against 7.x-3.1+30-dev

LCM’s picture

I also added:

<a class="accordion-toggle <?php if($key != '0'): ?>collapsed<?php endif; ?>"

To set correct state for headings (which is useful if you have icons placed within headings to indicate state, e.g. plus/minus or up/down)

Maybe you can integrate this for the sake of completeness.

Déjà vu’s picture

#2 worked for me drupal is making me lazy to think ;p

ikeigenwijs’s picture

Status: Reviewed & tested by the community » Needs work

A bit late but could # 14 be incorporated?
And because this is a UI change a screenshot of UI before and after the patch

What happens for existing installs?

still applies cleanly to dev, i m ready to go if i have the extra confirmation.

bluehead’s picture

14 works

peetrovich’s picture

#9 worked for me.
Thanks to kyletaylored.

maxmendez’s picture

Thanks for the patch, in my case i'm working on Drupal 8 so i rewrited for 8.x-4.1 and include a fix to make it compatible with bootstrap barrio.

  • aburrows committed e75ec9a on 8.x-4.x authored by MaxMendez
    Issue #2149725 by kyletaylored, iamfredrik, pgraell, MaxMendez: Make...
aburrows’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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