Initial commit
This commit is contained in:
27
app/views/downloads/_download.html.erb
Normal file
27
app/views/downloads/_download.html.erb
Normal file
@@ -0,0 +1,27 @@
|
||||
<tr>
|
||||
<td>
|
||||
<%= download.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= download.release_type&.titleize %>
|
||||
</td>
|
||||
<td>
|
||||
<%= download.status.titleize %>
|
||||
</td>
|
||||
<td>
|
||||
<%= download.created_at.strftime("%D %T") %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<%= button_tag t(".actions.manage"), class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<% if download.file.attached? %>
|
||||
<%= link_to fa_icon("download fw", text: "Download"), download.file, class: "dropdown-item", target: :_blank %>
|
||||
<% end %>
|
||||
<% if policy(download).destroy? %>
|
||||
<%= link_to fa_icon("trash fw", text: "Delete"), download_path(download, project_id: download.project.id), class: "dropdown-item", method: :delete, data: { confirm: "Are you sure?" } %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
32
app/views/downloads/index.html.erb
Normal file
32
app/views/downloads/index.html.erb
Normal file
@@ -0,0 +1,32 @@
|
||||
<div class="d-flex flex-row justify-content-between flex-row-reverse align-items-center mb-3">
|
||||
<%= bootstrap_form_with url: project_downloads_path, method: :get, remote: true, layout: :inline, id: "search" do |form| %>
|
||||
<%= form.search_field :query, hide_label: true, placeholder: t(".actions.search"), class: "rounded-pill-right", value: params[:query], prepend: form.button(fa_icon("search"), id: "search-button", class: "btn btn-light border rounded-pill-left") %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="border bg-white rounded shadow-sm pb-3 table-responsive">
|
||||
<table class="table table-striped tr-px-4 align-all-middle">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th><%= t(".table_headers.download_name") %></th>
|
||||
<th><%= t(".table_headers.download_type") %></th>
|
||||
<th><%= t(".table_headers.download_status") %></th>
|
||||
<th><%= t(".table_headers.download_created_at") %></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="downloads">
|
||||
<% if @downloads.any? %>
|
||||
<%= render partial: "download", collection: @downloads %>
|
||||
<% else %>
|
||||
<tr>
|
||||
<td colspan="5" class="py-4 text-center text-muted"><%= t(".empty") %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="downloads_pagination" class="mt-3">
|
||||
<%= will_paginate @downloads %>
|
||||
</div>
|
||||
3
app/views/downloads/index.js.erb
Normal file
3
app/views/downloads/index.js.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
$("#downloads").html("<%= j render(@downloads) %>");
|
||||
$("form input[type='search']").val("<%= params[:query] %>");
|
||||
$("#downloads_pagination").html("<%= j will_paginate @downloads %>");
|
||||
Reference in New Issue
Block a user