effective_reports 0.4.3 → 0.4.5
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 +4 -4
- data/app/assets/stylesheets/effective_reports/base.scss +5 -0
- data/app/controllers/admin/reports_controller.rb +4 -0
- data/app/datatables/admin/effective_reports_datatable.rb +5 -3
- data/app/models/effective/report.rb +18 -0
- data/lib/effective_reports/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bab0b4e74a447c50b3df13ac958875e0e0e8cb9bc450ccc7909dc4a76346f12c
|
4
|
+
data.tar.gz: 382eec07c9c0cff2acf158189e7efa6d206d7788abb71b6a8e781052163d1339
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 581576fbcb15d9f3245ca22643b21d9ea715a6d3ada1c908d17154d4eb09875b27329037fd43079cf63d27072f3455c7d8d9deba562b555cd86079cf9a2d8d51
|
7
|
+
data.tar.gz: ba9f71ac16a7ca0cc6f4cf45b8feee1cac60be99d12b782458e8c8ff01c9425a84ebf44c4241016ecea3b47880592d6a4b41ac10320bab2c2bfaee37c137a78c
|
@@ -5,6 +5,10 @@ module Admin
|
|
5
5
|
|
6
6
|
include Effective::CrudController
|
7
7
|
|
8
|
+
submit :save, 'Save'
|
9
|
+
submit :save, 'Save and View', redirect: -> { effective_reports.admin_report_path(resource) }
|
10
|
+
submit :save, 'Duplicate', only: :edit, redirect: -> { effective_reports.new_admin_report_path(duplicate_id: resource.id) }
|
11
|
+
|
8
12
|
private
|
9
13
|
|
10
14
|
def permitted_params
|
@@ -2,14 +2,16 @@ module Admin
|
|
2
2
|
class EffectiveReportsDatatable < Effective::Datatable
|
3
3
|
|
4
4
|
datatable do
|
5
|
-
order :
|
5
|
+
order :updated_at
|
6
|
+
|
6
7
|
col :id, visible: false
|
7
8
|
|
9
|
+
col :updated_at, visible: false
|
8
10
|
col :created_at, visible: false
|
9
11
|
col :created_by, visible: false
|
10
12
|
|
11
13
|
col :title
|
12
|
-
col :description
|
14
|
+
col :description, visible: false
|
13
15
|
|
14
16
|
col :reportable_class_name, label: 'Resource', search: EffectiveReports.reportable_classes.map(&:to_s), visible: false
|
15
17
|
|
@@ -20,7 +22,7 @@ module Admin
|
|
20
22
|
col :notifications, label: 'Notifications'
|
21
23
|
end
|
22
24
|
|
23
|
-
col
|
25
|
+
col :current_rows_count, label: 'Count' do |report|
|
24
26
|
report.collection().count
|
25
27
|
end
|
26
28
|
|
@@ -116,6 +116,24 @@ module Effective
|
|
116
116
|
scopes
|
117
117
|
end
|
118
118
|
|
119
|
+
def duplicate
|
120
|
+
Effective::Report.new(attributes.except('id', 'updated_at', 'created_at')).tap do |report|
|
121
|
+
report.title = title + ' (Copy)'
|
122
|
+
|
123
|
+
report_columns.each do |report_column|
|
124
|
+
report.report_columns.build(report_column.attributes.except('id', 'updated_at', 'created_at'))
|
125
|
+
end
|
126
|
+
|
127
|
+
report_scopes.each do |report_scope|
|
128
|
+
report.report_scopes.build(report_scope.attributes.except('id', 'updated_at', 'created_at'))
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def duplicate!
|
134
|
+
duplicate.tap { |event| event.save! }
|
135
|
+
end
|
136
|
+
|
119
137
|
# The klass to base the collection from
|
120
138
|
def collection
|
121
139
|
collection = reportable.all
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_reports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|