<h3 class="sub-header-4 mt-5">Data Filters</h3>
<div class="bg-gray p-3" data-controller="analyze">

  <% @presenter.sources.each do |source| %>

    <input type="radio"
           id="<%= source.slug %>"
           class="form-check-input"
           name="source"
           value="<%= base_url %>"
           data-action="click->analyze#refresh"
           <%= source.slug == @presenter.source.slug ? "checked" : "" %>>
           <label for="<%= source.slug %>"><%= source.to_s %></label>

           <% source.slices.each do | slice |  %>
             <div class="mx-3">
               <input type="radio"
                      id="<%= slice.slug %>"
                      class="form-check-input"
                      name="slice"
                      value="<%= base_url %>"
                      data-action="click->analyze#refresh"
                      <%= slice.slug == @presenter.slice.slug ? "checked" : "" %>
                      <%= slice.slug == "all-data" ? "hidden" : "" %>>

                      <label for="<%= slice.slug %>"
                        <%= slice.slug == "all-data" ? "hidden" : "" %>>
                        <%= slice.to_s %></label>
             </div>
           <% end %>
         <% end %>

         <%= render partial: "group_selectors" %>
</div>

<script>
  window.source = "<%= @presenter.source.slug %>";
  window.slice = "<%= @presenter.slice.slug %>";
  window.group = "<%= @presenter.group.slug %>";
  window.graph = "<%= @presenter.graph.slug %>";
</script>
