cells 3.11.0 → 3.11.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6c53e5fa8e782efe252f69d45eb54744307783f3
4
+ data.tar.gz: 011cdedbdaacfed0a06b8cdbddbec0e7d2cd8745
5
+ SHA512:
6
+ metadata.gz: 69598d8a734a02879d669d80a0c992eb112f4fb93b09acb7ab6825a2239e802510fa0a32a81cc83956963c838eda5859610cce115b67b8a6aea14d387f55c2f7
7
+ data.tar.gz: 425bd7009da186564e92bb54cfeec06d950be7704947c66a5a4cb113f957807a482ef54eaab399bc3872e2ddb1480cfaa876cb4c314053f3512dcba061e38370
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 3.11.1
2
+
3
+ * Override `ActionView::Helpers::UrlHelper#url_for` in Rails 4.x as it is troublesome. That removes the annoying
4
+ `arguments passed to url_for can't be handled. Please require routes or provide your own implementation`
5
+ exception when using simple_form, form_for, etc with a view model.
6
+
7
+
1
8
  ## 3.11.0
2
9
 
3
10
  * Deprecated `Cell::Rails::ViewModel`, please inherit: `class SongCell < Cell::ViewModel`.
@@ -15,6 +22,7 @@
15
22
  ### Concept
16
23
  * `#concept` helper is mixed into all views as an alternative to `#cell` and `#render_cell`. Let us know if we should do that conditionally, only.
17
24
  * Concept cells look for layouts in their self-contained views directory.
25
+ * Add generator for Concept cells: `rails g concept Comment`
18
26
 
19
27
  ## 3.10.1
20
28
 
data/README.md CHANGED
@@ -472,7 +472,7 @@ The `render` call will render the cell's `show` view.
472
472
  = author_box
