activeadmin-axlsx 2.0.1 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.bundle/config +2 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +12 -12
- data/README.md +12 -4
- data/activeadmin-axlsx.gemspec +1 -1
- data/lib/active_admin/axlsx.rb +1 -8
- data/lib/active_admin/axlsx/builder.rb +11 -2
- data/lib/active_admin/axlsx/resource_controller_extension.rb +1 -1
- data/lib/active_admin/axlsx/resource_extension.rb +0 -1
- data/lib/active_admin/axlsx/version.rb +1 -1
- data/spec/axlsx/unit/builder_spec.rb +4 -1
- data/spec/axlsx/unit/resource_controller_spec.rb +0 -2
- data/spec/spec_helper.rb +3 -1
- metadata +16 -27
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 007b376c2e8ceb36376295cda6b85fe2c0b90013
|
4
|
+
data.tar.gz: afc6ea969c52436a9f5c7733262b5b721ae39797
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4928764c3bff1562b9c59b4b996c5f423c7a0e056f136afc3d6f72e03f59d36a452f75d161475715ba1fef7149e120491e798459fd54c212e7a142c7e36b4d8c
|
7
|
+
data.tar.gz: 420f4c61234823da4caa2c2a63c5446a5095da5f6bfc18e4cc6a9b03a816b4ea3e532ad96c8fd2c4046aa221e32bbaf6786d54e7a2bf49f66d33bda1eda15b96
|
data/.bundle/config
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activeadmin-axlsx (2.
|
5
|
-
activeadmin (
|
4
|
+
activeadmin-axlsx (2.1.1)
|
5
|
+
activeadmin (~> 0.6.0)
|
6
6
|
axlsx
|
7
7
|
|
8
8
|
GEM
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
rack-cache (~> 1.2)
|
22
22
|
rack-test (~> 0.6.1)
|
23
23
|
sprockets (~> 2.2.1)
|
24
|
-
activeadmin (0.
|
24
|
+
activeadmin (0.6.0)
|
25
25
|
arbre (>= 1.0.1)
|
26
26
|
bourbon (>= 1.0.0)
|
27
27
|
devise (>= 1.1.2)
|
@@ -56,8 +56,8 @@ GEM
|
|
56
56
|
nokogiri (>= 1.4.1)
|
57
57
|
rubyzip (>= 0.9.5)
|
58
58
|
bcrypt-ruby (3.0.1)
|
59
|
-
bourbon (
|
60
|
-
sass (>= 3.2)
|
59
|
+
bourbon (3.1.3)
|
60
|
+
sass (>= 3.2.0)
|
61
61
|
thor
|
62
62
|
builder (3.0.4)
|
63
63
|
capybara (1.1.2)
|
@@ -84,7 +84,7 @@ GEM
|
|
84
84
|
cucumber (>= 1.1.3)
|
85
85
|
nokogiri (>= 1.5.0)
|
86
86
|
database_cleaner (0.9.1)
|
87
|
-
devise (2.
|
87
|
+
devise (2.2.3)
|
88
88
|
bcrypt-ruby (~> 3.0)
|
89
89
|
orm_adapter (~> 0.1)
|
90
90
|
railties (~> 3.1)
|
@@ -124,9 +124,9 @@ GEM
|
|
124
124
|
selenium-webdriver (>= 0.1.3)
|
125
125
|
jasmine-core (1.2.0)
|
126
126
|
journey (1.0.4)
|
127
|
-
jquery-rails (2.1
|
128
|
-
railties (>= 3.
|
129
|
-
thor (
|
127
|
+
jquery-rails (2.2.1)
|
128
|
+
railties (>= 3.0, < 5.0)
|
129
|
+
thor (>= 0.14, < 2.0)
|
130
130
|
jslint_on_rails (1.0.7)
|
131
131
|
json (1.7.5)
|
132
132
|
kaminari (0.14.1)
|
@@ -183,7 +183,7 @@ GEM
|
|
183
183
|
rake (>= 0.8.7)
|
184
184
|
rdoc (~> 3.4)
|
185
185
|
thor (>= 0.14.6, < 2.0)
|
186
|
-
rake (0.9.
|
186
|
+
rake (0.9.6)
|
187
187
|
rdiscount (1.6.8)
|
188
188
|
rdoc (3.12)
|
189
189
|
json (~> 1.4)
|
@@ -230,7 +230,7 @@ GEM
|
|
230
230
|
treetop (1.4.12)
|
231
231
|
polyglot
|
232
232
|
polyglot (>= 0.3.1)
|
233
|
-
tzinfo (0.3.
|
233
|
+
tzinfo (0.3.37)
|
234
234
|
warden (1.2.1)
|
235
235
|
rack (>= 1.0)
|
236
236
|
websocket (1.0.3)
|
@@ -255,7 +255,7 @@ DEPENDENCIES
|
|
255
255
|
jslint_on_rails (~> 1.0.6)
|
256
256
|
launchy
|
257
257
|
rails-i18n
|
258
|
-
rake (~> 0.9.
|
258
|
+
rake (~> 0.9.6)
|
259
259
|
rdiscount
|
260
260
|
rspec-mocks
|
261
261
|
rspec-rails (~> 2.9.0)
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ appreciation for the gem, please don't hesitate to make a donation.
|
|
20
20
|
|
21
21
|
**License**: MIT License
|
22
22
|
|
23
|
-
**Latest Version**: 2.
|
23
|
+
**Latest Version**: 2.1.1
|
24
24
|
|
25
25
|
**Ruby Version**: 1.9.2, 1.9.3
|
26
26
|
|
@@ -28,7 +28,7 @@ appreciation for the gem, please don't hesitate to make a donation.
|
|
28
28
|
|
29
29
|
**Rubinius Version**: rubinius 2.0.0dev * lower versions may run, this gem always tests against head.
|
30
30
|
|
31
|
-
**Release Date**:
|
31
|
+
**Release Date**: 2013.04.18
|
32
32
|
|
33
33
|
Synopsis
|
34
34
|
--------
|
@@ -53,8 +53,9 @@ Cool Toys
|
|
53
53
|
---------
|
54
54
|
|
55
55
|
Here are a few quick examples of things you can easily tweak.
|
56
|
-
Axlsx
|
57
|
-
|
56
|
+
While Axlsx does support most anything you can do in MS Excel,
|
57
|
+
I'd be excite to implement something adventurous.
|
58
|
+
Please ping me on irc. (freenode#axlsx)
|
58
59
|
|
59
60
|
##localize column headers
|
60
61
|
|
@@ -156,6 +157,13 @@ bundle exec rake setup
|
|
156
157
|
bundle exec rake
|
157
158
|
```
|
158
159
|
# Changelog
|
160
|
+
**2013.04.18** Release 2.1.1
|
161
|
+
- Serialize now returns the serialized stream instead of the Package
|
162
|
+
object. While I doubt anyone is overriding the index wrapper on the
|
163
|
+
controller, please let me know if this breaks anything for you as it is
|
164
|
+
strictly not a backwards compatible change.
|
165
|
+
- BugFix Package and Worksheet objects are now re-initialized on request.
|
166
|
+
- Pre 0.5.0 conditional extension logic removed.
|
159
167
|
**2013.03.21** Release 2.0.1
|
160
168
|
- Fixed an issue with missing objects when using the DSL.
|
161
169
|
Huge thanks to [Fivell](https://github.com/Fivell)
|
data/activeadmin-axlsx.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = `git ls-files`.split("\n").sort
|
16
16
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
17
17
|
s.test_files = Dir.glob("{spec/**/*}")
|
18
|
-
s.add_runtime_dependency 'activeadmin',
|
18
|
+
s.add_runtime_dependency 'activeadmin', "~> 0.6.0"
|
19
19
|
s.add_runtime_dependency 'axlsx'
|
20
20
|
|
21
21
|
s.required_ruby_version = '>= 1.9.2'
|
data/lib/active_admin/axlsx.rb
CHANGED
@@ -19,14 +19,7 @@ class Railtie < ::Rails::Railtie
|
|
19
19
|
ActiveAdmin::ResourceDSL.send :include, ActiveAdmin::Axlsx::DSL
|
20
20
|
ActiveAdmin::Resource.send :include, ActiveAdmin::Axlsx::ResourceExtension
|
21
21
|
ActiveAdmin::ResourceController.send :include, ActiveAdmin::Axlsx::ResourceControllerExtension
|
22
|
-
|
23
|
-
# Pull request to fix build download format links has already been merged into active admin.
|
24
|
-
if ActiveAdmin::VERSION < '0.5.1'
|
25
|
-
ActiveAdmin::Views::PaginatedCollection.send :include, ActiveAdmin::Axlsx::BuildDownloadFormatLinks
|
26
|
-
ActiveAdmin::Views::Pages::Index.send :include, ActiveAdmin::Axlsx::BuildDownloadFormatLinks
|
27
|
-
else
|
28
|
-
ActiveAdmin::Views::PaginatedCollection.add_format :xlsx
|
29
|
-
end
|
22
|
+
ActiveAdmin::Views::PaginatedCollection.add_format :xlsx
|
30
23
|
end
|
31
24
|
end
|
32
25
|
|
@@ -115,7 +115,7 @@ module ActiveAdmin
|
|
115
115
|
apply_filter @before_filter
|
116
116
|
export_collection(collection)
|
117
117
|
apply_filter @after_filter
|
118
|
-
|
118
|
+
to_stream
|
119
119
|
end
|
120
120
|
|
121
121
|
protected
|
@@ -137,6 +137,16 @@ module ActiveAdmin
|
|
137
137
|
|
138
138
|
private
|
139
139
|
|
140
|
+
def to_stream
|
141
|
+
stream = package.to_stream.read
|
142
|
+
clean_up
|
143
|
+
stream
|
144
|
+
end
|
145
|
+
|
146
|
+
def clean_up
|
147
|
+
@package = @sheet = nil
|
148
|
+
end
|
149
|
+
|
140
150
|
def export_collection(collection)
|
141
151
|
header_row
|
142
152
|
collection.each do |resource|
|
@@ -162,7 +172,6 @@ module ActiveAdmin
|
|
162
172
|
@sheet ||= package.workbook.add_worksheet
|
163
173
|
end
|
164
174
|
|
165
|
-
# the Axlsx::Package
|
166
175
|
def package
|
167
176
|
@package ||= ::Axlsx::Package.new(:use_shared_strings => true)
|
168
177
|
end
|
@@ -12,7 +12,7 @@ module ActiveAdmin
|
|
12
12
|
index_without_xlsx(options) do |format|
|
13
13
|
format.xlsx do
|
14
14
|
xlsx = active_admin_config.xlsx_builder.serialize(collection)
|
15
|
-
send_data xlsx
|
15
|
+
send_data xlsx, :filename => "#{xlsx_filename}", :type => Mime::Type.lookup_by_extension(:xlsx)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -85,7 +85,10 @@ module ActiveAdmin
|
|
85
85
|
before(:all) do
|
86
86
|
User.stub!(:all) { users }
|
87
87
|
Post.stub!(:all) { posts }
|
88
|
-
|
88
|
+
# disable clean up so we can get the package.
|
89
|
+
builder.stub(:clean_up) { false }
|
90
|
+
builder.serialize(Post.all)
|
91
|
+
@package = builder.send(:package)
|
89
92
|
end
|
90
93
|
|
91
94
|
it 'merges our customizations with the default header style' do
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
describe ActiveAdmin::ResourceController do
|
3
3
|
|
4
|
-
|
5
4
|
let(:mime) { Mime::Type.lookup_by_extension(:xlsx) }
|
6
5
|
|
7
6
|
let(:request) do
|
@@ -25,7 +24,6 @@ describe ActiveAdmin::ResourceController do
|
|
25
24
|
controller.xlsx_filename.should == filename
|
26
25
|
end
|
27
26
|
|
28
|
-
|
29
27
|
context 'when making requests with the xlsx mime type' do
|
30
28
|
it 'returns xlsx attachment when requested' do
|
31
29
|
controller.send :index
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'simplecov'
|
2
2
|
SimpleCov.start do
|
3
3
|
add_filter "/rails/"
|
4
|
+
add_filter "/vendor/"
|
4
5
|
end
|
5
6
|
|
6
7
|
# prepare ENV for rails
|
@@ -16,9 +17,10 @@ end
|
|
16
17
|
# load up activeadmin and activeadmin-axlsx
|
17
18
|
require 'activeadmin-axlsx'
|
18
19
|
ActiveAdmin.application.load_paths = [ENV['RAILS_ROOT'] + "/app/admin"]
|
19
|
-
|
20
20
|
# start up rails
|
21
21
|
require ENV['RAILS_ROOT'] + '/config/environment'
|
22
22
|
|
23
23
|
# and finally,here's rspec
|
24
24
|
require 'rspec/rails'
|
25
|
+
ActiveAdmin.application.authentication_method = false
|
26
|
+
ActiveAdmin.application.current_user_method = false
|
metadata
CHANGED
@@ -1,58 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin-axlsx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Randy Morgan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activeadmin
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
19
|
+
version: 0.6.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
26
|
+
version: 0.6.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: axlsx
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
|
-
description:
|
47
|
-
|
48
|
-
instead of CSV?
|
49
|
-
|
50
|
-
'
|
41
|
+
description: |2
|
42
|
+
This gem uses axlsx to provide excel/xlsx downloads for resources in Active Admin. Often, users are happier with excel, so why not give it to them instead of CSV?
|
51
43
|
email: digital.ipseity@gmail.com
|
52
44
|
executables: []
|
53
45
|
extensions: []
|
54
46
|
extra_rdoc_files: []
|
55
47
|
files:
|
48
|
+
- .bundle/config
|
56
49
|
- .gitignore
|
57
50
|
- .rspec
|
58
51
|
- .yardops
|
@@ -86,30 +79,26 @@ files:
|
|
86
79
|
- spec/support/templates/en.yml
|
87
80
|
homepage: https://github.com/randym/activeadmin-axlsx
|
88
81
|
licenses: []
|
82
|
+
metadata: {}
|
89
83
|
post_install_message:
|
90
84
|
rdoc_options: []
|
91
85
|
require_paths:
|
92
86
|
- lib
|
93
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
88
|
requirements:
|
96
|
-
- -
|
89
|
+
- - '>='
|
97
90
|
- !ruby/object:Gem::Version
|
98
91
|
version: 1.9.2
|
99
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
93
|
requirements:
|
102
|
-
- -
|
94
|
+
- - '>='
|
103
95
|
- !ruby/object:Gem::Version
|
104
96
|
version: '0'
|
105
|
-
segments:
|
106
|
-
- 0
|
107
|
-
hash: -2418238237360129031
|
108
97
|
requirements: []
|
109
98
|
rubyforge_project:
|
110
|
-
rubygems_version:
|
99
|
+
rubygems_version: 2.0.3
|
111
100
|
signing_key:
|
112
|
-
specification_version:
|
101
|
+
specification_version: 4
|
113
102
|
summary: Adds excel downloads for resources within the Active Admin framework via
|
114
103
|
Axlsx.
|
115
104
|
test_files:
|