workbook_rails 0.1.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1fd926c3fdeb525629c6923b117185e4a69eb9a8
4
- data.tar.gz: 0fad69c2f19078c7f0071a6d93eb0ba201c39e47
2
+ SHA256:
3
+ metadata.gz: b2ed8560abd5c51b7febd1b20a2caf617154baab4c6762cd7ad8c82b5a8829ff
4
+ data.tar.gz: 142494faaba8f5d90f5dabfe29979886b8f3895c369ce64665d826136208dd37
5
5
  SHA512:
6
- metadata.gz: 5f4e7a1d55a326776cb12a32734cf9eec6046cfdebe6270fe3ecaceb9622be0dab18023b10112a19f6ee82171f63316b2df6201c88fea23289a95509ed0d154e
7
- data.tar.gz: 21925dac1cf348a03169609d9d4bcbb7c7697449f314397f82d6a8e5e0562a2961256e82f9dee0a0e5ffd30607eaf781fbb30c2aa92d43d60bc31baee48435ef
6
+ metadata.gz: 312c0a2649e8ae267befd09115049fafe9cbc7a814e6ded8d0c714330181d8f58750347cf7b28ec2a67eaf9c3cd1d02a179a9aad288192e332594b9376d0b7f6
7
+ data.tar.gz: 754201337d2ac1bdf444b650f4db6910043ff011e47cee89cb0e1047812ebc44a06f7bab9b969eb63f2d7ac31ba2ad2c1138c7c52a250e0ed0489a40bd82f8d2
data/Gemfile CHANGED
@@ -1,21 +1,25 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Declare your gem's dependencies in axlsx_rails.gemspec.
4
4
  # Bundler will treat runtime dependencies like base dependencies, and
5
5
  # development dependencies will be added by default to the :development group.
6
6
  gemspec
7
7
 
8
- gem 'rails', "~> 4.2.0"
9
- gem 'responders', '~> 2.0'
10
-
11
- # jquery-rails is used by the dummy application
12
- gem "jquery-rails"
8
+ gem 'rails', "~> 6.1.0"
9
+ gem 'responders', '~> 3.0'
13
10
 
14
11
  # Declare any dependencies that are still in development here instead of in
15
12
  # your gemspec. These might include edge Rails or gems from your path or
16
13
  # Git. Remember to move these dependencies to your gemspec before releasing
17
14
  # your gem to rubygems.org.
18
- gem 'capybara', '~> 2.1'
19
15
 
20
16
  # To use debugger
21
17
  # gem 'pry-debugger'
18
+ group :test do
19
+ gem 'capybara', '~> 2.1'
20
+ gem 'simplecov', require: false
21
+ gem 'codeclimate-test-reporter', require: false
22
+ gem "rspec-rails"
23
+ gem "sqlite3"
24
+ gem "coveralls"
25
+ end
data/Gemfile.lock CHANGED
@@ -1,188 +1,229 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workbook_rails (0.1.1)
4
+ workbook_rails (0.2.0)
5
5
  actionpack (>= 3.2)
6
6
  workbook (>= 0.4.10)
7
7
 
8
8
  GEM
9
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
10
10
  specs:
11
- actionmailer (4.2.6)
12
- actionpack (= 4.2.6)
13
- actionview (= 4.2.6)
14
- activejob (= 4.2.6)
11
+ actioncable (6.1.7.7)
12
+ actionpack (= 6.1.7.7)
13
+ activesupport (= 6.1.7.7)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailbox (6.1.7.7)
17
+ actionpack (= 6.1.7.7)
18
+ activejob (= 6.1.7.7)
19
+ activerecord (= 6.1.7.7)
20
+ activestorage (= 6.1.7.7)
21
+ activesupport (= 6.1.7.7)
22
+ mail (>= 2.7.1)
23
+ actionmailer (6.1.7.7)
24
+ actionpack (= 6.1.7.7)
25
+ actionview (= 6.1.7.7)
26
+ activejob (= 6.1.7.7)
27
+ activesupport (= 6.1.7.7)
15
28
  mail (~> 2.5, >= 2.5.4)
16
- rails-dom-testing (~> 1.0, >= 1.0.5)
17
- actionpack (4.2.6)
18
- actionview (= 4.2.6)
19
- activesupport (= 4.2.6)
20
- rack (~> 1.6)
21
- rack-test (~> 0.6.2)
22
- rails-dom-testing (~> 1.0, >= 1.0.5)
23
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
- actionview (4.2.6)
25
- activesupport (= 4.2.6)
29
+ rails-dom-testing (~> 2.0)
30
+ actionpack (6.1.7.7)
31
+ actionview (= 6.1.7.7)
32
+ activesupport (= 6.1.7.7)
33
+ rack (~> 2.0, >= 2.0.9)
34
+ rack-test (>= 0.6.3)
35
+ rails-dom-testing (~> 2.0)
36
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
+ actiontext (6.1.7.7)
38
+ actionpack (= 6.1.7.7)
39
+ activerecord (= 6.1.7.7)
40
+ activestorage (= 6.1.7.7)
41
+ activesupport (= 6.1.7.7)
42
+ nokogiri (>= 1.8.5)
43
+ actionview (6.1.7.7)
44
+ activesupport (= 6.1.7.7)
26
45
  builder (~> 3.1)
27
- erubis (~> 2.7.0)
28
- rails-dom-testing (~> 1.0, >= 1.0.5)
29
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
- activejob (4.2.6)
31
- activesupport (= 4.2.6)
32
- globalid (>= 0.3.0)
33
- activemodel (4.2.6)
34
- activesupport (= 4.2.6)
35
- builder (~> 3.1)
36
- activerecord (4.2.6)
37
- activemodel (= 4.2.6)
38
- activesupport (= 4.2.6)
39
- arel (~> 6.0)
40
- activesupport (4.2.6)
41
- i18n (~> 0.7)
42
- json (~> 1.7, >= 1.7.7)
43
- minitest (~> 5.1)
44
- thread_safe (~> 0.3, >= 0.3.4)
45
- tzinfo (~> 1.1)
46
- addressable (2.4.0)
47
- arel (6.0.3)
48
- axlsx (2.1.0.pre)
49
- htmlentities (~> 4.3.1)
50
- nokogiri (>= 1.4.1)
51
- rubyzip (~> 1.1.7)
52
- builder (3.2.2)
53
- capybara (2.7.0)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
+ activejob (6.1.7.7)
50
+ activesupport (= 6.1.7.7)
51
+ globalid (>= 0.3.6)
52
+ activemodel (6.1.7.7)
53
+ activesupport (= 6.1.7.7)
54
+ activerecord (6.1.7.7)
55
+ activemodel (= 6.1.7.7)
56
+ activesupport (= 6.1.7.7)
57
+ activestorage (6.1.7.7)
58
+ actionpack (= 6.1.7.7)
59
+ activejob (= 6.1.7.7)
60
+ activerecord (= 6.1.7.7)
61
+ activesupport (= 6.1.7.7)
62
+ marcel (~> 1.0)
63
+ mini_mime (>= 1.1.0)
64
+ activesupport (6.1.7.7)
65
+ concurrent-ruby (~> 1.0, >= 1.0.2)
66
+ i18n (>= 1.6, < 2)
67
+ minitest (>= 5.1)
68
+ tzinfo (~> 2.0)
69
+ zeitwerk (~> 2.3)
70
+ addressable (2.8.6)
71
+ public_suffix (>= 2.0.2, < 6.0)
72
+ axlsx (3.0.0.pre)
73
+ htmlentities (~> 4.3, >= 4.3.4)
74
+ mimemagic (~> 0.3)
75
+ nokogiri (~> 1.8, >= 1.8.2)
76
+ rubyzip (~> 1.2, >= 1.2.1)
77
+ bigdecimal (3.1.8)
78
+ builder (3.2.4)
79
+ capybara (2.18.0)
54
80
  addressable
55
- mime-types (>= 1.16)
81
+ mini_mime (>= 0.1.3)
56
82
  nokogiri (>= 1.3.3)
57
83
  rack (>= 1.0.0)
58
84
  rack-test (>= 0.5.4)
59
- xpath (~> 2.0)
60
- coderay (1.1.1)
61
- concurrent-ruby (1.0.1)
62
- coveralls (0.8.13)
63
- json (~> 1.8)
64
- simplecov (~> 0.11.0)
85
+ xpath (>= 2.0, < 4.0)
86
+ codeclimate-test-reporter (1.0.7)
87
+ simplecov
88
+ concurrent-ruby (1.2.3)
89
+ coveralls (0.8.23)
90
+ json (>= 1.8, < 3)
91
+ simplecov (~> 0.16.1)
65
92
  term-ansicolor (~> 1.3)
66
- thor (~> 0.19.1)
67
- tins (~> 1.6.0)
68
- diff-lcs (1.2.5)
93
+ thor (>= 0.19.4, < 2.0)
94
+ tins (~> 1.6)
95
+ crass (1.0.6)
96
+ date (3.3.4)
97
+ diff-lcs (1.5.1)
69
98
  docile (1.1.5)
70
- erubis (2.7.0)
71
- globalid (0.3.6)
72
- activesupport (>= 4.1.0)
73
- growl (1.0.3)
99
+ erubi (1.12.0)
100
+ globalid (1.2.1)
101
+ activesupport (>= 6.1)
74
102
  htmlentities (4.3.4)
75
- i18n (0.7.0)
76
- jquery-rails (4.1.1)
77
- rails-dom-testing (>= 1, < 3)
78
- railties (>= 4.2.0)
79
- thor (>= 0.14, < 2.0)
80
- json (1.8.3)
81
- loofah (2.0.3)
82
- nokogiri (>= 1.5.9)
83
- mail (2.6.4)
84
- mime-types (>= 1.16, < 4)
85
- method_source (0.8.2)
86
- mime-types (3.0)
87
- mime-types-data (~> 3.2015)
88
- mime-types-data (3.2016.0221)
89
- mini_portile2 (2.0.0)
90
- minitest (5.8.4)
91
- nokogiri (1.6.7.2)
92
- mini_portile2 (~> 2.0.0.rc2)
93
- pry (0.10.3)
94
- coderay (~> 1.1.0)
95
- method_source (~> 0.8.1)
96
- slop (~> 3.4)
97
- pry-nav (0.2.4)
98
- pry (>= 0.9.10, < 0.11.0)
99
- rack (1.6.4)
100
- rack-test (0.6.3)
101
- rack (>= 1.0)
102
- rails (4.2.6)
103
- actionmailer (= 4.2.6)
104
- actionpack (= 4.2.6)
105
- actionview (= 4.2.6)
106
- activejob (= 4.2.6)
107
- activemodel (= 4.2.6)
108
- activerecord (= 4.2.6)
109
- activesupport (= 4.2.6)
110
- bundler (>= 1.3.0, < 2.0)
111
- railties (= 4.2.6)
112
- sprockets-rails
113
- rails-deprecated_sanitizer (1.0.3)
114
- activesupport (>= 4.2.0.alpha)
115
- rails-dom-testing (1.0.7)
116
- activesupport (>= 4.2.0.beta, < 5.0)
117
- nokogiri (~> 1.6.0)
118
- rails-deprecated_sanitizer (>= 1.0.1)
119
- rails-html-sanitizer (1.0.3)
120
- loofah (~> 2.0)
121
- railties (4.2.6)
122
- actionpack (= 4.2.6)
123
- activesupport (= 4.2.6)
124
- rake (>= 0.8.7)
125
- thor (>= 0.18.1, < 2.0)
126
- rake (10.5.0)
127
- rb-fsevent (0.9.7)
128
- rchardet (1.6.1)
129
- responders (2.1.2)
130
- railties (>= 4.2.0, < 5.1)
131
- roo (2.3.2)
103
+ i18n (1.14.5)
104
+ concurrent-ruby (~> 1.0)
105
+ json (2.7.2)
106
+ loofah (2.22.0)
107
+ crass (~> 1.0.2)
108
+ nokogiri (>= 1.12.0)
109
+ mail (2.8.1)
110
+ mini_mime (>= 0.1.1)
111
+ net-imap
112
+ net-pop
113
+ net-smtp
114
+ marcel (1.0.4)
115
+ method_source (1.1.0)
116
+ mimemagic (0.4.3)
132
117
  nokogiri (~> 1)
133
- rubyzip (~> 1.1, < 2.0.0)
134
- rspec-core (3.4.4)
135
- rspec-support (~> 3.4.0)
136
- rspec-expectations (3.4.0)
118
+ rake
119
+ mini_mime (1.1.5)
120
+ mini_portile2 (2.8.6)
121
+ minitest (5.23.1)
122
+ net-imap (0.3.7)
123
+ date
124
+ net-protocol
125
+ net-pop (0.1.2)
126
+ net-protocol
127
+ net-protocol (0.2.2)
128
+ timeout
129
+ net-smtp (0.5.0)
130
+ net-protocol
131
+ nio4r (2.7.3)
132
+ nokogiri (1.16.5)
133
+ mini_portile2 (~> 2.8.2)
134
+ racc (~> 1.4)
135
+ public_suffix (5.0.5)
136
+ racc (1.8.0)
137
+ rack (2.2.9)
138
+ rack-test (2.1.0)
139
+ rack (>= 1.3)
140
+ rails (6.1.7.7)
141
+ actioncable (= 6.1.7.7)
142
+ actionmailbox (= 6.1.7.7)
143
+ actionmailer (= 6.1.7.7)
144
+ actionpack (= 6.1.7.7)
145
+ actiontext (= 6.1.7.7)
146
+ actionview (= 6.1.7.7)
147
+ activejob (= 6.1.7.7)
148
+ activemodel (= 6.1.7.7)
149
+ activerecord (= 6.1.7.7)
150
+ activestorage (= 6.1.7.7)
151
+ activesupport (= 6.1.7.7)
152
+ bundler (>= 1.15.0)
153
+ railties (= 6.1.7.7)
154
+ sprockets-rails (>= 2.0.0)
155
+ rails-dom-testing (2.2.0)
156
+ activesupport (>= 5.0.0)
157
+ minitest
158
+ nokogiri (>= 1.6)
159
+ rails-html-sanitizer (1.5.0)
160
+ loofah (~> 2.19, >= 2.19.1)
161
+ railties (6.1.7.7)
162
+ actionpack (= 6.1.7.7)
163
+ activesupport (= 6.1.7.7)
164
+ method_source
165
+ rake (>= 12.2)
166
+ thor (~> 1.0)
167
+ rake (13.2.1)
168
+ rchardet (1.8.0)
169
+ responders (3.1.1)
170
+ actionpack (>= 5.2)
171
+ railties (>= 5.2)
172
+ rspec-core (3.13.0)
173
+ rspec-support (~> 3.13.0)
174
+ rspec-expectations (3.13.0)
137
175
  diff-lcs (>= 1.2.0, < 2.0)
138
- rspec-support (~> 3.4.0)
139
- rspec-mocks (3.4.1)
176
+ rspec-support (~> 3.13.0)
177
+ rspec-mocks (3.13.1)
140
178
  diff-lcs (>= 1.2.0, < 2.0)
141
- rspec-support (~> 3.4.0)
142
- rspec-rails (3.4.2)
143
- actionpack (>= 3.0, < 4.3)
144
- activesupport (>= 3.0, < 4.3)
145
- railties (>= 3.0, < 4.3)
146
- rspec-core (~> 3.4.0)
147
- rspec-expectations (~> 3.4.0)
148
- rspec-mocks (~> 3.4.0)
149
- rspec-support (~> 3.4.0)
150
- rspec-support (3.4.1)
151
- ruby-ole (1.2.12)
152
- rubyzip (1.1.7)
153
- simplecov (0.11.2)
154
- docile (~> 1.1.0)
155
- json (~> 1.8)
179
+ rspec-support (~> 3.13.0)
180
+ rspec-rails (6.1.2)
181
+ actionpack (>= 6.1)
182
+ activesupport (>= 6.1)
183
+ railties (>= 6.1)
184
+ rspec-core (~> 3.13)
185
+ rspec-expectations (~> 3.13)
186
+ rspec-mocks (~> 3.13)
187
+ rspec-support (~> 3.13)
188
+ rspec-support (3.13.1)
189
+ ruby-ole (1.2.13.1)
190
+ rubyzip (1.3.0)
191
+ simplecov (0.16.1)
192
+ docile (~> 1.1)
193
+ json (>= 1.8, < 3)
156
194
  simplecov-html (~> 0.10.0)
157
- simplecov-html (0.10.0)
158
- slop (3.6.0)
159
- spreadsheet (1.1.2)
160
- ruby-ole (>= 1.0)
161
- sprockets (3.6.0)
195
+ simplecov-html (0.10.2)
196
+ spreadsheet (1.3.1)
197
+ bigdecimal
198
+ ruby-ole
199
+ sprockets (4.2.1)
162
200
  concurrent-ruby (~> 1.0)
163
- rack (> 1, < 3)
164
- sprockets-rails (3.0.4)
165
- actionpack (>= 4.0)
166
- activesupport (>= 4.0)
201
+ rack (>= 2.2.4, < 4)
202
+ sprockets-rails (3.4.2)
203
+ actionpack (>= 5.2)
204
+ activesupport (>= 5.2)
167
205
  sprockets (>= 3.0.0)
168
- sqlite3 (1.3.11)
169
- term-ansicolor (1.3.2)
206
+ sqlite3 (1.6.9)
207
+ mini_portile2 (~> 2.8.0)
208
+ term-ansicolor (1.6.0)
170
209
  tins (~> 1.0)
171
- thor (0.19.1)
172
- thread_safe (0.3.5)
173
- tins (1.6.0)
174
- tzinfo (1.2.2)
175
- thread_safe (~> 0.1)
176
- workbook (0.5)
177
- axlsx (~> 2.1.0.pre)
178
- json (~> 1.8)
179
- nokogiri (~> 1.6)
180
- rake (~> 10.0)
210
+ thor (1.3.1)
211
+ timeout (0.4.1)
212
+ tins (1.16.3)
213
+ tzinfo (2.0.6)
214
+ concurrent-ruby (~> 1.0)
215
+ websocket-driver (0.7.6)
216
+ websocket-extensions (>= 0.1.0)
217
+ websocket-extensions (0.1.5)
218
+ workbook (0.8.1)
219
+ axlsx (~> 3.0.0.pre)
220
+ json (~> 2.1)
221
+ nokogiri (~> 1.8)
181
222
  rchardet (~> 1.3)
182
- roo (~> 2.3)
183
- spreadsheet (~> 1.0)
184
- xpath (2.0.0)
185
- nokogiri (~> 1.3)
223
+ spreadsheet (~> 1.1)
224
+ xpath (3.2.0)
225
+ nokogiri (~> 1.8)
226
+ zeitwerk (2.6.14)
186
227
 
187
228
  PLATFORMS
188
229
  ruby
@@ -190,18 +231,15 @@ PLATFORMS
190
231
  DEPENDENCIES
191
232
  bundler
192
233
  capybara (~> 2.1)
234
+ codeclimate-test-reporter
193
235
  coveralls
194
- growl
195
- jquery-rails
196
- pry
197
- pry-nav
198
- rails (~> 4.2.0)
236
+ rails (~> 6.1.0)
199
237
  rake
200
- rb-fsevent
201
- responders (~> 2.0)
238
+ responders (~> 3.0)
202
239
  rspec-rails
240
+ simplecov
203
241
  sqlite3
204
242
  workbook_rails!
205
243
 
206
244
  BUNDLED WITH
207
- 1.11.2
245
+ 2.4.22
data/README.md CHANGED
@@ -3,13 +3,13 @@ Workbook-Rails &mdash; Workbook templates for Rails views
3
3
 
4
4
  [![Gem
5
5
  Version](https://badge.fury.io/rb/workbook_rails.svg)](http://badge.fury.io/rb/workbook_rails)
6
- [![Build Status](https://secure.travis-ci.org/Programatica/workbook_rails.png?branch=master)](http://travis-ci.org/Programatica/workbook_rails)
7
- [![Dependency Status](https://gemnasium.com/Programatica/workbook_rails.png?branch=master)](https://gemnasium.com/Programatica/workbook_rails)
8
- [![Coverage
9
- Status](https://coveralls.io/repos/Programatica/workbook_rails/badge.png)](https://coveralls.io/r/Programatica/workbook_rails)
6
+ [![Build Status](https://github.com/scambra/workbook_rails/actions/workflows/ruby.yml/badge.svg)](https://github.com/scambra/workbook_rails/actions/workflows/ruby.yml)
7
+ [![Maintainability](https://api.codeclimate.com/v1/badges/99cc4757969d308f258c/maintainability)](https://codeclimate.com/github/scambra/workbook_rails/maintainability)
8
+ [![Coverage Status](https://coveralls.io/repos/github/scambra/workbook_rails/badge.svg?branch=master)](https://coveralls.io/github/scambra/workbook_rails?branch=master)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
10
10
 
11
11
 
12
- ##Installation
12
+ ## Installation
13
13
 
14
14
  In your Gemfile:
15
15
 
@@ -17,21 +17,21 @@ In your Gemfile:
17
17
  gem 'workbook_rails'
18
18
  ```
19
19
 
20
- ##Requirements
20
+ ## Requirements
21
21
 
22
- * Rails 3.2, 4.0, 4.1 or 4.2 (tested)
22
+ * Rails 6.0 to 7.1 (tested)
23
23
  * **Workbook 0.4.16 requires Axlsx 2.0.1, which requires rubyzip 1.0.0**
24
24
  * You must use `render_to_string` to render a mail attachment.
25
25
 
26
- ##FYI
26
+ ## FYI
27
27
 
28
28
  * This gem depends on [Workbook](https://github.com/murb/workbook). See [README](https://github.com/murb/workbook) or [rdoc](http://www.rubydoc.info/github/murb/workbook) for usage.
29
29
 
30
- ##Usage
30
+ ## Usage
31
31
 
32
32
  Workbook-Rails provides a renderer and a template handler. It adds the `:xlsx` and `:xls` formats and parses `.wb` templates. This lets you take all the [Workbook](https://github.com/murb/workbook) code out of your controller or model and place it inside the template, where view code belongs!
33
33
 
34
- ###Controller
34
+ ### Controller
35
35
 
36
36
  To use Workbook-Rails set your instance variables in your controller and configure the response if needed:
37
37
 
@@ -46,7 +46,7 @@ class ButtonController < ApplicationController
46
46
  end
47
47
  ```
48
48
 
49
- ###Template
49
+ ### Template
50
50
 
51
51
  Create the template with the `.xlsx.wb` extension (`action_name.xlsx.wb` for example.) [**Watch out for typos!**](#troubleshooting) In the template, use workbook variable to create your spreadsheet:
52
52
 
@@ -63,7 +63,7 @@ Remember, like in `erb` templates, view helpers are available to use the `.wb` t
63
63
 
64
64
  That's it. Call your action and your spreadsheet will be delivered.
65
65
 
66
- ###Rendering Options
66
+ ### Rendering Options
67
67
 
68
68
  You can call render in any of the following ways:
69
69
 
@@ -78,7 +78,7 @@ render xlsx: 'buttons'
78
78
  render xlsx: 'latest_buttons', template: 'featured/latest'
79
79
  ```
80
80
 
81
- ###Multi-format Templates
81
+ ### Multi-format Templates
82
82
 
83
83
  You can create a template with `.wb` extension, without format, and use for generating different spreadsheets formats, such as xls and xlsx, using respond_to and format param.
84
84
 
@@ -91,7 +91,7 @@ respond_to do |format|
91
91
  end
92
92
  ```
93
93
 
94
- ###Disposition
94
+ ### Disposition
95
95
 
96
96
  To specify a disposition (such as `inline` so the spreadsheet is opened inside the browser), use the `disposition` option:
97
97
 
@@ -101,7 +101,7 @@ render xlsx: "buttons", disposition: 'inline'
101
101
 
102
102
  If `render xlsx:` is called, the disposition defaults to `attachment`.
103
103
 
104
- ###File name
104
+ ### File name
105
105
 
106
106
  If Rails calls Workbook through default channels (because you use `format.xlsx {}` for example) you must set the filename using the response header:
107
107
 
@@ -120,13 +120,7 @@ render xlsx: 'buttons'
120
120
  render xlsx: 'latest_buttons', template: 'featured/latest'
121
121
  ```
122
122
 
123
- If that fails, pass the `:filename` parameter:
124
-
125
- ```ruby
126
- render xlsx: "action_or_template", filename: "my_new_filename.xlsx"
127
- ```
128
-
129
- ###Partials
123
+ ### Partials
130
124
 
131
125
  Partials work as expected:
132
126
 
@@ -143,7 +137,7 @@ sheet.name = "Cover Sheet"
143
137
  sheet.table.push ['Cover', 'Sheet']
144
138
  ```
145
139
 
146
- ###Mailers
140
+ ### Mailers
147
141
 
148
142
  To use an xlsx template to render a mail attachment, use the following syntax:
149
143
 
@@ -160,16 +154,16 @@ end
160
154
  * If the route specifies or suggests the `:xlsx` format you do not need to specify `formats` or `handlers`.
161
155
  * If the template (`users/export`) can refer to only one file (the xlsx.axlsx template), you do not need to specify `handlers`, provided the `formats` includes `:xlsx`.
162
156
 
163
- ###Scripts
157
+ ### Scripts
164
158
 
165
159
  To generate a template within a script, you need to instantiate an ActionView context. Here are two gists showing how to perform this:
166
160
 
167
161
  * [Using rails runner](https://gist.github.com/straydogstudio/323139591f2cc5d48fbc)
168
162
  * [Without rails runner](https://gist.github.com/straydogstudio/dceb775ead81470cea70)
169
163
 
170
- ##Troubleshooting
164
+ ## Troubleshooting
171
165
 
172
- ###Mispellings
166
+ ### Mispellings
173
167
 
174
168
  **It is easy to get the spelling wrong in the extension name, the format.xlsx statement, or in a render call.** Here are some possibilities:
175
169
 
@@ -198,19 +192,19 @@ If the request format matches you should be able to call:
198
192
 
199
193
  This is a breaking change if you have the old syntax!
200
194
 
201
- ###What to do
195
+ ### What to do
202
196
 
203
197
  If you are having problems, try to isolate the issue. Use the console or a script to make sure your data is good. Then create the spreadsheet line by line without Workbook-Rails to see if you are having Workbook problems. If you can manually create the spreadsheet, create an issue and we will work it out.
204
198
 
205
- ##Dependencies
199
+ ## Dependencies
206
200
 
207
201
  - [Rails](https://github.com/rails/rails)
208
202
  - [Workbook](https://github.com/murb/workbook)
209
203
 
210
- ##Authors
204
+ ## Authors
211
205
 
212
206
  * [Sergio Cambra](https://github.com/scambra)
213
207
 
214
- ##Thanks
208
+ ## Thanks
215
209
 
216
210
  Many thanks to [straydogstudio](https://github.com/straydogstudio) for [axlsx_rails](https://github.com/straydogstudio/axlsx_rails), which this gem is based in.
data/Rakefile CHANGED
@@ -20,8 +20,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
- require "rspec/core/rake_task"
24
- RSpec::Core::RakeTask.new('spec')
23
+ begin
24
+ require "rspec/core/rake_task"
25
+ RSpec::Core::RakeTask.new('spec')
26
+ rescue LoadError
27
+ end
25
28
 
26
29
  task :default => :spec
27
30
 
@@ -21,22 +21,19 @@ WorkbookRails::FORMATS.each do |format|
21
21
 
22
22
  # disposition / filename
23
23
  disposition = options.delete(:disposition) || 'attachment'
24
- if file_name = options.delete(:filename)
24
+ if (file_name = options.delete(:filename))
25
25
  file_name += ".#{format}" unless file_name =~ /\.#{format}$/
26
26
  else
27
27
  file_name = "#{filename.gsub(/^.*\//,'')}.#{format}"
28
28
  end
29
29
 
30
- options = options.merge(:formats => [format])
31
- send_data render_to_string(options), :filename => file_name, :type => Mime::Type.lookup_by_extension(format), :disposition => disposition
30
+ options = options.merge(layout: false)
31
+ send_data render_to_string(options), filename: file_name, type: Mime[format], disposition: disposition
32
32
  end
33
33
  end
34
34
 
35
35
  # For respond_to default
36
- begin
37
- ActionController::Responder
38
- rescue
39
- else
36
+ if ActionController.const_defined? 'Responder'
40
37
  class ActionController::Responder
41
38
  WorkbookRails::FORMATS.each do |format|
42
39
  define_method "to_#{format}" do
@@ -48,4 +45,4 @@ else
48
45
  end
49
46
  end
50
47
  end
51
- end
48
+ end