473
473
  ```
474
474
 
475
- We strongly recommend to invoke methods, only, in views and not to use instance variables and locals. In a view model template (or, view), methods are called on the view model instance itself, meaning you can easily expose "helpers" by defining instance methods.
475
+ We strongly recommend to only invoke _methods_ in views and _not_ to use instance variables and locals. In a view model template (or, view), methods are called on the view model instance itself, meaning you can easily expose "helpers" by defining instance methods.
476
476
 
477
477
  ### Helpers
478
478
 
@@ -1,6 +1,7 @@
1
1
  # TODO: deprecate parent_controller, ViewModel
2
2
  class Cell::Concept < Cell::ViewModel
3
3
  abstract!
4
+ self.view_paths = "app/concepts"
4
5
 
5
6
  # TODO: this should be in Helper or something. this should be the only entry point from controller/view.
6
7
  class << self
@@ -6,6 +6,7 @@
6
6
 
7
7
  # TODO: warn when using ::property but not passing in model in constructor.
8
8
 
9
+ # ViewModel is only supported in Rails +3.1. If you need it in Rails 3.0, let me know.
9
10
  class Cell::ViewModel < Cell::Rails
10
11
  abstract!
11
12
 
@@ -86,64 +87,25 @@ private
86
87
 
87
88
  # FIXME: this module is to fix a design flaw in Rails 4.0. the problem is that AV::UrlHelper mixes in the wrong #url_for.
88
89
  # if we could mix in everything else from the helper except for the #url_for, it would be fine.
89
- module LinkToHelper
90
- include ActionView::Helpers::TagHelper
91
-
92
- def link_to(name = nil, options = nil, html_options = nil, &block)
93
- html_options, options, name = options, name, block if block_given?
94
- options ||= {}
95
-
96
- html_options = convert_options_to_data_attributes(options, html_options)
97
-
98
- url = url_for(options)
99
- html_options['href'] ||= url
100
-
101
- content_tag(:a, name || url, html_options, &block)
102
- end
103
-
104
- def convert_options_to_data_attributes(options, html_options)
105
- if html_options
106
- html_options = html_options.stringify_keys
107
- html_options['data-remote'] = 'true' if link_to_remote_options?(options) || link_to_remote_options?(html_options)
108
-
109
- disable_with = html_options.delete("disable_with")
110
- confirm = html_options.delete('confirm')
111
- method = html_options.delete('method')
112
-
113
- if confirm
114
- message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
115
- "Use 'data: { confirm: \'Text\' }' instead."
116
- ActiveSupport::Deprecation.warn message
117
-
118
- html_options["data-confirm"] = confirm
119
- end
120
-
121
- add_method_to_attributes!(html_options, method) if method
122
-
123
- if disable_with
124
- message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
125
- "Use 'data: { disable_with: \'Text\' }' instead."
126
- ActiveSupport::Deprecation.warn message
127
-
128
- html_options["data-disable-with"] = disable_with
129
- end
130
-
131
- html_options
90
+ # FIXME: fix that in rails core.
91
+ if Cell.rails_version.~("4.0", "4.1")
92
+ include ActionView::Helpers::UrlHelper # gives us breaking #url_for.
93
+
94
+ def url_for(options = nil) # from ActionDispatch:R:UrlFor.
95
+ case options
96
+ when nil
97
+ _routes.url_for(url_options.symbolize_keys)
98
+ when Hash
99
+ _routes.url_for(options.symbolize_keys.reverse_merge!(url_options))
100
+ when String
101
+ options
102
+ when Array
103
+ polymorphic_url(options, options.extract_options!)
132
104
  else
133
- link_to_remote_options?(options) ? {'data-remote' => 'true'} : {}
105
+ polymorphic_url(options)
134
106
  end
135
107
  end
136
-
137
- def link_to_remote_options?(options)
138
- if options.is_a?(Hash)
139
- options.delete('remote') || options.delete(:remote)
140
- end
141
- end
142
- end
143
-
144
- # FIXME: fix that in rails core.
145
- if Cell.rails_version.~("4.0", "4.1")
146
- include LinkToHelper
108
+ public :url_for
147
109
  else
148
110
  include ActionView::Helpers::UrlHelper
149
111
  end
@@ -1,3 +1,3 @@
1
1
  module Cells
2
- VERSION = '3.11.0'
2
+ VERSION = '3.11.1'
3
3
  end
@@ -1,6 +1,4 @@
1
- class <%= class_name %>::Cell < <%= options.base_cell_class %>
2
- include Concept
3
-
1
+ class <%= class_name %>::Cell < Cell::Concept
4
2
  <% for action in actions -%>
5
3
  def <%= action %>
6
4
  render
@@ -9,8 +9,7 @@ class ConceptGeneratorTest < Rails::Generators::TestCase
9
9
  test "[erb] standard assets, show view" do
10
10
  run_generator %w(Song)
11
11
 
12
- assert_file "app/concepts/song/cell.rb", /class Song::Cell < Cell::Rails/
13
- assert_file "app/concepts/song/cell.rb", /include Concept/
12
+ assert_file "app/concepts/song/cell.rb", /class Song::Cell < Cell::Concept/
14
13
  assert_file "app/concepts/song/cell.rb", /def show/
15
14
  assert_file "app/concepts/song/views/show.erb", %r(app/concepts/song/views/show\.erb)
16
15
  end
@@ -18,8 +17,7 @@ class ConceptGeneratorTest < Rails::Generators::TestCase
18
17
  test "[haml] standard assets, show view" do
19
18
  run_generator %w(Song -e haml)
20
19
 
21
- assert_file "app/concepts/song/cell.rb", /class Song::Cell < Cell::Rails/
22
- assert_file "app/concepts/song/cell.rb", /include Concept/
20
+ assert_file "app/concepts/song/cell.rb", /class Song::Cell < Cell::Concept/
23
21
  assert_file "app/concepts/song/cell.rb", /def show/
24
22
  assert_file "app/concepts/song/views/show.haml", %r(app/concepts/song/views/show\.haml)
25
23
  end
@@ -1,6 +1,10 @@
1
1
  require 'test_helper'
2
2
 
3
3
  if Cell.rails_version >= 3.1
4
+ Cell::Concept.class_eval do
5
+ self.append_view_path "test/app/concepts"
6
+ end
7
+
4
8
  # Trailblazer style:
5
9
  module Record
6
10
  class Cell < Cell::Concept # cell("record")
@@ -23,6 +27,15 @@ if Cell.rails_version >= 3.1
23
27
  class Hit < ::Cell::Concept
24
28
  inherit_views Record::Cell
25
29
  end
30
+
31
+ class Track < ::Cell::Concept
32
+ inherit_views Song
33
+
34
+ layout "layout"
35
+ def show
36
+ render :song
37
+ end
38
+ end
26
39
  end
27
40
  end
28
41
 
@@ -62,6 +75,9 @@ if Cell.rails_version >= 3.1
62
75
  describe "#render with :layout" do
63
76
  it { Cell::Concept.cell("record/cell/song", @controller).show_with_layout.must_equal "<p>\nLalala\n</p>\n" }
64
77
  end
78
+ describe "#render with ::layout" do
79
+ it { Cell::Concept.cell("record/cell/track", @controller).show.must_equal "<p>\nLalala\n</p>\n" }
80
+ end
65
81
  describe "#render" do
66
82
  it { Cell::Concept.cell("record/cell/song", @controller).show.must_equal "Lalala" }
67
83
  end
@@ -11,7 +11,7 @@ if Cell.rails_version >= 3.1
11
11
  register_spec_type(/integration$/, self)
12
12
 
13
13
  it "what" do
14
- visit "assets/application.js"
14
+ visit "/assets/application.js"
15
15
  page.text.must_include 'var Album = {};'
16
16
  page.text.must_include 'var Songs = [];'
17
17
  end
@@ -35,7 +35,6 @@ require File.join(test_app_dir, 'cells', 'trumpeter_cell')
35
35
  require File.join(test_app_dir, 'cells', 'bad_guitarist_cell')
36
36
 
37
37
  require "haml"
38
- require "haml/template" # Thanks, Nathan!
39
38
 
40
39
  ActiveSupport::TestCase.class_eval do # this is only needed in integration tests (AC::TestCase).
41
40
  def fix_relative_url_root
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
5
- prerelease:
4
+ version: 3.11.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nick Sutterer
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-05-29 00:00:00.000000000 Z
11
+ date: 2014-05-31 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: actionpack
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.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
26
  version: '3.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: railties
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '3.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: '3.0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: uber
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,129 +55,113 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: haml
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: slim
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: tzinfo
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: minitest
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: 4.7.5
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: 4.7.5
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: activemodel
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - '>='
148
130
  - !ruby/object:Gem::Version
149
131
  version: '0'
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - '>='
156
137
  - !ruby/object:Gem::Version
157
138
  version: '0'
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: capybara
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ! '>='
143
+ - - '>='
164
144
  - !ruby/object:Gem::Version
165
145
  version: '0'
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ! '>='
150
+ - - '>='
172
151
  - !ruby/object:Gem::Version
173
152
  version: '0'
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: sprockets
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
- - - ! '>='
157
+ - - '>='
180
158
  - !ruby/object:Gem::Version
181
159
  version: '0'
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
- - - ! '>='
164
+ - - '>='
188
165
  - !ruby/object:Gem::Version
189
166
  version: '0'
190
167
  description: Cells are view components for Rails. They are lightweight controllers,
@@ -286,9 +263,6 @@ files:
286
263
  - test/app/cells/layouts/b.erb
287
264
  - test/app/cells/layouts/metal.html.erb
288
265
  - test/app/cells/rails_helper_api_test/bassist/edit.html.erb
289
- - test/app/cells/record/views/layout.haml
290
- - test/app/cells/record/views/show.erb
291
- - test/app/cells/record/views/song.erb
292
266
  - test/app/cells/shouter/sing.html.erb
293
267
  - test/app/cells/song/dashboard.haml
294
268
  - test/app/cells/song/details.html.haml
@@ -301,6 +275,9 @@ files:
301
275
  - test/app/cells/trumpeter/promote.html.erb
302
276
  - test/app/cells/trumpeter_cell.rb
303
277
  - test/app/cells/view_model_test/comments/show.haml
278
+ - test/app/concepts/record/views/layout.haml
279
+ - test/app/concepts/record/views/show.erb
280
+ - test/app/concepts/record/views/song.erb
304
281
  - test/app/views/shared/_dong.html.erb
305
282
  - test/cell_generator_test.rb
306
283
  - test/cell_module_test.rb
@@ -362,128 +339,25 @@ files:
362
339
  homepage: http://cells.rubyforge.org
363
340
  licenses:
364
341
  - MIT
342
+ metadata: {}
365
343
  post_install_message:
366
344
  rdoc_options: []
367
345
  require_paths:
368
346
  - lib
369
347
  required_ruby_version: !ruby/object:Gem::Requirement
370
- none: false
371
348
  requirements:
372
- - - ! '>='
349
+ - - '>='
373
350
  - !ruby/object:Gem::Version
374
351
  version: '0'
375
352
  required_rubygems_version: !ruby/object:Gem::Requirement
376
- none: false
377
353
  requirements:
378
- - - ! '>='
354
+ - - '>='
379
355
  - !ruby/object:Gem::Version
380
356
  version: '0'
381
357
  requirements: []
382
358
  rubyforge_project:
383
- rubygems_version: 1.8.25
359
+ rubygems_version: 2.2.2
384
360
  signing_key:
385
- specification_version: 3
361
+ specification_version: 4
386
362
  summary: View Components for Rails.
387
- test_files:
388
- - test/app/cells/album/views/cover.haml
389
- - test/app/cells/bad_guitarist/_dii.html.erb
390
- - test/app/cells/bad_guitarist_cell.rb
391
- - test/app/cells/bassist/_dii.html.erb
392
- - test/app/cells/bassist/ahem.html.erb
393
- - test/app/cells/bassist/compose.html.erb
394
- - test/app/cells/bassist/contact_form.html.erb
395
- - test/app/cells/bassist/form_for.erb
396
- - test/app/cells/bassist/form_for_in_haml.haml
397
- - test/app/cells/bassist/jam.html.erb
398
- - test/app/cells/bassist/play.html.erb
399
- - test/app/cells/bassist/play.js.erb
400
- - test/app/cells/bassist/pose.html.erb
401
- - test/app/cells/bassist/promote.html.erb
402
- - test/app/cells/bassist/provoke.html.erb
403
- - test/app/cells/bassist/shout.html.erb
404
- - test/app/cells/bassist/sing.html.haml
405
- - test/app/cells/bassist/slap.html.erb
406
- - test/app/cells/bassist/yell.en.html.erb
407
- - test/app/cells/bassist_cell.rb
408
- - test/app/cells/club_security.rb
409
- - test/app/cells/club_security/guard/help.html.erb
410
- - test/app/cells/club_security/guard_cell.rb
411
- - test/app/cells/club_security/medic/help.html.erb
412
- - test/app/cells/club_security/medic_cell.rb
413
- - test/app/cells/layouts/b.erb
414
- - test/app/cells/layouts/metal.html.erb
415
- - test/app/cells/rails_helper_api_test/bassist/edit.html.erb
416
- - test/app/cells/record/views/layout.haml
417
- - test/app/cells/record/views/show.erb
418
- - test/app/cells/record/views/song.erb
419
- - test/app/cells/shouter/sing.html.erb
420
- - test/app/cells/song/dashboard.haml
421
- - test/app/cells/song/details.html.haml
422
- - test/app/cells/song/info.html.haml
423
- - test/app/cells/song/lyrics.html.haml
424
- - test/app/cells/song/plays.haml
425
- - test/app/cells/song/scale.haml
426
- - test/app/cells/song/show.html.haml
427
- - test/app/cells/song/title.html.haml
428
- - test/app/cells/trumpeter/promote.html.erb
429
- - test/app/cells/trumpeter_cell.rb
430
- - test/app/cells/view_model_test/comments/show.haml
431
- - test/app/views/shared/_dong.html.erb
432
- - test/cell_generator_test.rb
433
- - test/cell_module_test.rb
434
- - test/cell_test.rb
435
- - test/cells_module_test.rb
436
- - test/concept_generator_test.rb
437
- - test/concept_test.rb
438
- - test/deprecations_test.rb
439
- - test/dummy/Rakefile
440
- - test/dummy/app/assets/javascripts/application.js
441
- - test/dummy/app/cells/album/assets/album.js
442
- - test/dummy/app/concepts/song/assets/songs.js
443
- - test/dummy/app/controllers/application_controller.rb
444
- - test/dummy/app/helpers/application_helper.rb
445
- - test/dummy/app/views/layouts/application.html.erb
446
- - test/dummy/app/views/musician/featured.html.erb
447
- - test/dummy/app/views/musician/featured_with_block.html.erb
448
- - test/dummy/app/views/musician/hamlet.html.haml
449
- - test/dummy/app/views/musician/title.erb
450
- - test/dummy/config.ru
451
- - test/dummy/config/application.rb
452
- - test/dummy/config/boot.rb
453
- - test/dummy/config/database.yml
454
- - test/dummy/config/environment.rb
455
- - test/dummy/config/environments/development.rb
456
- - test/dummy/config/environments/production.rb
457
- - test/dummy/config/environments/test.rb
458
- - test/dummy/config/locales/en.yml
459
- - test/dummy/config/routes.rb
460
- - test/dummy/db/test.sqlite3
461
- - test/dummy/label/app/cells/label/show.erb
462
- - test/dummy/label/app/cells/label_cell.rb
463
- - test/dummy/label/label.gemspec
464
- - test/dummy/label/lib/label.rb
465
- - test/dummy/label/lib/label/version.rb
466
- - test/dummy/log/production.log
467
- - test/dummy/log/server.log
468
- - test/dummy/public/404.html
469
- - test/dummy/public/422.html
470
- - test/dummy/public/500.html
471
- - test/dummy/public/favicon.ico
472
- - test/dummy/public/stylesheets/.gitkeep
473
- - test/dummy/script/rails
474
- - test/helper_test.rb
475
- - test/prefixes_test.rb
476
- - test/rack_test.rb
477
- - test/rails/asset_pipeline_test.rb
478
- - test/rails/caching_test.rb
479
- - test/rails/cells_test.rb
480
- - test/rails/forms_test.rb
481
- - test/rails/integration_test.rb
482
- - test/rails/render_test.rb
483
- - test/rails/view_model_test.rb
484
- - test/rails/view_test.rb
485
- - test/rails_helper_api_test.rb
486
- - test/self_contained_test.rb
487
- - test/test_case_test.rb
488
- - test/test_helper.rb
489
- has_rdoc:
363
+ test_files: []