rails_data 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +165 -0
- data/README.md +41 -0
- data/Rakefile +37 -0
- data/app/assets/config/rails_data_manifest.js +1 -0
- data/app/assets/javascripts/channels/done.js +10 -0
- data/app/assets/javascripts/controllers/the_data_admin/data_lists/edit.js +1 -0
- data/app/assets/javascripts/controllers/the_data_admin/data_lists/new.js +1 -0
- data/app/assets/javascripts/controllers/the_data_admin/table_lists/index.js +10 -0
- data/app/channels/done_channel.rb +7 -0
- data/app/channels/rails_data_connection.rb +29 -0
- data/app/controllers/rails_data_admin/base_controller.rb +3 -0
- data/app/controllers/rails_data_admin/data_lists_controller.rb +75 -0
- data/app/controllers/rails_data_admin/data_records_controller.rb +71 -0
- data/app/controllers/rails_data_admin/record_lists_controller.rb +105 -0
- data/app/controllers/rails_data_admin/table_lists_controller.rb +115 -0
- data/app/helpers/data_records_helper.rb +2 -0
- data/app/helpers/rails_data_helper.rb +21 -0
- data/app/jobs/table_job.rb +11 -0
- data/app/mailers/report_finish_mailer.rb +17 -0
- data/app/models/rails_data/concerns/data_cache_service.rb +26 -0
- data/app/models/rails_data/concerns/data_export_helper.rb +55 -0
- data/app/models/rails_data/concerns/data_import_helper.rb +40 -0
- data/app/models/rails_data/concerns/data_import_service.rb +35 -0
- data/app/models/rails_data/data_list.rb +47 -0
- data/app/models/rails_data/data_lists/data_export.rb +11 -0
- data/app/models/rails_data/data_lists/data_import.rb +11 -0
- data/app/models/rails_data/data_lists/data_record.rb +18 -0
- data/app/models/rails_data/export_services/csv_export_service.rb +24 -0
- data/app/models/rails_data/export_services/pdf_export_service.rb +74 -0
- data/app/models/rails_data/export_services/xlsx_export_service.rb +51 -0
- data/app/models/rails_data/record_list.rb +69 -0
- data/app/models/rails_data/table_item.rb +5 -0
- data/app/models/rails_data/table_list.rb +47 -0
- data/app/pdfs/concerns/pdf_page_helper.rb +37 -0
- data/app/pdfs/concerns/pdf_table_helper.rb +107 -0
- data/app/pdfs/concerns/pdf_text_helper.rb +18 -0
- data/app/pdfs/rails_data_pdf.rb +32 -0
- data/app/views/rails_data_admin/base/_nav.html.erb +9 -0
- data/app/views/rails_data_admin/data_lists/_item_form.html.erb +15 -0
- data/app/views/rails_data_admin/data_lists/add_item.js.erb +4 -0
- data/app/views/rails_data_admin/data_lists/edit.html.erb +33 -0
- data/app/views/rails_data_admin/data_lists/index.html.erb +43 -0
- data/app/views/rails_data_admin/data_lists/new.html.erb +17 -0
- data/app/views/rails_data_admin/data_lists/remove_item.js.erb +1 -0
- data/app/views/rails_data_admin/data_lists/reportable.html.erb +31 -0
- data/app/views/rails_data_admin/data_lists/show.html.erb +20 -0
- data/app/views/rails_data_admin/data_records/_item_form.html.erb +15 -0
- data/app/views/rails_data_admin/data_records/add_item.js.erb +4 -0
- data/app/views/rails_data_admin/data_records/edit.html.erb +33 -0
- data/app/views/rails_data_admin/data_records/index.html.erb +57 -0
- data/app/views/rails_data_admin/data_records/new.html.erb +16 -0
- data/app/views/rails_data_admin/data_records/remove_item.js.erb +1 -0
- data/app/views/rails_data_admin/data_records/reportable.html.erb +31 -0
- data/app/views/rails_data_admin/data_records/show.html.erb +20 -0
- data/app/views/rails_data_admin/record_lists/_edit_columns.html.erb +19 -0
- data/app/views/rails_data_admin/record_lists/_edit_table.erb +44 -0
- data/app/views/rails_data_admin/record_lists/_index.html.erb +22 -0
- data/app/views/rails_data_admin/record_lists/_search_form.html.erb +9 -0
- data/app/views/rails_data_admin/record_lists/_show.html.erb +16 -0
- data/app/views/rails_data_admin/record_lists/_table.html.erb +12 -0
- data/app/views/rails_data_admin/record_lists/edit.html.erb +19 -0
- data/app/views/rails_data_admin/record_lists/edit_columns.html.erb +30 -0
- data/app/views/rails_data_admin/record_lists/edit_columns.js.erb +9 -0
- data/app/views/rails_data_admin/record_lists/find.js.erb +8 -0
- data/app/views/rails_data_admin/record_lists/index.html.erb +52 -0
- data/app/views/rails_data_admin/record_lists/new.html.erb +19 -0
- data/app/views/rails_data_admin/record_lists/show.html.erb +19 -0
- data/app/views/rails_data_admin/record_lists/show.js.erb +8 -0
- data/app/views/rails_data_admin/record_lists/update_columns.js.erb +8 -0
- data/app/views/rails_data_admin/table_lists/_import.html.erb +17 -0
- data/app/views/rails_data_admin/table_lists/_index.html.erb +22 -0
- data/app/views/rails_data_admin/table_lists/_process.html.erb +5 -0
- data/app/views/rails_data_admin/table_lists/_show.html.erb +10 -0
- data/app/views/rails_data_admin/table_lists/_table.html.erb +38 -0
- data/app/views/rails_data_admin/table_lists/create_import.js.erb +8 -0
- data/app/views/rails_data_admin/table_lists/edit.html.erb +19 -0
- data/app/views/rails_data_admin/table_lists/find.js.erb +2 -0
- data/app/views/rails_data_admin/table_lists/index.html.erb +55 -0
- data/app/views/rails_data_admin/table_lists/new.html.erb +19 -0
- data/app/views/rails_data_admin/table_lists/new_import.js.erb +30 -0
- data/app/views/rails_data_admin/table_lists/run.js.erb +10 -0
- data/app/views/rails_data_admin/table_lists/show.html.erb +11 -0
- data/app/views/report_finish_mailer/finish_notify.text.erb +5 -0
- data/config/initializers/the_data.rb +4 -0
- data/config/locales/en.yml +10 -0
- data/config/locales/zh.yml +10 -0
- data/config/routes.rb +35 -0
- data/db/migrate/20150618053929_create_report_lists.rb +51 -0
- data/lib/rails_data/config.rb +23 -0
- data/lib/rails_data/engine.rb +18 -0
- data/lib/rails_data/export.rb +52 -0
- data/lib/rails_data/import.rb +42 -0
- data/lib/rails_data/record.rb +42 -0
- data/lib/rails_data/version.rb +3 -0
- data/lib/rails_data.rb +5 -0
- data/test/controllers/data_records_controller_test.rb +48 -0
- data/test/controllers/rails_data_admin/report_lists_controller_test.rb +49 -0
- data/test/controllers/rails_data_admin/table_lists_controller_test.rb +49 -0
- data/test/factories/combines.rb +7 -0
- data/test/factories/report_lists.rb +14 -0
- data/test/factories/table_items.rb +6 -0
- data/test/factories/table_lists.rb +6 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/models/data_list_test.rb +10 -0
- data/test/system/data_records_test.rb +41 -0
- data/test/test_helper.rb +21 -0
- data/test/the_data_test.rb +7 -0
- metadata +247 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
module PdfTableHelper
|
|
2
|
+
NORMAL_TH = {
|
|
3
|
+
align: :center,
|
|
4
|
+
valign: :center,
|
|
5
|
+
size: 14,
|
|
6
|
+
font_style: :bold,
|
|
7
|
+
height: 30,
|
|
8
|
+
background_color: 'eeeeee'
|
|
9
|
+
}
|
|
10
|
+
NORMAL_TD = {
|
|
11
|
+
align: :left,
|
|
12
|
+
valign: :center,
|
|
13
|
+
size: 12,
|
|
14
|
+
height: 30
|
|
15
|
+
}
|
|
16
|
+
LEFT_TD = {
|
|
17
|
+
align: :left,
|
|
18
|
+
valign: :center,
|
|
19
|
+
size: 12
|
|
20
|
+
}
|
|
21
|
+
RIGHT_TD = {
|
|
22
|
+
align: :right,
|
|
23
|
+
valign: :center,
|
|
24
|
+
size: 12
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
def left_header_table(data)
|
|
28
|
+
options = {
|
|
29
|
+
position: :center,
|
|
30
|
+
width: bounds.width,
|
|
31
|
+
cell_style: {
|
|
32
|
+
border_lines: [:solid, :solid, :dashed, :solid]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
undash
|
|
36
|
+
table(data, options) do
|
|
37
|
+
columns(0).style NORMAL_TH
|
|
38
|
+
columns(1..-1).style NORMAL_TD
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def top_header_table(data)
|
|
43
|
+
options = {
|
|
44
|
+
position: :center,
|
|
45
|
+
width: bounds.width,
|
|
46
|
+
cell_style: {
|
|
47
|
+
border_lines: [:solid, :solid, :dashed, :solid]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
undash
|
|
51
|
+
table(data, options) do
|
|
52
|
+
row(0).style NORMAL_TH
|
|
53
|
+
row(1..-1).style NORMAL_TD
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def grid_table(data, options = {})
|
|
58
|
+
default_options = {
|
|
59
|
+
position: :center,
|
|
60
|
+
width: bounds.width,
|
|
61
|
+
cell_style: {
|
|
62
|
+
borders: []
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
default_options.merge!(options)
|
|
66
|
+
undash
|
|
67
|
+
table(data, default_options) do
|
|
68
|
+
columns(0).style LEFT_TD
|
|
69
|
+
columns(-1).style RIGHT_TD
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def content_table(data, options = {}, &block)
|
|
74
|
+
default_options = {
|
|
75
|
+
position: :center,
|
|
76
|
+
width: bounds.width,
|
|
77
|
+
cell_style: {
|
|
78
|
+
border_lines: [:solid, :solid, :solid, :solid],
|
|
79
|
+
border_color: '999999'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
default_options.merge!(options)
|
|
83
|
+
undash
|
|
84
|
+
if block_given?
|
|
85
|
+
table(data, default_options, &block)
|
|
86
|
+
else
|
|
87
|
+
table(data, default_options) do
|
|
88
|
+
row(0..-1).style NORMAL_TD
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def footer_table(data)
|
|
94
|
+
options = {
|
|
95
|
+
position: :center,
|
|
96
|
+
width: bounds.width,
|
|
97
|
+
cell_style: {
|
|
98
|
+
borders: []
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
undash
|
|
102
|
+
table(data, options) do
|
|
103
|
+
columns(0..-1).style NORMAL_TD
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'prawn'
|
|
2
|
+
require 'prawn/measurement_extensions'
|
|
3
|
+
|
|
4
|
+
class RailsDataPdf < Prawn::Document
|
|
5
|
+
|
|
6
|
+
def initialize
|
|
7
|
+
default_config = {
|
|
8
|
+
page_size: 'A4'
|
|
9
|
+
}
|
|
10
|
+
super(default_config)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def run
|
|
14
|
+
return self unless self.empty?
|
|
15
|
+
|
|
16
|
+
once_header beginning_data if beginning_data
|
|
17
|
+
repeat_header header_data if header_data
|
|
18
|
+
table_data.each_with_index do |value, index|
|
|
19
|
+
start_new_page unless index == 0
|
|
20
|
+
custom_table value
|
|
21
|
+
end
|
|
22
|
+
once_footer ending_data if ending_data
|
|
23
|
+
repeat_footer footer_data if footer_data
|
|
24
|
+
self
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# todo hack for a bug, need confirm ?
|
|
28
|
+
def empty?
|
|
29
|
+
page.content.stream.length <= 2
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<div class="ui fluid vertical menu">
|
|
2
|
+
<div class="item">
|
|
3
|
+
<span>Report Management</span>
|
|
4
|
+
<div class="menu">
|
|
5
|
+
<%= link_to 'Report', data_lists_path, class: active_helper(controller: 'data_lists') %>
|
|
6
|
+
<%= link_to 'Record', data_records_path, class: active_helper(controller: 'data_records') %>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="inline fields" id="parameters_<%= params[:index] %>">
|
|
2
|
+
<label class="six wide field"></label>
|
|
3
|
+
<%= f.fields :parameters, index: params[:index], on: { wrapper_all: false, label: false, placeholder: true }, css: { wrapper_input: 'two wide field' } do |pf| %>
|
|
4
|
+
<%= pf.text_field :key %>
|
|
5
|
+
<%= pf.select :value, options_for_select(TheData.config.mapping.keys), class: 'ui dropdown selection' %>
|
|
6
|
+
<div class="field">
|
|
7
|
+
<%= link_to add_item_data_lists_path(index: params[:index].to_i + 1), remote: true do %>
|
|
8
|
+
<i class="plus circle icon"></i>
|
|
9
|
+
<% end %>
|
|
10
|
+
<%= link_to remove_item_data_lists_path(index: params[:index].to_i), remote: true do %>
|
|
11
|
+
<i class="minus circle icon"></i>
|
|
12
|
+
<% end %>
|
|
13
|
+
</div>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<div class="ui segment breadcrumb">
|
|
2
|
+
<%= link_to 'Back', data_lists_path, class: 'section' %>
|
|
3
|
+
<div class="divider"> / </div>
|
|
4
|
+
<div class="active section">Edit</div>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="ui segment">
|
|
8
|
+
<%= form_with model: @data_list, scope: :data_list, url: data_list_path(@data_list), locale: true do |f| %>
|
|
9
|
+
<%= f.text_field :title %>
|
|
10
|
+
<%= f.text_area :comment %>
|
|
11
|
+
<%= f.text_field :data_table %>
|
|
12
|
+
<%= f.text_field :export_excel %>
|
|
13
|
+
<%= f.text_field :export_pdf %>
|
|
14
|
+
<% @data_list.form_parameters.each_with_index do |parameter, index| %>
|
|
15
|
+
<%= f.fields :parameters, model: parameter, index: index, on: { wrapper_all: false, label: false, placeholder: true }, css: { wrapper_input: 'two wide field' } do |pf| %>
|
|
16
|
+
<div class="inline fields" id="parameters_<%= index %>">
|
|
17
|
+
<%= f.label :form_parameters %>
|
|
18
|
+
<%= pf.text_field :key, value: parameter.key, readonly: true %>
|
|
19
|
+
<%= pf.select :value, options_for_select(TheData.config.mapping.keys, parameter.value), class: 'ui dropdown selection' %>
|
|
20
|
+
<div class="field">
|
|
21
|
+
<%= link_to add_item_data_lists_path(index: index + 1), remote: true do %>
|
|
22
|
+
<i class="plus circle icon"></i>
|
|
23
|
+
<% end %>
|
|
24
|
+
<%= link_to remove_item_data_lists_path(index: index), remote: true do %>
|
|
25
|
+
<i class="minus circle icon"></i>
|
|
26
|
+
<% end %>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<% end %>
|
|
30
|
+
<% end %>
|
|
31
|
+
<%= f.submit %>
|
|
32
|
+
<% end %>
|
|
33
|
+
</div>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<div class="ui top attached borderless menu">
|
|
2
|
+
<div class="item header">Data List</div>
|
|
3
|
+
<%= link_to 'Export', filter_params(type: 'DataExport'), class: active_params(type: 'DataExport', active_class: 'item active', item_class: 'item') %>
|
|
4
|
+
<%= link_to 'Import', filter_params(type: 'DataImport'), class: active_params(type: 'DataImport', active_class: 'item active', item_class: 'item') %>
|
|
5
|
+
<div class="right menu">
|
|
6
|
+
<div class="item">
|
|
7
|
+
<%= link_to 'New', new_data_list_path(type: params[:type]), class: 'ui teal button' %>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<table class="ui bottom attached table">
|
|
13
|
+
<thead>
|
|
14
|
+
<tr>
|
|
15
|
+
<th>ID</th>
|
|
16
|
+
<th>Title</th>
|
|
17
|
+
<th>Note</th>
|
|
18
|
+
<th>Job Name</th>
|
|
19
|
+
<th colspan="2">Export</th>
|
|
20
|
+
<th>Parameters</th>
|
|
21
|
+
<th colspan="3"></th>
|
|
22
|
+
</tr>
|
|
23
|
+
</thead>
|
|
24
|
+
|
|
25
|
+
<tbody>
|
|
26
|
+
<% @data_lists.each do |data_list| %>
|
|
27
|
+
<% if the_role_user.has_role?('the_data/data_lists', 'read', data_list.id) %>
|
|
28
|
+
<tr>
|
|
29
|
+
<td><%= data_list.id %></td>
|
|
30
|
+
<td><%= data_list.title %></td>
|
|
31
|
+
<td><%= data_list.comment %></td>
|
|
32
|
+
<td><%= data_list.data_table %></td>
|
|
33
|
+
<td><%= data_list.export_excel %></td>
|
|
34
|
+
<td><%= data_list.export_pdf %></td>
|
|
35
|
+
<td><%= simple_format_hash(data_list.parameters) %></td>
|
|
36
|
+
<td><%= link_to 'table list', data_list_table_lists_path(data_list) %></td>
|
|
37
|
+
<td><%= link_to 'edit', edit_data_list_path(data_list) %></td>
|
|
38
|
+
<td><%= link_to 'delete', data_list_path(data_list), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
39
|
+
</tr>
|
|
40
|
+
<% end %>
|
|
41
|
+
<% end %>
|
|
42
|
+
</tbody>
|
|
43
|
+
</table>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div class="ui segment breadcrumb">
|
|
2
|
+
<%= link_to 'Back', data_lists_path, class: 'section' %>
|
|
3
|
+
<div class="divider"> / </div>
|
|
4
|
+
<div class="active section">New</div>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="ui segment">
|
|
8
|
+
<%= form_with model: @data_list, scope: :data_list, url: data_lists_path, local: true do |f| %>
|
|
9
|
+
<%= f.select :type, options_for_select(DataList.options_i18n(:type), @data_list.type) %>
|
|
10
|
+
<%= f.text_field :title %>
|
|
11
|
+
<%= f.text_area :comment %>
|
|
12
|
+
<%= f.text_field :data_table %>
|
|
13
|
+
<%= f.text_field :export_excel %>
|
|
14
|
+
<%= f.text_field :export_pdf %>
|
|
15
|
+
<%= f.submit %>
|
|
16
|
+
<% end %>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$('#parameters_<%= params[:index] %>').remove();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<ul class="breadcrumb">
|
|
2
|
+
<li><%= link_to 'back', :back %></li>
|
|
3
|
+
</ul>
|
|
4
|
+
|
|
5
|
+
<div class="page-header">
|
|
6
|
+
<h1>Table lists</h1>
|
|
7
|
+
<%= link_to 'combine', combine_report_list_path(@report_list) %>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<table class="table table-striped">
|
|
13
|
+
<thead>
|
|
14
|
+
<tr>
|
|
15
|
+
<th>ID</th>
|
|
16
|
+
<th colspan="3"></th>
|
|
17
|
+
</tr>
|
|
18
|
+
</thead>
|
|
19
|
+
|
|
20
|
+
<tbody>
|
|
21
|
+
<% @table_lists.each do |table_list| %>
|
|
22
|
+
<tr>
|
|
23
|
+
<td><%= table_list.id %></td>
|
|
24
|
+
<td><%= link_to 'Download Csv', report_list_table_list_path(@report_list, table_list, format: 'csv') %></td>
|
|
25
|
+
<td><%= link_to 'Download Pdf', report_list_table_list_path(@report_list, table_list, format: 'pdf') %></td>
|
|
26
|
+
<td><%= link_to 'destroy', report_list_table_list_path(@report_list, table_list), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
27
|
+
</tr>
|
|
28
|
+
<% end %>
|
|
29
|
+
</tbody>
|
|
30
|
+
</table>
|
|
31
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<%= stylesheet_link_tag 'one_report/application', media: 'all' %>
|
|
2
|
+
<%= javascript_include_tag 'one_report/application' %>
|
|
3
|
+
|
|
4
|
+
<div class="ui segment"></div>
|
|
5
|
+
|
|
6
|
+
<div class="ui segment">
|
|
7
|
+
<ul class="ui breadcrumb">
|
|
8
|
+
<li class="section"><%= link_to 'back', :back %></li>
|
|
9
|
+
</ul>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="ui segment">
|
|
13
|
+
<div class="page-header">
|
|
14
|
+
<h1>Table lists</h1>
|
|
15
|
+
<%= link_to 'download', report_list_path(@report_list, format: 'pdf') %>
|
|
16
|
+
<%= link_to 'preview', report_list_table_lists_path(@report_list) %>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="inline fields" id="parameters_<%= params[:index] %>">
|
|
2
|
+
<label class="six wide field"></label>
|
|
3
|
+
<%= f.fields :parameters, index: params[:index], on: { wrapper_all: false, label: false, placeholder: true }, css: { wrapper_input: 'two wide field' } do |pf| %>
|
|
4
|
+
<%= pf.text_field :key %>
|
|
5
|
+
<%= pf.select :value, options_for_select(TheData.config.mapping.keys), class: 'ui dropdown selection' %>
|
|
6
|
+
<div class="field">
|
|
7
|
+
<%= link_to add_item_data_lists_path(index: params[:index].to_i + 1), remote: true do %>
|
|
8
|
+
<i class="plus circle icon"></i>
|
|
9
|
+
<% end %>
|
|
10
|
+
<%= link_to remove_item_data_lists_path(index: params[:index].to_i), remote: true do %>
|
|
11
|
+
<i class="minus circle icon"></i>
|
|
12
|
+
<% end %>
|
|
13
|
+
</div>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<div class="ui segment breadcrumb">
|
|
2
|
+
<%= link_to 'Back', data_records_path, class: 'section' %>
|
|
3
|
+
<div class="divider"> / </div>
|
|
4
|
+
<div class="active section">Edit</div>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="ui segment">
|
|
8
|
+
<%= form_with model: @data_record, scope: :data_record, url: data_record_path(@data_record), locale: true do |f| %>
|
|
9
|
+
<%= f.text_field :title %>
|
|
10
|
+
<%= f.text_area :comment %>
|
|
11
|
+
<%= f.text_field :data_table %>
|
|
12
|
+
<%= f.text_field :export_excel %>
|
|
13
|
+
<%= f.text_field :export_pdf %>
|
|
14
|
+
<% @data_record.form_parameters.each_with_index do |parameter, index| %>
|
|
15
|
+
<%= f.fields :parameters, model: parameter, index: index, on: {wrapper_all: false, label: false, placeholder: true}, css: {wrapper_input: 'two wide field'} do |pf| %>
|
|
16
|
+
<div class="inline fields" id="parameters_<%= index %>">
|
|
17
|
+
<%= f.label :form_parameters %>
|
|
18
|
+
<%= pf.text_field :key, readonly: true %>
|
|
19
|
+
<%= pf.select :value, options_for_select(TheData.config.mapping.keys, parameter.value), class: 'ui dropdown selection' %>
|
|
20
|
+
<div class="field">
|
|
21
|
+
<%= link_to add_item_data_records_path(index: index + 1), remote: true do %>
|
|
22
|
+
<i class="plus circle icon"></i>
|
|
23
|
+
<% end %>
|
|
24
|
+
<%= link_to remove_item_data_records_path(index: index), remote: true do %>
|
|
25
|
+
<i class="minus circle icon"></i>
|
|
26
|
+
<% end %>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<% end %>
|
|
30
|
+
<% end %>
|
|
31
|
+
<%= f.submit %>
|
|
32
|
+
<% end %>
|
|
33
|
+
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<div class="ui top attached menu borderless">
|
|
2
|
+
<div class="item header">Data List</div>
|
|
3
|
+
<%= link_to 'Record', data_records_path, class: active_helper(controllers: 'data_records') %>
|
|
4
|
+
<div class="right menu">
|
|
5
|
+
<div class="item">
|
|
6
|
+
<%= link_to 'New', new_data_record_path, class: 'ui teal button' %>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<table class="ui bottom attached table">
|
|
12
|
+
<thead>
|
|
13
|
+
<tr>
|
|
14
|
+
<th><%= DataList.human_attribute_name(:id) %></th>
|
|
15
|
+
<th>
|
|
16
|
+
<p><%= DataList.human_attribute_name(:title) %></p>
|
|
17
|
+
<p><%= DataList.human_attribute_name(:comment) %></p>
|
|
18
|
+
</th>
|
|
19
|
+
<th><%= DataList.human_attribute_name(:data_table) %></th>
|
|
20
|
+
<th>
|
|
21
|
+
<p><%= DataList.human_attribute_name(:export_excel) %></p>
|
|
22
|
+
<p><%= DataList.human_attribute_name(:export_pdf) %></p>
|
|
23
|
+
</th>
|
|
24
|
+
<th>Parameters</th>
|
|
25
|
+
<th>Columns</th>
|
|
26
|
+
<th></th>
|
|
27
|
+
<th>Actions</th>
|
|
28
|
+
</tr>
|
|
29
|
+
</thead>
|
|
30
|
+
|
|
31
|
+
<tbody>
|
|
32
|
+
<% @data_records.each do |data_record| %>
|
|
33
|
+
<% if the_role_user.has_role?('the_data/data_records', 'read', data_record.id) %>
|
|
34
|
+
<tr>
|
|
35
|
+
<td><%= data_record.id %></td>
|
|
36
|
+
<td>
|
|
37
|
+
<p><%= data_record.title %></p>
|
|
38
|
+
<p><%= data_record.comment %></p>
|
|
39
|
+
</td>
|
|
40
|
+
<td>
|
|
41
|
+
<p><%= data_record.data_table %></p>
|
|
42
|
+
<p><%= data_record.export_excel %></p>
|
|
43
|
+
</td>
|
|
44
|
+
<td><%= data_record.export_pdf %></td>
|
|
45
|
+
<td><%= simple_format_hash(data_record.parameters) %></td>
|
|
46
|
+
<td><%= simple_format_hash(data_record.columns) %></td>
|
|
47
|
+
<td><%= link_to 'record list', data_record_record_lists_path(data_record) %></td>
|
|
48
|
+
<td class="ui labels">
|
|
49
|
+
<%= link_to 'Edit', edit_data_record_path(data_record), class: 'ui green label' %>
|
|
50
|
+
<%= link_to 'Rebuild', rebuild_data_record_path(data_record), method: :patch, data: { confirm: 'Confirm' }, class: 'ui blue label' %>
|
|
51
|
+
<%= link_to 'Delete', data_record_path(data_record), method: :delete, data: { confirm: 'Are you sure?' }, class: 'ui red label' %>
|
|
52
|
+
</td>
|
|
53
|
+
</tr>
|
|
54
|
+
<% end %>
|
|
55
|
+
<% end %>
|
|
56
|
+
</tbody>
|
|
57
|
+
</table>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<div class="ui segment breadcrumb">
|
|
2
|
+
<%= link_to 'Back', data_records_path, class: 'section' %>
|
|
3
|
+
<div class="divider"> / </div>
|
|
4
|
+
<div class="active section">New</div>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="ui segment">
|
|
8
|
+
<%= form_with model: @data_record, scope: :data_record, url: data_records_path, local: true do |f| %>
|
|
9
|
+
<%= f.text_field :title %>
|
|
10
|
+
<%= f.text_area :comment %>
|
|
11
|
+
<%= f.text_field :data_table %>
|
|
12
|
+
<%= f.text_field :export_excel %>
|
|
13
|
+
<%= f.text_field :export_pdf %>
|
|
14
|
+
<%= f.submit %>
|
|
15
|
+
<% end %>
|
|
16
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$('#parameters_<%= params[:index] %>').remove();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<ul class="breadcrumb">
|
|
2
|
+
<li><%= link_to 'back', :back %></li>
|
|
3
|
+
</ul>
|
|
4
|
+
|
|
5
|
+
<div class="page-header">
|
|
6
|
+
<h1>Table lists</h1>
|
|
7
|
+
<%= link_to 'combine', combine_report_list_path(@report_list) %>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<table class="table table-striped">
|
|
13
|
+
<thead>
|
|
14
|
+
<tr>
|
|
15
|
+
<th>ID</th>
|
|
16
|
+
<th colspan="3"></th>
|
|
17
|
+
</tr>
|
|
18
|
+
</thead>
|
|
19
|
+
|
|
20
|
+
<tbody>
|
|
21
|
+
<% @table_lists.each do |table_list| %>
|
|
22
|
+
<tr>
|
|
23
|
+
<td><%= table_list.id %></td>
|
|
24
|
+
<td><%= link_to 'Download Csv', report_list_table_list_path(@report_list, table_list, format: 'csv') %></td>
|
|
25
|
+
<td><%= link_to 'Download Pdf', report_list_table_list_path(@report_list, table_list, format: 'pdf') %></td>
|
|
26
|
+
<td><%= link_to 'destroy', report_list_table_list_path(@report_list, table_list), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
27
|
+
</tr>
|
|
28
|
+
<% end %>
|
|
29
|
+
</tbody>
|
|
30
|
+
</table>
|
|
31
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<%= stylesheet_link_tag 'one_report/application', media: 'all' %>
|
|
2
|
+
<%= javascript_include_tag 'one_report/application' %>
|
|
3
|
+
|
|
4
|
+
<div class="ui segment"></div>
|
|
5
|
+
|
|
6
|
+
<div class="ui segment">
|
|
7
|
+
<ul class="ui breadcrumb">
|
|
8
|
+
<li class="section"><%= link_to 'back', :back %></li>
|
|
9
|
+
</ul>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="ui segment">
|
|
13
|
+
<div class="page-header">
|
|
14
|
+
<h1>Table lists</h1>
|
|
15
|
+
<%= link_to 'download', report_list_path(@report_list, format: 'pdf') %>
|
|
16
|
+
<%= link_to 'preview', report_list_table_lists_path(@report_list) %>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div class="ui modal">
|
|
2
|
+
<i class="close icon"></i>
|
|
3
|
+
<div class="ui header blue">
|
|
4
|
+
预览
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="content">
|
|
8
|
+
<div class="ui basic segment">
|
|
9
|
+
<%= link_to 'download Xlsx', data_record_record_list_path(@data_record, @record_list, format: 'xlsx'), class: 'ui mini blue button' %>
|
|
10
|
+
<%= link_to 'Edit', columns_data_record_record_list_path(@data_record, @record_list), class: 'ui green label', remote: true %>
|
|
11
|
+
</div>
|
|
12
|
+
<%= render 'edit_table' %>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<table class="ui very basic striped table">
|
|
2
|
+
<thead>
|
|
3
|
+
<tr>
|
|
4
|
+
<th><%= form_with url: columns_data_record_record_list_path(@data_record), method: :patch, id: 'edit_record_list' %></th>
|
|
5
|
+
<th></th>
|
|
6
|
+
</tr>
|
|
7
|
+
</thead>
|
|
8
|
+
|
|
9
|
+
<tbody>
|
|
10
|
+
<% @record_list.columns.each do |k, v| %>
|
|
11
|
+
|
|
12
|
+
<% if TheData.config.mapping[@data_record.columns[k.to_sym].to_s.to_sym]&.fetch(:input, nil) == 'array' %>
|
|
13
|
+
<tr>
|
|
14
|
+
<td class="right aligned"><%= k.to_s.titleize %></td>
|
|
15
|
+
<td>
|
|
16
|
+
<% v.each_with_index do |_value, _index| %>
|
|
17
|
+
<div class="ui attached segment">
|
|
18
|
+
<% _value.each do |_k, _v| %>
|
|
19
|
+
<div class="ui small input"><%= text_field_tag "columns[#{k}][][#{_k}]", _v, form: 'edit_record_list' %></div>
|
|
20
|
+
<% end %>
|
|
21
|
+
</div>
|
|
22
|
+
<% end %>
|
|
23
|
+
</td>
|
|
24
|
+
</tr>
|
|
25
|
+
<% else %>
|
|
26
|
+
<tr>
|
|
27
|
+
<td class="right aligned"><%= k.to_s.titleize %>:</td>
|
|
28
|
+
<td class="ui small input">
|
|
29
|
+
<%= text_field_tag :"columns[#{k}]", v, as: @data_record.columns[k.to_sym], form: 'edit_record_list' %>
|
|
30
|
+
</td>
|
|
31
|
+
</tr>
|
|
32
|
+
<% end %>
|
|
33
|
+
|
|
34
|
+
<% end %>
|
|
35
|
+
<tr>
|
|
36
|
+
<td></td>
|
|
37
|
+
<td>
|
|
38
|
+
<%= submit_tag 'Save', form: 'edit_record_list', class: 'ui mina blue button' %>
|
|
39
|
+
<%= link_to 'Cancel', data_record_record_list_path(@record_list.data_record_id, @record_list.id), remote: true, class: 'ui mina grey button' %>
|
|
40
|
+
</td>
|
|
41
|
+
</tr>
|
|
42
|
+
</tbody>
|
|
43
|
+
|
|
44
|
+
</table>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<table class="table table-striped">
|
|
2
|
+
<thead>
|
|
3
|
+
<tr>
|
|
4
|
+
<th>ID</th>
|
|
5
|
+
<th colspan="4"></th>
|
|
6
|
+
</tr>
|
|
7
|
+
</thead>
|
|
8
|
+
|
|
9
|
+
<tbody>
|
|
10
|
+
<% @table_lists.each do |table_list| %>
|
|
11
|
+
<tr>
|
|
12
|
+
<td><%= table_list.id %></td>
|
|
13
|
+
<td><%= link_to 'Download Csv', report_list_table_list_path(@report_list, table_list, format: 'csv') %></td>
|
|
14
|
+
<td><%= link_to 'Download Pdf', report_list_table_list_path(@report_list, table_list, format: 'pdf') %></td>
|
|
15
|
+
<td><%= link_to 'Download row Pdf', row_report_list_table_list_path(@report_list, table_list, format: 'pdf') %></td>
|
|
16
|
+
<td><%= link_to 'destroy', report_list_table_list_path(@report_list, table_list), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
17
|
+
</tr>
|
|
18
|
+
<% end %>
|
|
19
|
+
</tbody>
|
|
20
|
+
</table>
|
|
21
|
+
|
|
22
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= search_form_with css: { wrapper_all: 'inline field', wrapper_input: 'field', wrapper_submit: 'field', submit: 'ui green button'} do |f| %>
|
|
2
|
+
<div class="fields">
|
|
3
|
+
<% @data_record.parameters.keys.each do |extra| %>
|
|
4
|
+
<%= f.text_field extra, placeholder: extra %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<%= f.submit 'Search' %>
|
|
7
|
+
</div>
|
|
8
|
+
<% end %>
|
|
9
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<div class="ui modal">
|
|
2
|
+
<i class="close icon"></i>
|
|
3
|
+
<div class="ui header blue">
|
|
4
|
+
预览
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div class="content">
|
|
8
|
+
<div class="ui basic segment">
|
|
9
|
+
<%= link_to 'download Xlsx', data_record_record_list_path(@data_record, @record_list, format: 'xlsx'), class: 'ui mini blue button' %>
|
|
10
|
+
<%= link_to 'Download pdf', data_record_record_list_path(@data_record, @record_list, format: 'pdf', disposition: 'attachment'), class: 'ui label' %>
|
|
11
|
+
<%= link_to 'Edit', columns_data_record_record_list_path(@data_record, @record_list), class: 'ui green label', remote: true %>
|
|
12
|
+
</div>
|
|
13
|
+
<%= render 'table' %>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
</div>
|