user3721240
user3721240

Reputation:

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

Upvotes: 1

Views: 1773

Answers (1)

Nick Veys
Nick Veys

Reputation: 23939

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 }

Upvotes: 4

Related Questions