effective_reports 0.4.3 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c1310984f02b38fe92ed745e1b3decac03570c4983f02ec7bab3399415f16a9
4
- data.tar.gz: 9522feef0ffc3a1b7c23d00ade2a50173ea9a170c7467cf642ba2e2d1a614d89
3
+ metadata.gz: bab0b4e74a447c50b3df13ac958875e0e0e8cb9bc450ccc7909dc4a76346f12c
4
+ data.tar.gz: 382eec07c9c0cff2acf158189e7efa6d206d7788abb71b6a8e781052163d1339
5
5
  SHA512:
6
- metadata.gz: ab1b8bc62be9ee353a9cd692beb62b6d7320703a38afd92a8a0c53111d85ca8896801fc073661da6acdc769d472a70069599eb4677b6e09740c9ebd6e6db95fd
7
- data.tar.gz: 9abcb961cadf7a7d5999d06adf2aa93490c00f77daa8df123da745db7876b1fa9fcf195f1644d0b4d22416942064a44c7a10d54acc40fcbdbda2811c7c631757
6
+ metadata.gz: 581576fbcb15d9f3245ca22643b21d9ea715a6d3ada1c908d17154d4eb09875b27329037fd43079cf63d27072f3455c7d8d9deba562b555cd86079cf9a2d8d51
7
+ data.tar.gz: ba9f71ac16a7ca0cc6f4cf45b8feee1cac60be99d12b782458e8c8ff01c9425a84ebf44c4241016ecea3b47880592d6a4b41ac10320bab2c2bfaee37c137a78c
@@ -0,0 +1,5 @@
1
+ .col-current_rows_count { width: 150px; }
2
+ .col-notifications { width: 50%; }
3
+ td.col-notifications { padding-left: 1.5rem; }
4
+ .col-notifications > .col-resource_item { display: list-item; list-style-type: disc; }
5
+
@@ -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 :id
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(:current_rows_count) do |report|
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
@@ -1,3 +1,3 @@
1
1
  module EffectiveReports
2
- VERSION = '0.4.3'.freeze
2
+ VERSION = '0.4.5'.freeze
3
3
  end
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.3
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: 2023-12-11 00:00:00.000000000 Z
11
+ date: 2024-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails