<h2><%= @group.title %></h2>

<%= form_for @create_feed_changeset, Routes.feed_path(@conn, :create), fn form -> %>
  <%= hidden_input form, :group_id %>
  <div class="form-group row">
    <%= label form, :feed_url, "Feed URL", class: "col-sm-2 col-form-label" %>
    <div class="col-sm-10">
      <%= text_input form, :feed_url, placeholder: "https://example.com/feed.xml", class: "form-control" %>
    </div>
  </div>
  <div class="form-group row">
    <div class="col-sm-10">
      <%= submit "Add Feed", class: "btn btn-primary" %>
    </div>
  </div>
<% end %>

<%= form_tag Routes.group_path(@conn, :delete, @group.id), method: :delete do %>
  <%= submit "Delete Group", class: "btn btn-danger" %>
<% end %>

<h3 class="mt-4">Feeds</h3>

<table class="table table-striped">
  <tbody>
    <%= for feed <- @group.feeds do %>
      <tr>
        <td>
          <a href="<%= Routes.feed_path(@conn, :show, feed.id) %>"><%= feed.feed_url %></a>
        </td>
        <td>
          <a href="<%= feed.site_url %>"><%= feed.title %></a>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>