blocknotes / activeadmin_blaze_theme

A theme for Active Admin based on Blaze CSS 3.x
MIT License
46 stars 12 forks source link

Is it possible to use the Accordion outside of a form? #5

Closed victor-britto-liax closed 3 years ago

victor-britto-liax commented 3 years ago

Is there any way to use the accordion outside of the form? I wanted to use it in the view.

blocknotes commented 3 years ago

Hey, sorry to reply so late.

I found a problem with the accordions, it should be fixed with this PR: https://github.com/blocknotes/activeadmin_blaze_theme/pull/10

About your question: you can do it using the Blaze CSS syntax (not with the gem helpers). Like in the docs.

Example:

# app/admin/dashboard.rb
ActiveAdmin.register_page "Dashboard" do
  content title: proc { I18n.t("active_admin.dashboard") } do
    div do
      h3 'Test partial'
      render partial: 'test_partial'
    end
end
<!-- app/views/admin/dashboard/_test_partial.html.erb -->
<div class="c-card c-card--accordion u-high">
  <input type="checkbox" id="accordion-1">
  <label class="c-card__item" for="accordion-1">Item 1</label>
  <div class="c-card__item">Pane 1</div>

  <input type="checkbox" id="accordion-2">
  <label class="c-card__item" for="accordion-2">Item 2</label>
  <div class="c-card__item">Pane 2</div>
</div>