Current section

Files

Jump to
kaffy lib kaffy_web templates resource index.html.eex
Raw

lib/kaffy_web/templates/resource/index.html.eex

<div id="kaffy-api-url" style="display:none;"><%= Kaffy.Utils.router().kaffy_api_resource_path(@conn, :api, @context, @resource) %></div>
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">
<%= link to: Kaffy.Utils.router().kaffy_resource_path(@conn, :new, @context, @resource), class: "btn btn-primary btn-sm btn-circle" do %>
<i class="fas fa-plus"></i>
<% end %>&nbsp;
<%= Kaffy.ResourceAdmin.plural_name(@my_resource) %>
<%= if list_actions = Kaffy.ResourceAdmin.list_actions(@my_resource, @conn) do %>
<div class="float-right">
<div class="btn-group">
<button type="button" class="btn btn-light dropdown-toggle btn-sm" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-hammer"></i> <span class="d-none d-md-inline">Actions</span>
</button>
<div class="dropdown-menu">
<%= for {action_key, options} <- list_actions do %>
<%= form_tag(Kaffy.Utils.router().kaffy_resource_path(@conn, :list_action, @context, @resource, to_string(action_key)), method: :post, class: "list-action") %>
<input type="submit" name="submit" value="<%= options.name %>" class="dropdown-item" />
</form>
<% end %>
</div>
</div>
</div>
<% end %>
</h6>
</div>
<div class="card-body">
<div>
<div id="column-names" style="display:none;"><%= Kaffy.ResourceSchema.display_string_fields(@fields, []) %></div>
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<%= render KaffyWeb.ResourceView, "_list_table.html", conn: @conn, fields: @fields, context: @context, resource: @resource, my_resource: @my_resource %>
</table>
</div>
</div>
</div>