legendary-doc-site/apps/app/priv/templates/phx.gen.html/index.html.eex
2020-07-30 16:05:09 +00:00

46 lines
1.7 KiB
Elixir

<div class="ui top padded container">
<div class="ui grid">
<div class="row">
<div class="eight wide column">
<h1 class="ui header"><%= schema.human_plural %></h1>
</div>
<div class="eight wide right aligned column">
<span><%%= link "New <%= schema.human_singular %>", to: Routes.<%= schema.route_helper %>_path(@conn, :new), class: "ui primary button" %></span>
</div>
</div>
</div>
<table class="ui celled table">
<thead>
<tr>
<%= for {k, _} <- schema.attrs do %> <th><%= Phoenix.Naming.humanize(Atom.to_string(k)) %></th>
<% end %>
<th></th>
</tr>
</thead>
<tbody>
<%%= case @<%= schema.plural %> do %>
<%%= [] -> %>
<tr>
<td colspan="<%= schema.attrs |> Enum.count() %>">
No results.
</td>
</tr>
<%%= _ -> %>
<%%= for <%= schema.singular %> <- @<%= schema.plural %> do %>
<tr>
<%= for {k, _} <- schema.attrs do %> <td><%%= <%= schema.singular %>.<%= k %> %></td>
<% end %>
<td>
<div class="ui list">
<span class="item"><%%= link "Show", to: Routes.<%= schema.route_helper %>_path(@conn, :show, <%= schema.singular %>) %></span>
<span class="item"><%%= link "Edit", to: Routes.<%= schema.route_helper %>_path(@conn, :edit, <%= schema.singular %>) %></span>
<span class="item"><%%= link "Delete", to: Routes.<%= schema.route_helper %>_path(@conn, :delete, <%= schema.singular %>), method: :delete, data: [confirm: "Are you sure?"] %></span>
</div>
</td>
</tr>
<%% end %>
<%% end %>
</tbody>
</table>
</div>