Report generation. Download csv

This commit is contained in:
German Galia
2019-06-12 10:17:31 +02:00
parent 139b2720d8
commit 9d1ca3bfd4
63 changed files with 1528 additions and 40 deletions

View File

@@ -0,0 +1,19 @@
<table>
<thead>
<tr>
<th><%= t("download.edit.fields") %></th>
<th><%= t("download.edit.description") %></th>
<th class="small"><%= t("download.edit.downloadable") %></th>
</tr>
</thead>
<tbody>
<% download_settings.each do |attr| %>
<tr>
<td><%= attr.name_field %></td>
<td><%= t("download.fielddescription.#{resource[:name]}.#{attr.name_field}", default: "") %></td>
<td class="text-center small"><%= check_box_tag "downloadable[]", attr.name_field, attr.downloadable, class: "js-download-settings-check" %></td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,30 @@
<% if params[:search].present? %>
<%= hidden_field_tag "search", params[:search] %>
<% end %>
<% if params[:commit].present? %>
<%= hidden_field_tag "commit", params[:commit] %>
<% end %>
<% if params[:filter].present? %>
<%= hidden_field_tag "filter", params[:filter] %>
<% end %>
<% if params[:page].present? %>
<%= hidden_field_tag "page", params[:page] %>
<% end %>
<% if params[:administrator_id].present? %>
<%= hidden_field_tag "administrator_id", params[:administrator_id] %>
<% end %>
<% if params[:valuator_or_group_id].present? %>
<%= hidden_field_tag "valuator_or_group_id", params[:valuator_or_group_id] %>
<% end %>
<% if params[:heading_id].present? %>
<%= hidden_field_tag "heading_id", params[:heading_id] %>
<% end %>
<% if params[:title_or_id].present? %>
<%= hidden_field_tag "title_or_id", params[:title_or_id] %>
<% end %>
<% if params[:tag_name].present? %>
<%= hidden_field_tag "tag_name", params[:tag_name] %>
<% end %>
<% if params[:min_total_supports].present? %>
<%= hidden_field_tag "min_total_supports", params[:min_total_supports] %>
<% end %>

View File

@@ -0,0 +1,13 @@
<div class="small reveal" id="download-modal" data-reveal>
<h1><%= t('download.modal.title') %></h1>
<%= form_tag current_path_with_query_params(format: :csv), method: :get do |f| %>
<%= render 'admin/download_settings/form_hidden_params' %>
<%= render 'admin/download_settings/form', resource: resource, download_settings: get_attrs(get_model(resource[:name])) %>
<div class="medium-5 column clear end">
<button type="submit" data-close id="js-download-modal-submit" class="button success expanded"><%= t("download.modal.submit") %></button>
</div>
<% end %>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">&times;</span>
</button>
</div>

View File

@@ -0,0 +1,16 @@
<% unless @download_settings.empty? %>
<% provide(:title) do %>
<%= t("admin.header.title") %> - <%= t("download.edit.#{@download_resource[:name]}") %>
<% end %>
<h2><%= t("download.edit.#{@download_resource[:name]}") %> <%= t("download.edit.config.#{@download_resource[:config].to_s}") unless @download_resource[:config] == 0 %></h2>
<%= form_tag admin_update_download_settings_path(resource: @download_resource[:name], config: @download_resource[:config]), method: :put do %>
<%= render 'form', resource: @download_resource, download_settings: @download_settings %>
<div class="small-12 medium-3 column clear end">
<%= submit_tag t("download.edit.submit"), class: "button success expanded" %>
</div>
<% end %>
<% end %>