Add local census importations controller

This commit is contained in:
Senén Rodero Rodríguez
2019-05-16 11:45:04 +02:00
committed by Javi Martín
parent 615bfadca8
commit 9b5f5e653a
13 changed files with 151 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
<%= form_for [:admin, @import] do |f| %>
<%= render "shared/errors", resource: @import %>
<%= f.file_field :file %>
<div class="small-12 medium-4 large-2 margin-top">
<%= f.submit(class: "button success expanded", value: t("shared.save")) %>
</div>
<% end %>

View File

@@ -0,0 +1,18 @@
<tr id="<%= dom_id(local_census_record) %>" class="local-census-record">
<td>
<%= local_census_record.document_type %>
<%= errors_for local_census_record, :document_type %>
</td>
<td>
<%= local_census_record.document_number %>
<%= errors_for local_census_record, :document_number %>
</td>
<td>
<%= l local_census_record.date_of_birth if local_census_record.date_of_birth.present? %>
<%= errors_for local_census_record, :date_of_birth %>
</td>
<td>
<%= local_census_record.postal_code %>
<%= errors_for local_census_record, :postal_code %>
</td>
</tr>

View File

@@ -0,0 +1,25 @@
<h4><%= title %> (<%= local_census_records.any? ? local_census_records.size : 0 %>)</h4>
<table id="<%= id %>" class="table table-striped">
<thead>
<tr>
<th><%= t("activerecord.attributes.local_census_record.document_type") %></th>
<th><%= t("activerecord.attributes.local_census_record.document_number") %></th>
<th><%= t("activerecord.attributes.local_census_record.date_of_birth") %></th>
<th><%= t("activerecord.attributes.local_census_record.postal_code") %></th>
</tr>
</thead>
<tbody>
<% if local_census_records.any? %>
<% local_census_records.each do |local_census_record| %>
<%= render "local_census_record", local_census_record: local_census_record %>
<% end %>
<% else %>
<tr>
<td colspan="4" style="width: 100% !important;">
<%= t("admin.local_census_records.imports.local_census_records.no_records_found") %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,7 @@
<%= back_link_to admin_local_census_records_path %>
<h2><%= t("admin.local_census_records.imports.new.title") %></h2>
<h3><%= t("admin.local_census_records.imports.new.subtitle") %></h3>
<%= render "form" %>

View File

@@ -0,0 +1,19 @@
<%= back_link_to(admin_local_census_records_path, text = t("shared.back")) %>
<br>
<h2 class="inline-block"><%= t("admin.local_census_records.imports.show.title") %></h2>
<%= link_to t("admin.local_census_records.imports.show.import"),
new_admin_local_census_records_import_path,
class: "button float-right hollow" %>
<h3><%= t("admin.local_census_records.imports.show.subtitle") %></h3>
<%= render partial: "local_census_records", locals: {
title: t("admin.local_census_records.imports.show.errored"),
id: "invalid-local-census-records",
local_census_records: @import.invalid_records } %>
<%= render partial: "local_census_records", locals: {
title: t("admin.local_census_records.imports.show.created"),
id: "created-local-census-records",
local_census_records: @import.created_records } %>