简体   繁体   中英

Use Rails link_to tag with Bootstrap accordion dropdown

How could I replace the following with a Rails link_to tag, while still using HAML?

%a{"aria-controls" => "collapseOne", "aria-expanded" => "true", "data-parent" => "#accordion", "data-toggle" => "collapse", :href => "#collapseOne", :role => "button"}
      Collapsible Group Item #1

This is from a Bootstrap accordion example, except using HAML instead of HTML: http://getbootstrap.com/javascript/#collapse-example-accordion

It's not really HAML anymore, it's just the link_to helper... Try this:

= link_to 'Collapsible Group Item #1', '#collapseOne', role: :button,
          data: { parent: '#accordion', toggle: :collapse },
          aria: { controls: :collapseOne, expanded: true }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM