draper 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -1
- data/Gemfile +3 -3
- data/Rakefile +8 -8
- data/Readme.markdown +41 -22
- data/doc/css/full_list.css +2 -2
- data/doc/css/style.css +30 -30
- data/doc/js/app.js +10 -10
- data/doc/js/full_list.js +8 -8
- data/draper.gemspec +2 -2
- data/lib/draper.rb +1 -1
- data/lib/draper/base.rb +65 -22
- data/lib/draper/decorated_enumerable_proxy.rb +6 -1
- data/lib/draper/model_support.rb +2 -2
- data/lib/draper/railtie.rb +19 -0
- data/lib/draper/system.rb +7 -4
- data/lib/draper/version.rb +1 -1
- data/lib/generators/draper/decorator/decorator_generator.rb +26 -4
- data/lib/generators/draper/decorator/templates/decorator.rb +2 -2
- data/lib/generators/{rspec → draper/decorator}/templates/decorator_spec.rb +1 -1
- data/lib/generators/{test_unit → draper/decorator}/templates/decorator_test.rb +1 -1
- data/lib/generators/draper/install/install_generator.rb +6 -6
- data/lib/generators/rails/decorator_generator.rb +3 -3
- data/performance/bechmark.rb +5 -5
- data/performance/decorators.rb +4 -4
- data/performance/models.rb +2 -2
- data/spec/draper/base_spec.rb +176 -10
- data/spec/draper/helper_support_spec.rb +1 -1
- data/spec/draper/model_support_spec.rb +23 -14
- data/spec/draper/view_context_spec.rb +4 -4
- data/spec/generators/draper/decorator/decorator_generator_spec.rb +81 -1
- data/spec/generators/draper/install/install_generator_spec.rb +5 -5
- data/spec/spec_helper.rb +3 -0
- data/spec/support/samples/application_controller.rb +8 -11
- data/spec/support/samples/decorator_with_allows.rb +1 -1
- data/spec/support/samples/decorator_with_application_helper.rb +5 -5
- data/spec/support/samples/decorator_with_denies.rb +1 -1
- data/spec/support/samples/decorator_with_multiple_allows.rb +4 -0
- data/spec/support/samples/product.rb +28 -7
- data/spec/support/samples/some_thing.rb +2 -0
- data/spec/support/samples/some_thing_decorator.rb +3 -0
- metadata +62 -37
- data/lib/generators/rspec/decorator_generator.rb +0 -11
- data/lib/generators/test_unit/decorator_generator.rb +0 -11
- data/spec/generators/rspec/decorator_generator_spec.rb +0 -22
- data/spec/generators/test_unit/decorator_generator_spec.rb +0 -22
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -4,10 +4,10 @@ gem 'rake'
|
|
4
4
|
gem 'rspec', '~> 2.0'
|
5
5
|
gem 'activesupport', '~> 3.1.3'
|
6
6
|
gem 'actionpack', "~> 3.1.3", :require => 'action_view'
|
7
|
-
gem 'ammeter', '~> 0.
|
7
|
+
gem 'ammeter', '~> 0.2.2', :require => 'ammeter/init'
|
8
8
|
gem 'guard'
|
9
9
|
gem 'guard-rspec'
|
10
|
-
gem 'launchy'
|
10
|
+
gem 'launchy'
|
11
11
|
gem 'yard'
|
12
12
|
|
13
|
-
gemspec
|
13
|
+
gemspec
|
data/Rakefile
CHANGED
@@ -2,31 +2,31 @@ require 'bundler/gem_tasks'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'rspec/core/rake_task'
|
4
4
|
|
5
|
-
RCOV = RUBY_VERSION.to_f == 1.8
|
5
|
+
RCOV = RUBY_VERSION.to_f == 1.8
|
6
6
|
|
7
7
|
namespace :spec do
|
8
|
-
|
8
|
+
|
9
9
|
RSpec::Core::RakeTask.new(:coverage) do |t|
|
10
10
|
t.pattern = 'spec/**/*_spec.rb'
|
11
|
-
|
12
|
-
if RCOV
|
11
|
+
|
12
|
+
if RCOV
|
13
13
|
t.rcov = true
|
14
14
|
t.rcov_opts = '--exclude osx\/objc,spec,gems\/'
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
RSpec::Core::RakeTask.new(:normal) do |t|
|
19
19
|
t.pattern ='spec/**/*_spec.rb'
|
20
20
|
t.rcov = false
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
namespace :coverage do
|
24
24
|
desc "Cleanup coverage data"
|
25
25
|
task :cleanup do
|
26
26
|
rm_rf 'coverage.data'
|
27
27
|
rm_rf 'coverage'
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
desc "Browse the code coverage report."
|
31
31
|
task :report => ["spec:coverage:cleanup", "spec:coverage"] do
|
32
32
|
if RCOV
|
@@ -38,7 +38,7 @@ namespace :spec do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
end
|
43
43
|
|
44
44
|
desc "RSpec tests"
|
data/Readme.markdown
CHANGED
@@ -30,20 +30,17 @@ Ryan Bates has put together an excellent RailsCast on Draper based on the 0.8.0
|
|
30
30
|
|
31
31
|
## What's New
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
*
|
38
|
-
*
|
39
|
-
*
|
40
|
-
*
|
41
|
-
*
|
42
|
-
|
43
|
-
|
44
|
-
* `.1`: Refactored how methods are selected for delegation to the wrapped model
|
45
|
-
* `.0`: Fixed how the view context is stored to resolve cross-request issues
|
46
|
-
* `.0`: Decorated collections now return a collection proxy instead of an array, which fixes many compatibility issues
|
33
|
+
Check out the full commit history at https://github.com/jcasimir/draper/compare/ad94f54369deabd11315fc241c66b74a30adec0a...04bb00505b7832419fddba20e5068317610eb38d
|
34
|
+
|
35
|
+
In summary, you can now:
|
36
|
+
|
37
|
+
* [Namespace the `decorates` call](https://github.com/jcasimir/draper/commit/1c3d5667b8406b80b490d876257379087b129f92)
|
38
|
+
* [Use your decorators with CanCan](https://github.com/jcasimir/draper/commit/ac1f3083989107d877e2b1c918c3a3e792db99e8)
|
39
|
+
* [Use a more generalized `options` hash in decorator initialization](https://github.com/jcasimir/draper/commit/03910877d0461356da0968a87346592908f292a7)
|
40
|
+
* [Get better performance by generating methods](https://github.com/jcasimir/draper/commit/ebe30511b79eac82276413ca7ae54a4a4d86d4dc)
|
41
|
+
* [Automatically decorate associated objects](https://github.com/jcasimir/draper/commit/1580baa287997ed4e356aae0ffeeb8fe9c326ced) See Example near bottom of Readme
|
42
|
+
|
43
|
+
Thanks to [steveklabnik](http://github.com/steveklabnik), [i0rek](http://github.com/i0rek), [laserlemon](http://github.com/laserlemon), [michaelfairley](http://github.com/michaelfairley), [dnagir](http://github.com/dnagir), [ubermajestix](http://github.com/ubermajestix), [tmaier](http://github.com/tmaier), [angelim](http://github.com/angelim), [duncanbeevers](http://github.com/duncanbeevers), Albert Peng & JR Boyens, [leocassarani](http://github.com/leocassarani), [Jeff Felchner](http://github.com/Felchner), [shingara](http://github.com/shingara), [momolog](http://github.com/momolog), and [ayamomiji](http://github.com/ayamomiji) for their contributions to this version!
|
47
44
|
|
48
45
|
## Goals
|
49
46
|
|
@@ -238,15 +235,11 @@ Use the new methods in your views like any other model method (ex: `@article.pub
|
|
238
235
|
### Using in Mailers
|
239
236
|
|
240
237
|
To use decorators in mailers that use helpers, you have to call `set_current_view_context` in your
|
241
|
-
|
238
|
+
ActionMailer class.
|
242
239
|
|
243
240
|
```ruby
|
244
|
-
class
|
245
|
-
|
246
|
-
set_current_view_context
|
247
|
-
@article_decorator = ArticleDecorator.decorate(article)
|
248
|
-
mail(:to => 'come@me.bro', :subject => "New Article: #{@article_decorator.title}")
|
249
|
-
end
|
241
|
+
class ArticleMailer < ActionMailer::Base
|
242
|
+
defaults 'init-draper' => Proc.new { set_current_view_context }
|
250
243
|
end
|
251
244
|
```
|
252
245
|
### Integration with RSpec
|
@@ -269,7 +262,7 @@ Here are some ideas of what you might do in decorator methods:
|
|
269
262
|
|
270
263
|
## Example Using a Decorator
|
271
264
|
|
272
|
-
For a brief tutorial with sample project, check this out: http://tutorials.jumpstartlab.com/
|
265
|
+
For a brief tutorial with sample project, check this out: http://tutorials.jumpstartlab.com/topics/decorators.html
|
273
266
|
|
274
267
|
Say I have a publishing system with `Article` resources. My designer decides that whenever we print the `published_at` timestamp, it should be constructed like this:
|
275
268
|
|
@@ -329,6 +322,32 @@ class ArticleDecorator < ApplicationDecorator
|
|
329
322
|
end
|
330
323
|
end
|
331
324
|
```
|
325
|
+
|
326
|
+
### Example of Decorated Associations
|
327
|
+
|
328
|
+
Add a `decorates_association :association_name` to gain access to a decorated version of your target association.
|
329
|
+
|
330
|
+
```ruby
|
331
|
+
class ArticleDecorator < ApplicationDecorator
|
332
|
+
decorates :article
|
333
|
+
decorates_association :author # belongs_to :author association
|
334
|
+
end
|
335
|
+
|
336
|
+
class AuthorDecorator < ApplicationDecorator
|
337
|
+
decorates :author
|
338
|
+
|
339
|
+
def fancy_name
|
340
|
+
"#{model.title}. #{model.first_name} #{model.middle_name[0]}. #{model.last_name}"
|
341
|
+
end
|
342
|
+
end
|
343
|
+
```
|
344
|
+
|
345
|
+
Now when you call the association it will use a decorator.
|
346
|
+
|
347
|
+
```ruby
|
348
|
+
<%= @article.author.fancy_name %>
|
349
|
+
```
|
350
|
+
|
332
351
|
## Issues / Pending
|
333
352
|
|
334
353
|
* Documentation
|
data/doc/css/full_list.css
CHANGED
data/doc/css/style.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
body {
|
1
|
+
body {
|
2
2
|
padding: 0 20px;
|
3
|
-
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
|
3
|
+
font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
|
4
4
|
font-size: 13px;
|
5
5
|
}
|
6
6
|
body.frames { padding: 0 5px; }
|
@@ -8,7 +8,7 @@ h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dot
|
|
8
8
|
h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; }
|
9
9
|
h1.title { margin-bottom: 10px; }
|
10
10
|
h1.alphaindex { margin-top: 0; font-size: 22px; }
|
11
|
-
h2 {
|
11
|
+
h2 {
|
12
12
|
padding: 0;
|
13
13
|
padding-bottom: 3px;
|
14
14
|
border-bottom: 1px #aaa solid;
|
@@ -34,9 +34,9 @@ h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right;
|
|
34
34
|
#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; }
|
35
35
|
#filecontents dd > p, .docstring dd > p { margin: 0px; }
|
36
36
|
|
37
|
-
.note {
|
37
|
+
.note {
|
38
38
|
color: #222;
|
39
|
-
-moz-border-radius: 3px; -webkit-border-radius: 3px;
|
39
|
+
-moz-border-radius: 3px; -webkit-border-radius: 3px;
|
40
40
|
background: #e3e4e3; border: 1px solid #d5d5d5; padding: 7px 10px;
|
41
41
|
display: block;
|
42
42
|
}
|
@@ -47,9 +47,9 @@ h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right;
|
|
47
47
|
.note.title { text-transform: lowercase; padding: 1px 5px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; }
|
48
48
|
.summary_signature + .note.title { margin-left: 7px; }
|
49
49
|
h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; }
|
50
|
-
.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; }
|
51
|
-
.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; }
|
52
|
-
.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; }
|
50
|
+
.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; }
|
51
|
+
.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; }
|
52
|
+
.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; }
|
53
53
|
.note.title.private { background: #d5d5d5; border-color: #c5c5c5; }
|
54
54
|
.discussion .note { margin-top: 6px; }
|
55
55
|
.discussion .note:first-child { margin-top: 0; }
|
@@ -123,9 +123,9 @@ dl.constants .discussion *:last-child { margin-bottom: 0; }
|
|
123
123
|
|
124
124
|
.method_details { border-top: 1px dotted #aaa; margin-top: 15px; padding-top: 0; }
|
125
125
|
.method_details.first { border: 0; }
|
126
|
-
p.signature {
|
127
|
-
font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace;
|
128
|
-
padding: 6px 10px; margin-top: 18px;
|
126
|
+
p.signature {
|
127
|
+
font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace;
|
128
|
+
padding: 6px 10px; margin-top: 18px;
|
129
129
|
background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px;
|
130
130
|
}
|
131
131
|
p.signature tt { font-family: Monaco, Consolas, Courier, monospace; }
|
@@ -145,7 +145,7 @@ p.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace;
|
|
145
145
|
.tags .examples h4 { padding: 0; margin: 0; margin-left: 15px; font-weight: bold; font-size: 0.9em; }
|
146
146
|
|
147
147
|
.tags .overload .overload_item { list-style: none; margin-bottom: 25px; }
|
148
|
-
.tags .overload .overload_item .signature {
|
148
|
+
.tags .overload .overload_item .signature {
|
149
149
|
padding: 2px 8px;
|
150
150
|
background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px;
|
151
151
|
}
|
@@ -169,19 +169,19 @@ ul.summary {
|
|
169
169
|
font-size: 1em;
|
170
170
|
line-height: 1.5em;
|
171
171
|
}
|
172
|
-
ul.summary a:link, ul.summary a:visited {
|
172
|
+
ul.summary a:link, ul.summary a:visited {
|
173
173
|
text-decoration: none; font-size: 1.1em;
|
174
174
|
}
|
175
175
|
ul.summary li { margin-bottom: 5px; }
|
176
|
-
.summary .summary_signature {
|
176
|
+
.summary .summary_signature {
|
177
177
|
padding: 1px 10px;
|
178
178
|
background: #eaeaff; border: 1px solid #dfdfe5;
|
179
|
-
-moz-border-radius: 3px; -webkit-border-radius: 3px;
|
179
|
+
-moz-border-radius: 3px; -webkit-border-radius: 3px;
|
180
180
|
}
|
181
181
|
.summary_signature:hover { background: #eeeeff; cursor: pointer; }
|
182
182
|
ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;}
|
183
183
|
ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; }
|
184
|
-
#content .summary_signature:hover a:link,
|
184
|
+
#content .summary_signature:hover a:link,
|
185
185
|
#content .summary_signature:hover a:visited {
|
186
186
|
background: transparent;
|
187
187
|
color: #48f;
|
@@ -204,18 +204,18 @@ ul.fullTree li:last-child { padding-bottom: 0; }
|
|
204
204
|
.showAll .inheritName { display: none; }
|
205
205
|
|
206
206
|
#search { position: absolute; right: 14px; top: 0px; }
|
207
|
-
#search a:link, #search a:visited {
|
207
|
+
#search a:link, #search a:visited {
|
208
208
|
display: block; float: left; margin-right: 4px;
|
209
209
|
padding: 8px 10px; text-decoration: none; color: #05a;
|
210
210
|
border: 1px solid #d8d8e5;
|
211
|
-
-moz-border-radius-bottomleft: 3px; -moz-border-radius-bottomright: 3px;
|
211
|
+
-moz-border-radius-bottomleft: 3px; -moz-border-radius-bottomright: 3px;
|
212
212
|
-webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px;
|
213
213
|
background: #eaf0ff;
|
214
214
|
-webkit-box-shadow: -1px 1px 3px #ddd;
|
215
215
|
}
|
216
216
|
#search a:hover { background: #f5faff; color: #06b; }
|
217
|
-
#search a.active {
|
218
|
-
background: #568; padding-bottom: 20px; color: #fff; border: 1px solid #457;
|
217
|
+
#search a.active {
|
218
|
+
background: #568; padding-bottom: 20px; color: #fff; border: 1px solid #457;
|
219
219
|
-moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;
|
220
220
|
-webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px;
|
221
221
|
}
|
@@ -249,8 +249,8 @@ li.r2 { background: #fafafa; }
|
|
249
249
|
z-index: 9999;
|
250
250
|
background: #fff;
|
251
251
|
display: none;
|
252
|
-
position: absolute;
|
253
|
-
top: 36px;
|
252
|
+
position: absolute;
|
253
|
+
top: 36px;
|
254
254
|
right: 18px;
|
255
255
|
width: 500px;
|
256
256
|
height: 80%;
|
@@ -266,7 +266,7 @@ li.r2 { background: #fafafa; }
|
|
266
266
|
#content ul.summary li.deprecated .summary_signature a:link,
|
267
267
|
#content ul.summary li.deprecated .summary_signature a:visited { text-decoration: line-through; font-style: italic; }
|
268
268
|
|
269
|
-
#toc {
|
269
|
+
#toc {
|
270
270
|
padding: 20px; padding-right: 30px; border: 1px solid #ddd; float: right; background: #fff; margin-left: 20px; margin-bottom: 20px;
|
271
271
|
max-width: 300px;
|
272
272
|
-webkit-box-shadow: -2px 2px 6px #bbb;
|
@@ -291,7 +291,7 @@ li.r2 { background: #fafafa; }
|
|
291
291
|
#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; }
|
292
292
|
#filecontents pre.code, .docstring pre.code { display: block; }
|
293
293
|
.source_code .lines { padding-right: 12px; color: #555; text-align: right; }
|
294
|
-
#filecontents pre.code, .docstring pre.code,
|
294
|
+
#filecontents pre.code, .docstring pre.code,
|
295
295
|
.tags .example { padding: 5px 12px; margin-top: 4px; border: 1px solid #eef; background: #f5f5ff; }
|
296
296
|
pre.code { color: #000; }
|
297
297
|
pre.code .info.file { color: #555; }
|
@@ -300,21 +300,21 @@ pre.code .tstring_content,
|
|
300
300
|
pre.code .heredoc_beg, pre.code .heredoc_end,
|
301
301
|
pre.code .qwords_beg, pre.code .qwords_end,
|
302
302
|
pre.code .tstring, pre.code .dstring { color: #036A07; }
|
303
|
-
pre.code .fid, pre.code .id.new, pre.code .id.to_s,
|
304
|
-
pre.code .id.to_sym, pre.code .id.to_f,
|
303
|
+
pre.code .fid, pre.code .id.new, pre.code .id.to_s,
|
304
|
+
pre.code .id.to_sym, pre.code .id.to_f,
|
305
305
|
pre.code .dot + pre.code .id,
|
306
306
|
pre.code .id.to_i pre.code .id.each { color: #0085FF; }
|
307
307
|
pre.code .comment { color: #0066FF; }
|
308
308
|
pre.code .const, pre.code .constant { color: #585CF6; }
|
309
309
|
pre.code .symbol { color: #C5060B; }
|
310
|
-
pre.code .kw,
|
310
|
+
pre.code .kw,
|
311
311
|
pre.code .label,
|
312
|
-
pre.code .id.require,
|
312
|
+
pre.code .id.require,
|
313
313
|
pre.code .id.extend,
|
314
314
|
pre.code .id.include { color: #0000FF; }
|
315
315
|
pre.code .ivar { color: #318495; }
|
316
|
-
pre.code .gvar,
|
317
|
-
pre.code .id.backref,
|
316
|
+
pre.code .gvar,
|
317
|
+
pre.code .id.backref,
|
318
318
|
pre.code .id.nth_ref { color: #6D79DE; }
|
319
319
|
pre.code .regexp, .dregexp { color: #036A07; }
|
320
320
|
pre.code a { border-bottom: 1px dotted #bbf; }
|
data/doc/js/app.js
CHANGED
@@ -44,7 +44,7 @@ function createFullTreeLinks() {
|
|
44
44
|
|
45
45
|
function fixBoxInfoHeights() {
|
46
46
|
$('dl.box dd.r1, dl.box dd.r2').each(function() {
|
47
|
-
$(this).prev().height($(this).height());
|
47
|
+
$(this).prev().height($(this).height());
|
48
48
|
});
|
49
49
|
}
|
50
50
|
|
@@ -113,7 +113,7 @@ function summaryToggle() {
|
|
113
113
|
if (next.hasClass('compact')) {
|
114
114
|
next.toggle();
|
115
115
|
next.next().toggle();
|
116
|
-
}
|
116
|
+
}
|
117
117
|
else if (next.hasClass('summary')) {
|
118
118
|
var list = $('<ul class="summary compact" />');
|
119
119
|
list.html(next.html());
|
@@ -159,13 +159,13 @@ function generateTOC() {
|
|
159
159
|
if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
|
160
160
|
this.id = proposedId;
|
161
161
|
}
|
162
|
-
if (thisTag > lastTag) {
|
163
|
-
for (i = 0; i < thisTag - lastTag; i++) {
|
164
|
-
var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
|
165
|
-
}
|
162
|
+
if (thisTag > lastTag) {
|
163
|
+
for (i = 0; i < thisTag - lastTag; i++) {
|
164
|
+
var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
|
165
|
+
}
|
166
166
|
}
|
167
|
-
if (thisTag < lastTag) {
|
168
|
-
for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
|
167
|
+
if (thisTag < lastTag) {
|
168
|
+
for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
|
169
169
|
}
|
170
170
|
toc.append('<li><a href="#' + this.id + '">' + $(this).text() + '</a></li>');
|
171
171
|
lastTag = thisTag;
|
@@ -174,7 +174,7 @@ function generateTOC() {
|
|
174
174
|
html = '<div id="toc"><p class="title"><a class="hide_toc" href="#"><strong>Table of Contents</strong></a> <small>(<a href="#" class="float_toc">left</a>)</small></p></div>';
|
175
175
|
$('#content').prepend(html);
|
176
176
|
$('#toc').append(_toc);
|
177
|
-
$('#toc .hide_toc').toggle(function() {
|
177
|
+
$('#toc .hide_toc').toggle(function() {
|
178
178
|
$('#toc .top').slideUp('fast');
|
179
179
|
$('#toc').toggleClass('hidden');
|
180
180
|
$('#toc .title small').toggle();
|
@@ -183,7 +183,7 @@ function generateTOC() {
|
|
183
183
|
$('#toc').toggleClass('hidden');
|
184
184
|
$('#toc .title small').toggle();
|
185
185
|
});
|
186
|
-
$('#toc .float_toc').toggle(function() {
|
186
|
+
$('#toc .float_toc').toggle(function() {
|
187
187
|
$(this).text('float');
|
188
188
|
$('#toc').toggleClass('nofloat');
|
189
189
|
}, function() {
|
data/doc/js/full_list.js
CHANGED
@@ -10,7 +10,7 @@ function fullListSearch() {
|
|
10
10
|
var link = $(this).find('.object_link a');
|
11
11
|
searchCache.push({name:link.text(), node:$(this), link:link});
|
12
12
|
});
|
13
|
-
|
13
|
+
|
14
14
|
$('#search input').keyup(function() {
|
15
15
|
searchString = this.value.toLowerCase();
|
16
16
|
if (searchString === "") {
|
@@ -18,9 +18,9 @@ function fullListSearch() {
|
|
18
18
|
inSearch = null;
|
19
19
|
$('#full_list, #content').removeClass('insearch');
|
20
20
|
$('#full_list li').removeClass('found').each(function() {
|
21
|
-
|
21
|
+
|
22
22
|
var link = $(this).find('.object_link a');
|
23
|
-
link.text(link.text());
|
23
|
+
link.text(link.text());
|
24
24
|
});
|
25
25
|
if (clicked) {
|
26
26
|
clicked.parents('ul').each(function() {
|
@@ -38,7 +38,7 @@ function fullListSearch() {
|
|
38
38
|
searchItem();
|
39
39
|
}
|
40
40
|
});
|
41
|
-
|
41
|
+
|
42
42
|
$('#search input').focus();
|
43
43
|
$('#full_list').after("<div id='noresults'></div>");
|
44
44
|
}
|
@@ -54,8 +54,8 @@ function searchItem() {
|
|
54
54
|
item.node.css('padding-left', '10px').addClass('found');
|
55
55
|
item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
|
56
56
|
lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
|
57
|
-
item.link.html(item.name.replace(new RegExp("(" +
|
58
|
-
searchString.replace(/([\/.*+?|()\[\]{}\\])/g, "\\$1") + ")", "ig"),
|
57
|
+
item.link.html(item.name.replace(new RegExp("(" +
|
58
|
+
searchString.replace(/([\/.*+?|()\[\]{}\\])/g, "\\$1") + ")", "ig"),
|
59
59
|
'<strong>$1</strong>'));
|
60
60
|
}
|
61
61
|
|
@@ -110,10 +110,10 @@ function linkList() {
|
|
110
110
|
|
111
111
|
function collapse() {
|
112
112
|
if (!$('#full_list').hasClass('class')) return;
|
113
|
-
$('#full_list.class a.toggle').click(function() {
|
113
|
+
$('#full_list.class a.toggle').click(function() {
|
114
114
|
$(this).parent().toggleClass('collapsed').next().toggleClass('collapsed');
|
115
115
|
highlight();
|
116
|
-
return false;
|
116
|
+
return false;
|
117
117
|
});
|
118
118
|
$('#full_list.class ul').each(function() {
|
119
119
|
$(this).addClass('collapsed').prev().addClass('collapsed');
|
data/draper.gemspec
CHANGED
@@ -5,8 +5,8 @@ require "draper/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "draper"
|
7
7
|
s.version = Draper::VERSION
|
8
|
-
s.authors = ["Jeff Casimir"]
|
9
|
-
s.email = ["jeff@casimircreative.com"]
|
8
|
+
s.authors = ["Jeff Casimir", "Steve Klabnik"]
|
9
|
+
s.email = ["jeff@casimircreative.com", "steve@steveklabnik.com"]
|
10
10
|
s.homepage = "http://github.com/jcasimir/draper"
|
11
11
|
s.summary = "Decorator pattern implementation for Rails."
|
12
12
|
s.description = "Draper implements a decorator or presenter pattern for Rails applications."
|