spotlight_search 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +75 -64
- data/README.md +51 -20
- data/app/controllers/spotlight_search/export_jobs_controller.rb +7 -7
- data/app/jobs/spotlight_search/export_job.rb +14 -17
- data/app/mailers/spotlight_search/export_mailer.rb +6 -0
- data/app/views/spotlight_search/export_mailer/send_error_message.html.erb +7 -0
- data/lib/spotlight_search/exportable_columns_v2.rb +2 -14
- data/lib/spotlight_search/helpers.rb +14 -7
- data/lib/spotlight_search/utils.rb +1 -1
- data/lib/spotlight_search/version.rb +1 -1
- data/spotlight_search.gemspec +2 -2
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54325c91322549c86a04e26eb6dd5872f24aa8d898e9d7310342df5de1a486fb
|
4
|
+
data.tar.gz: 5061e4fcfac405f679a51f5059eb814ee7dfc582a16ccc118e6dff1ad18a0ac5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7734aa0197053178b3f40492016aa07bc7a5cd72117b976be40cb89bcdfaf8d855c93136bda421bf270e643d441fecb55c669e9f132bc5722a1f87947e2287b8
|
7
|
+
data.tar.gz: f4b3b1ad28f0d9859e9c52a82fe098c61e21c1262b087b537b5df80d8f67d5e91b8ccdbb3f1b6015dc2bf243688ed698e899675d000489559d981debd18b2235
|
data/Gemfile.lock
CHANGED
@@ -1,103 +1,112 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
spotlight_search (0.1.
|
4
|
+
spotlight_search (0.1.9)
|
5
5
|
axlsx
|
6
|
+
zip-zip
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
actioncable (5.
|
11
|
-
actionpack (= 5.
|
12
|
-
nio4r (
|
13
|
-
websocket-driver (
|
14
|
-
actionmailer (5.
|
15
|
-
actionpack (= 5.
|
16
|
-
actionview (= 5.
|
17
|
-
activejob (= 5.
|
11
|
+
actioncable (5.2.4.2)
|
12
|
+
actionpack (= 5.2.4.2)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailer (5.2.4.2)
|
16
|
+
actionpack (= 5.2.4.2)
|
17
|
+
actionview (= 5.2.4.2)
|
18
|
+
activejob (= 5.2.4.2)
|
18
19
|
mail (~> 2.5, >= 2.5.4)
|
19
20
|
rails-dom-testing (~> 2.0)
|
20
|
-
actionpack (5.
|
21
|
-
actionview (= 5.
|
22
|
-
activesupport (= 5.
|
23
|
-
rack (~> 2.0)
|
24
|
-
rack-test (
|
21
|
+
actionpack (5.2.4.2)
|
22
|
+
actionview (= 5.2.4.2)
|
23
|
+
activesupport (= 5.2.4.2)
|
24
|
+
rack (~> 2.0, >= 2.0.8)
|
25
|
+
rack-test (>= 0.6.3)
|
25
26
|
rails-dom-testing (~> 2.0)
|
26
27
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
-
actionview (5.
|
28
|
-
activesupport (= 5.
|
28
|
+
actionview (5.2.4.2)
|
29
|
+
activesupport (= 5.2.4.2)
|
29
30
|
builder (~> 3.1)
|
30
|
-
|
31
|
+
erubi (~> 1.4)
|
31
32
|
rails-dom-testing (~> 2.0)
|
32
33
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
-
activejob (5.
|
34
|
-
activesupport (= 5.
|
34
|
+
activejob (5.2.4.2)
|
35
|
+
activesupport (= 5.2.4.2)
|
35
36
|
globalid (>= 0.3.6)
|
36
|
-
activemodel (5.
|
37
|
-
activesupport (= 5.
|
38
|
-
activerecord (5.
|
39
|
-
activemodel (= 5.
|
40
|
-
activesupport (= 5.
|
41
|
-
arel (
|
42
|
-
|
37
|
+
activemodel (5.2.4.2)
|
38
|
+
activesupport (= 5.2.4.2)
|
39
|
+
activerecord (5.2.4.2)
|
40
|
+
activemodel (= 5.2.4.2)
|
41
|
+
activesupport (= 5.2.4.2)
|
42
|
+
arel (>= 9.0)
|
43
|
+
activestorage (5.2.4.2)
|
44
|
+
actionpack (= 5.2.4.2)
|
45
|
+
activerecord (= 5.2.4.2)
|
46
|
+
marcel (~> 0.3.1)
|
47
|
+
activesupport (5.2.4.2)
|
43
48
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
49
|
i18n (>= 0.7, < 2)
|
45
50
|
minitest (~> 5.1)
|
46
51
|
tzinfo (~> 1.1)
|
47
|
-
arel (
|
52
|
+
arel (9.0.0)
|
48
53
|
axlsx (2.0.1)
|
49
54
|
htmlentities (~> 4.3.1)
|
50
55
|
nokogiri (>= 1.4.1)
|
51
56
|
rubyzip (~> 1.0.0)
|
52
|
-
builder (3.2.
|
53
|
-
concurrent-ruby (1.1.
|
54
|
-
crass (1.0.
|
57
|
+
builder (3.2.4)
|
58
|
+
concurrent-ruby (1.1.6)
|
59
|
+
crass (1.0.6)
|
55
60
|
diff-lcs (1.3)
|
56
|
-
|
61
|
+
erubi (1.9.0)
|
57
62
|
globalid (0.4.2)
|
58
63
|
activesupport (>= 4.2.0)
|
59
64
|
htmlentities (4.3.4)
|
60
|
-
i18n (1.
|
65
|
+
i18n (1.8.2)
|
61
66
|
concurrent-ruby (~> 1.0)
|
62
|
-
loofah (2.
|
67
|
+
loofah (2.4.0)
|
63
68
|
crass (~> 1.0.2)
|
64
69
|
nokogiri (>= 1.5.9)
|
65
70
|
mail (2.7.1)
|
66
71
|
mini_mime (>= 0.1.1)
|
67
|
-
|
68
|
-
|
72
|
+
marcel (0.3.3)
|
73
|
+
mimemagic (~> 0.3.2)
|
74
|
+
method_source (1.0.0)
|
75
|
+
mimemagic (0.3.4)
|
76
|
+
mini_mime (1.0.2)
|
69
77
|
mini_portile2 (2.4.0)
|
70
|
-
minitest (5.
|
71
|
-
nio4r (2.
|
78
|
+
minitest (5.14.0)
|
79
|
+
nio4r (2.5.2)
|
72
80
|
nokogiri (1.10.3)
|
73
81
|
mini_portile2 (~> 2.4.0)
|
74
|
-
rack (2.
|
75
|
-
rack-test (
|
76
|
-
rack (>= 1.0)
|
77
|
-
rails (5.
|
78
|
-
actioncable (= 5.
|
79
|
-
actionmailer (= 5.
|
80
|
-
actionpack (= 5.
|
81
|
-
actionview (= 5.
|
82
|
-
activejob (= 5.
|
83
|
-
activemodel (= 5.
|
84
|
-
activerecord (= 5.
|
85
|
-
|
82
|
+
rack (2.2.2)
|
83
|
+
rack-test (1.1.0)
|
84
|
+
rack (>= 1.0, < 3)
|
85
|
+
rails (5.2.4.2)
|
86
|
+
actioncable (= 5.2.4.2)
|
87
|
+
actionmailer (= 5.2.4.2)
|
88
|
+
actionpack (= 5.2.4.2)
|
89
|
+
actionview (= 5.2.4.2)
|
90
|
+
activejob (= 5.2.4.2)
|
91
|
+
activemodel (= 5.2.4.2)
|
92
|
+
activerecord (= 5.2.4.2)
|
93
|
+
activestorage (= 5.2.4.2)
|
94
|
+
activesupport (= 5.2.4.2)
|
86
95
|
bundler (>= 1.3.0)
|
87
|
-
railties (= 5.
|
96
|
+
railties (= 5.2.4.2)
|
88
97
|
sprockets-rails (>= 2.0.0)
|
89
98
|
rails-dom-testing (2.0.3)
|
90
99
|
activesupport (>= 4.2.0)
|
91
100
|
nokogiri (>= 1.6)
|
92
|
-
rails-html-sanitizer (1.0
|
93
|
-
loofah (~> 2.
|
94
|
-
railties (5.
|
95
|
-
actionpack (= 5.
|
96
|
-
activesupport (= 5.
|
101
|
+
rails-html-sanitizer (1.3.0)
|
102
|
+
loofah (~> 2.3)
|
103
|
+
railties (5.2.4.2)
|
104
|
+
actionpack (= 5.2.4.2)
|
105
|
+
activesupport (= 5.2.4.2)
|
97
106
|
method_source
|
98
107
|
rake (>= 0.8.7)
|
99
|
-
thor (>= 0.
|
100
|
-
rake (
|
108
|
+
thor (>= 0.19.0, < 2.0)
|
109
|
+
rake (13.0.1)
|
101
110
|
rspec (3.8.0)
|
102
111
|
rspec-core (~> 3.8.0)
|
103
112
|
rspec-expectations (~> 3.8.0)
|
@@ -112,30 +121,32 @@ GEM
|
|
112
121
|
rspec-support (~> 3.8.0)
|
113
122
|
rspec-support (3.8.0)
|
114
123
|
rubyzip (1.0.0)
|
115
|
-
sprockets (
|
124
|
+
sprockets (4.0.0)
|
116
125
|
concurrent-ruby (~> 1.0)
|
117
126
|
rack (> 1, < 3)
|
118
127
|
sprockets-rails (3.2.1)
|
119
128
|
actionpack (>= 4.0)
|
120
129
|
activesupport (>= 4.0)
|
121
130
|
sprockets (>= 3.0.0)
|
122
|
-
thor (0.
|
131
|
+
thor (1.0.1)
|
123
132
|
thread_safe (0.3.6)
|
124
|
-
tzinfo (1.2.
|
133
|
+
tzinfo (1.2.6)
|
125
134
|
thread_safe (~> 0.1)
|
126
|
-
websocket-driver (0.
|
135
|
+
websocket-driver (0.7.1)
|
127
136
|
websocket-extensions (>= 0.1.0)
|
128
137
|
websocket-extensions (0.1.4)
|
138
|
+
zip-zip (0.3)
|
139
|
+
rubyzip (>= 1.0.0)
|
129
140
|
|
130
141
|
PLATFORMS
|
131
142
|
ruby
|
132
143
|
|
133
144
|
DEPENDENCIES
|
134
145
|
bundler (~> 2.0)
|
135
|
-
rails (~> 5.
|
136
|
-
rake (
|
146
|
+
rails (~> 5.2.4.2)
|
147
|
+
rake (>= 12.3.3)
|
137
148
|
rspec (~> 3.0)
|
138
149
|
spotlight_search!
|
139
150
|
|
140
151
|
BUNDLED WITH
|
141
|
-
2.
|
152
|
+
2.1.4
|
data/README.md
CHANGED
@@ -101,6 +101,10 @@ th = sortable "name", "Name", @filtered_result.sort[:sort_column], @filtered_res
|
|
101
101
|
|
102
102
|
### Export table data to excel
|
103
103
|
|
104
|
+
**Note**
|
105
|
+
|
106
|
+
You will need to have a background job processor such as `sidekiq`, `resque`, `delayed_job` etc as the file will be generated in the background and will be sent to the email passed. If you need to use any other service for sending emails, you will need to override `ExportMailer` class.
|
107
|
+
|
104
108
|
#### Initializer
|
105
109
|
An initializer will have to be created to extend the functionality to ActiveRecord.
|
106
110
|
|
@@ -116,7 +120,34 @@ A line has to be added to the routes.
|
|
116
120
|
mount SpotlightSearch::Engine => '/spotlight_search'
|
117
121
|
```
|
118
122
|
|
123
|
+
#### <a name="export-view"></a>View
|
124
|
+
|
125
|
+
Add `exportable email, model_object` in your view to display the export button.
|
126
|
+
|
127
|
+
```html+erb
|
128
|
+
<table>
|
129
|
+
<tr>
|
130
|
+
<th>Name</th>
|
131
|
+
<th>Email</th>
|
132
|
+
</tr>
|
133
|
+
<td>
|
134
|
+
<% @records.each do |record| %>
|
135
|
+
<tr>
|
136
|
+
<td><%= record.name %></td>
|
137
|
+
<td><%= record.value %></td>
|
138
|
+
<% end %>
|
139
|
+
</td>
|
140
|
+
</table>
|
141
|
+
|
142
|
+
<%= exportable(current_user.email, Person) %>
|
143
|
+
```
|
144
|
+
|
145
|
+
This will first show a popup where an option to select the export enabled columns will be listed. This will also apply any filters that has been selected along with a sorting if applied. It then pushes the export to a background job which will send an excel file of the contents to the specified email. You can edit the style of the button using the class `export-to-file-btn`.
|
146
|
+
|
119
147
|
#### Model
|
148
|
+
|
149
|
+
##### V1
|
150
|
+
|
120
151
|
Enables or disables export and specifies which all columns can be
|
121
152
|
exported. Export is disabled for all columns by default.
|
122
153
|
|
@@ -152,33 +183,33 @@ For excluding only specific columns and allowing all others
|
|
152
183
|
end
|
153
184
|
```
|
154
185
|
|
155
|
-
|
186
|
+
##### V2
|
156
187
|
|
157
|
-
|
188
|
+
To use version two of column export, which supports model methods and nested associations, set it up in the spotlight initializer like this:
|
189
|
+
```ruby
|
190
|
+
# config/initializers/spotlight_search.rb
|
191
|
+
ActiveRecord::Base.include SpotlightSearch::ExportableColumns
|
158
192
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
<th>Email</th>
|
164
|
-
</tr>
|
165
|
-
<td>
|
166
|
-
<% @records.each do |record| %>
|
167
|
-
<tr>
|
168
|
-
<td><%= record.name %></td>
|
169
|
-
<td><%= record.value %></td>
|
170
|
-
<% end %>
|
171
|
-
</td>
|
172
|
-
</table>
|
193
|
+
SpotlightSearch.setup do |config|
|
194
|
+
config.exportable_columns_version = :v2
|
195
|
+
end
|
196
|
+
```
|
173
197
|
|
174
|
-
|
198
|
+
All fields will be disabled by default, so you will need to explicitly enable them by passing them to `export_columns`
|
199
|
+
|
200
|
+
```ruby
|
201
|
+
class Person < ActiveRecord::Base
|
202
|
+
export_columns :created_at, :formatted_amount, :preferred_month, :orderable_type, :payment_type, :status, customer: [:full_name, :email, :mobile_number, :city, :college], orderable: :orderable_display_name, seller: [:full_name]
|
203
|
+
end
|
175
204
|
```
|
176
205
|
|
177
|
-
|
206
|
+
Nested association fields should go at the end of `export_columns`, following Ruby's standard syntax of placing keyword arguments at the end
|
207
|
+
|
208
|
+
**Notes**
|
209
|
+
- You will need to make `filter_params` and `sort_params` in your controller public, or the rendering of the form will fail
|
210
|
+
- Be careful with methods that return a hash, as the algorithm will recursively create one column for every key inside that hash. One example is `Money` fields from the `money-rails` gem
|
178
211
|
|
179
|
-
**Note**
|
180
212
|
|
181
|
-
You will need to have a background job processor such as `sidekiq`, `resque`, `delayed_job` etc as the file will be generated in the background and will be sent to the email passed. If you need to use any other service for sending emails, you will need to override `ExportMailer` class.
|
182
213
|
|
183
214
|
## Development
|
184
215
|
|
@@ -2,17 +2,17 @@ module SpotlightSearch
|
|
2
2
|
class ExportJobsController < ApplicationController
|
3
3
|
def export_job
|
4
4
|
begin
|
5
|
-
klass = params[:
|
5
|
+
klass = params[:class_name].constantize
|
6
6
|
if klass.validate_exportable_columns(params[:columns])
|
7
|
-
ExportJob.perform_later(params[:email],
|
8
|
-
|
7
|
+
ExportJob.perform_later(klass.name, params[:email], params[:columns], params[:filters], params[:sort])
|
8
|
+
notice = 'Successfully queued for export'
|
9
9
|
else
|
10
|
-
|
10
|
+
notice = 'Invalid columns found'
|
11
11
|
end
|
12
|
-
rescue
|
13
|
-
|
12
|
+
rescue StandardError => e
|
13
|
+
notice = e.message
|
14
14
|
ensure
|
15
|
-
redirect_back fallback_location: root_path
|
15
|
+
redirect_back fallback_location: root_path, notice: notice
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -2,9 +2,9 @@ require 'axlsx'
|
|
2
2
|
|
3
3
|
module SpotlightSearch
|
4
4
|
class ExportJob < ApplicationJob
|
5
|
-
def perform(
|
6
|
-
klass =
|
7
|
-
records = get_records(klass, filters,
|
5
|
+
def perform(klass_name, email, columns = [], filters = {}, sort = {})
|
6
|
+
klass = klass_name.constantize
|
7
|
+
records = get_records(klass, columns, filters, sort)
|
8
8
|
file_path =
|
9
9
|
case SpotlightSearch.exportable_columns_version
|
10
10
|
when :v1
|
@@ -15,24 +15,21 @@ module SpotlightSearch
|
|
15
15
|
subject = "#{klass.name} export at #{Time.now}"
|
16
16
|
ExportMailer.send_excel_file(email, file_path, subject).deliver_now
|
17
17
|
File.delete(file_path)
|
18
|
+
rescue StandsrdError(e)
|
19
|
+
ExportMailer.send_error_message(email, e).deliver_now
|
18
20
|
end
|
19
21
|
|
20
|
-
def get_records(klass, filters,
|
22
|
+
def get_records(klass, columns, filters, sort)
|
21
23
|
records = klass
|
22
|
-
if
|
23
|
-
|
24
|
-
|
25
|
-
if scope_args.is_a?(Array)
|
26
|
-
records = records.send(scope, *scope_args)
|
27
|
-
else
|
28
|
-
records = records.send(scope, scope_args)
|
29
|
-
end
|
30
|
-
end
|
24
|
+
if filters.present?
|
25
|
+
filters.each do |scope, scope_args|
|
26
|
+
records = records.send(scope, scope_args)
|
31
27
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
end
|
29
|
+
if sort.present?
|
30
|
+
records = records.order("#{sort['sort_column']} #{sort['sort_direction']}")
|
31
|
+
end
|
32
|
+
if filters.blank? && sort.blank?
|
36
33
|
records = records.all
|
37
34
|
end
|
38
35
|
case SpotlightSearch.exportable_columns_version
|
@@ -6,5 +6,11 @@ module SpotlightSearch
|
|
6
6
|
attachments[file_path.split('/').last] = File.read(file_path)
|
7
7
|
mail(to: email, subject: subject)
|
8
8
|
end
|
9
|
+
|
10
|
+
def send_error_message(email, err)
|
11
|
+
@error_message = err.message
|
12
|
+
mail(to: email, subject: "Error generating CSV file")
|
13
|
+
Rollbar.error(err)
|
14
|
+
end
|
9
15
|
end
|
10
16
|
end
|
@@ -29,17 +29,7 @@ module SpotlightSearch
|
|
29
29
|
# end
|
30
30
|
#
|
31
31
|
def export_columns(*record_fields, **associated_fields)
|
32
|
-
ActiveRecord::Base.connection.migration_context.needs_migration? && return
|
33
|
-
|
34
|
-
# Check that all record fields are valid accessible. Error if it doesn't.
|
35
|
-
# for each association, check that if its a valid association, and take the recursive step with that association
|
36
|
-
# End result is setting up in self, enabled columns and enabled associated columns
|
37
|
-
columns_hash = _model_exportable_columns(self, *record_fields, **associated_fields)
|
38
|
-
|
39
|
-
raise SpotlightSearch::Exceptions::InvalidColumns, columns_hash[:invalid_columns] if columns_hash[:invalid_columns].size.positive?
|
40
32
|
self.enabled_columns = [*record_fields, **associated_fields]
|
41
|
-
rescue ActiveRecord::NoDatabaseError
|
42
|
-
Rails.logger.info("No database error")
|
43
33
|
end
|
44
34
|
|
45
35
|
def _model_exportable_columns(klass, *record_fields, **associated_fields)
|
@@ -86,17 +76,15 @@ module SpotlightSearch
|
|
86
76
|
|
87
77
|
# Validates whether the selected columns are allowed for export
|
88
78
|
def validate_exportable_columns(columns)
|
89
|
-
unless columns.is_a?
|
79
|
+
unless columns.is_a? Array
|
90
80
|
raise SpotlightSearch::Exceptions::InvalidValue, 'Expected Array. Invalid type received'
|
91
81
|
end
|
92
|
-
|
93
|
-
true
|
82
|
+
(columns & SpotlightSearch::Utils.serialize_csv_columns(*enabled_columns)).size == columns.size # returns true if all columns are valid
|
94
83
|
end
|
95
84
|
end
|
96
85
|
|
97
86
|
included do
|
98
87
|
class_attribute :enabled_columns, instance_accessor: false, default: nil
|
99
|
-
class_attribute :enabled_associated_columns, instance_accessor: false, default: nil
|
100
88
|
end
|
101
89
|
end
|
102
90
|
end
|
@@ -11,9 +11,9 @@ module SpotlightSearch
|
|
11
11
|
content_tag("a", title, class: css_class, data: {sort_column: column, sort_direction: direction, behaviour: 'sort', type: 'anchor-filter'})
|
12
12
|
end
|
13
13
|
|
14
|
-
def exportable(email, klass)
|
14
|
+
def exportable(email, klass, html_class: [])
|
15
15
|
tag.div do
|
16
|
-
concat tag.button "Export as excel", class: "modal-btn", data: {toggle: "modal", target: "#exportmodal"}
|
16
|
+
concat tag.button "Export as excel", class: html_class.append("modal-btn"), data: {toggle: "modal", target: "#exportmodal"}
|
17
17
|
concat column_pop_up(email, klass)
|
18
18
|
end
|
19
19
|
end
|
@@ -46,10 +46,11 @@ module SpotlightSearch
|
|
46
46
|
|
47
47
|
def pop_up_body(email, klass)
|
48
48
|
tag.div class: "modal-body" do
|
49
|
-
form_tag '/spotlight_search/export_to_file', id: 'export-to-file-form', style: "width: 100%;" do
|
49
|
+
form_tag '/spotlight_search/export_to_file', id: 'export-to-file-form', style: "width: 100%;", class:"spotlight-csv-export-form" do
|
50
50
|
concat hidden_field_tag 'email', email, id: 'export-to-file-email'
|
51
|
-
concat hidden_field_tag '
|
52
|
-
|
51
|
+
concat hidden_field_tag 'class_name', klass.to_s, id: 'export-to-file-klass'
|
52
|
+
params_to_post_helper(filters: controller.filter_params) if controller.filter_params
|
53
|
+
params_to_post_helper(sort: controller.sort_params) if controller.sort_params
|
53
54
|
case SpotlightSearch.exportable_columns_version
|
54
55
|
when :v1
|
55
56
|
concat checkbox_row(klass)
|
@@ -61,6 +62,12 @@ module SpotlightSearch
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
65
|
+
def params_to_post_helper(params)
|
66
|
+
URI.decode_www_form(params.to_param).each do |param|
|
67
|
+
concat hidden_field_tag param[0], param[1]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
64
71
|
def checkbox_row(klass)
|
65
72
|
tag.div class: "row" do
|
66
73
|
klass.enabled_columns.each do |column_name|
|
@@ -86,8 +93,8 @@ module SpotlightSearch
|
|
86
93
|
|
87
94
|
def create_checkbox_v2(column_path)
|
88
95
|
tag.div class: "col-md-4" do
|
89
|
-
concat check_box_tag "columns[]", column_path
|
90
|
-
concat column_path.to_s.
|
96
|
+
concat check_box_tag "columns[]", column_path, id: column_path.to_s.gsub('/', '-')
|
97
|
+
concat column_path.to_s.gsub('/', '_').humanize
|
91
98
|
end
|
92
99
|
end
|
93
100
|
|
@@ -6,7 +6,7 @@ module SpotlightSearch::Utils
|
|
6
6
|
# Turns an arbitrary list of args and kwargs into a list of params to be used in a form
|
7
7
|
# For example, turns SpotlightSearch::Utils.serialize_csv_columns(:a, :b, c: [:d, e: :h], f: :g)
|
8
8
|
# into [:a, :b, "c/d", "c/e/h", "f/g"]
|
9
|
-
columns + hashes.map do |key, value|
|
9
|
+
columns.map(&:to_s) + hashes.map do |key, value|
|
10
10
|
serialize_csv_columns(*value).map do |column|
|
11
11
|
"#{key}/#{column}"
|
12
12
|
end
|
data/spotlight_search.gemspec
CHANGED
@@ -24,8 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
# s.require_paths = ["lib"]
|
25
25
|
|
26
26
|
s.add_development_dependency "bundler", "~> 2.0"
|
27
|
-
s.add_development_dependency "rake", "
|
28
|
-
s.add_development_dependency "rails", "~> 5.
|
27
|
+
s.add_development_dependency "rake", ">= 12.3.3"
|
28
|
+
s.add_development_dependency "rails", "~> 5.2.4.2"
|
29
29
|
s.add_development_dependency "rspec", "~> 3.0"
|
30
30
|
s.add_runtime_dependency 'axlsx'
|
31
31
|
s.add_runtime_dependency 'zip-zip'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spotlight_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anbazhagan Palani
|
@@ -28,30 +28,30 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 5.
|
47
|
+
version: 5.2.4.2
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 5.
|
54
|
+
version: 5.2.4.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- app/controllers/spotlight_search/export_jobs_controller.rb
|
116
116
|
- app/jobs/spotlight_search/export_job.rb
|
117
117
|
- app/mailers/spotlight_search/export_mailer.rb
|
118
|
+
- app/views/spotlight_search/export_mailer/send_error_message.html.erb
|
118
119
|
- app/views/spotlight_search/export_mailer/send_excel_file.html.erb
|
119
120
|
- bin/console
|
120
121
|
- bin/setup
|