-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca0cda3
commit 57aca0f
Showing
32 changed files
with
220 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module Datum | ||
class Panel::DataExportsController < Panel::BaseController | ||
before_action :set_data_export, only: [:show, :edit, :update, :rebuild, :destroy] | ||
|
||
def index | ||
q_params = {} | ||
|
||
@data_exports = DataExport.default_where(q_params).page(params[:page]) | ||
end | ||
|
||
def sync | ||
DataExport.sync | ||
end | ||
|
||
def rebuild | ||
@data_export.rebuild! | ||
|
||
redirect_back fallback_location: data_exports_url | ||
end | ||
|
||
def just_run | ||
end | ||
|
||
private | ||
def set_data_export | ||
@data_export = DataExport.find params[:id] | ||
end | ||
|
||
def data_export_params | ||
result = params.fetch(:data_export, {}).permit( | ||
:type, | ||
:title, | ||
:comment, | ||
:data_table, | ||
:export_excel, | ||
:export_pdf, | ||
parameters: [:column, :value] #todo key is original method of hash | ||
) | ||
_params = result['parameters']&.values&.map { |i| {i['column'] => i['value'] } } | ||
_params = Array(_params).to_combine_h | ||
result['parameters'] = _params | ||
result | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module Datum | ||
class Panel::DataImportsController < Panel::BaseController | ||
before_action :set_data_import, only: [:show, :edit, :update, :rebuild, :destroy] | ||
|
||
def index | ||
q_params = {} | ||
|
||
@data_imports = DataImport.default_where(q_params).page(params[:page]) | ||
end | ||
|
||
def sync | ||
DataImport.sync | ||
end | ||
|
||
def rebuild | ||
@data_import.rebuild! | ||
|
||
redirect_back fallback_location: data_imports_url | ||
end | ||
|
||
def just_run | ||
end | ||
|
||
private | ||
def set_data_import | ||
@data_import = DataImport.find params[:id] | ||
end | ||
|
||
def data_import_params | ||
result = params.fetch(:data_import, {}).permit( | ||
:type, | ||
:title, | ||
:comment, | ||
:data_table, | ||
:export_excel, | ||
:export_pdf, | ||
parameters: [:column, :value] #todo key is original method of hash | ||
) | ||
_params = result['parameters']&.values&.map { |i| {i['column'] => i['value'] } } | ||
_params = Array(_params).to_combine_h | ||
result['parameters'] = _params | ||
result | ||
end | ||
|
||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Datum | ||
class Panel::HomeController < Panel::BaseController | ||
|
||
def index | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...ews/datum/panel/data_lists/_form.html.erb → ...s/datum/panel/data_exports/_form.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions
3
...ews/datum/panel/data_lists/index.html.erb → ...s/datum/panel/data_exports/index.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
<%= render 'data_bar' %> | ||
<%= render 'index_bar' %> | ||
<%= render 'index_actions' %> | ||
|
||
<%= render layout: 'index_table' do %> | ||
<%= render partial: 'index_tbody', layout: 'index_tr', collection: @data_lists, as: :model %> | ||
<%= render partial: 'index_tbody', layout: 'index_tr', collection: @data_exports, as: :model %> | ||
<% end %> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<%= button_to({ action: 'sync', **params.permit(:type) }, class: 'button is-small is-link') do %> | ||
<i class="fa-solid fa-plus"></i> | ||
<span class="pl-1"><%= t('.sync.title') %></span> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<%= form_with model: @data_list, scope: :data_list, url: { action: 'update' } do |f| %> | ||
<%= render partial: 'form', locals: { f: f } %> | ||
<%= render partial: 'com/extra/item', locals: { model: @data_list, f: f } %> | ||
<%= f.submit %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<%= f.text_field :title %> | ||
<%= f.text_area :comment %> | ||
<%= f.text_field :data_table %> | ||
<%= f.text_field :export_excel %> | ||
<%= f.text_field :export_pdf %> |
6 changes: 6 additions & 0 deletions
6
app/views/datum/panel/data_imports/_index/_index_tbody.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<td><%= link_to model.title, { controller: 'table_lists', data_list_id: model.id } %></td> | ||
<td><%= model.comment %></td> | ||
<td><%= model.data_table %></td> | ||
<td><%= model.export_excel %></td> | ||
<td><%= model.export_pdf %></td> | ||
<td><%= simple_format_hash(model.parameters) %></td> |
5 changes: 5 additions & 0 deletions
5
app/views/datum/panel/data_imports/_index/_index_thead.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<th><%= Datum::DataList.human_attribute_name(:title) %></th> | ||
<th><%= Datum::DataList.human_attribute_name(:comment) %></th> | ||
<th><%= Datum::DataList.human_attribute_name(:data_table) %></th> | ||
<th colspan="2">Export</th> | ||
<th><%= Datum::DataList.human_attribute_name(:parameters) %></th> |
18 changes: 18 additions & 0 deletions
18
app/views/datum/panel/data_imports/_index/_index_tr.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<% if !defined?(rails_role_user) || rails_role_user.has_role?(controller_path: 'datum/panel/data_lists', action_name: 'read', id: model.id) %> | ||
<tr id="tr_<%= model.id %>" data-controller="show" data-action="mouseenter->show#show mouseleave->show#hide"> | ||
<%= yield %> | ||
<td> | ||
<div data-show-target="item" style="visibility: hidden"> | ||
<%= button_to({ action: 'rebuild', id: model.id }, method: :patch, aria: { label: t('.rebuild'), turbo_confirm: t('.confirm') }, class: 'button is-small is-rounded is-light') do %> | ||
<i class="fa-solid fa-recycle has-text-warning"></i> | ||
<% end %> | ||
<%= button_to({ action: 'edit', id: model.id }, aria: { label: t('.edit.title') }, class: 'button is-small is-rounded is-light') do %> | ||
<i class="fa-solid fa-pencil has-text-link"></i> | ||
<% end %> | ||
<%= button_to({ action: 'destroy', id: model.id }, method: :delete, aria: { label: t('.destroy.title') }, data: { turbo_confirm: t('.confirm') }, class: 'button is-small is-rounded is-light') do %> | ||
<i class="fa-solid fa-trash has-text-danger"></i> | ||
<% end %> | ||
</div> | ||
</td> | ||
</tr> | ||
<% end %> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<%= render 'index_bar' %> | ||
<%= render 'index_actions' %> | ||
|
||
<%= render layout: 'index_table' do %> | ||
<%= render partial: 'index_tbody', layout: 'index_tr', collection: @data_imports, as: :model %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<ul class="breadcrumb"> | ||
<li><%= link_to 'back', :back %></li> | ||
</ul> | ||
|
||
<div class="page-header"> | ||
<h1>Table lists</h1> | ||
<%= link_to 'combine', combine_report_list_path(@report_list) %> | ||
</div> | ||
|
||
|
||
|
||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>ID</th> | ||
<th colspan="3"></th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
<% @table_lists.each do |table_list| %> | ||
<tr> | ||
<td><%= table_list.id %></td> | ||
<td><%= link_to 'Download Csv', report_list_table_list_path(@report_list, table_list, format: 'csv') %></td> | ||
<td><%= link_to 'Download Pdf', report_list_table_list_path(@report_list, table_list, format: 'pdf') %></td> | ||
<td><%= link_to 'destroy', report_list_table_list_path(@report_list, table_list), method: :delete, data: { confirm: 'Are you sure?' } %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters