cells 4.0.4 → 4.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +56 -0
- data/lib/cell/testing.rb +7 -2
- data/lib/cell/version.rb +1 -1
- data/test/test_case_test.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ef7b3e4ead686e4d02d8e9baf632e8333fae1bf
|
4
|
+
data.tar.gz: 6971a3c4628a18d399011179b922f5423ffed4d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 786ee96506dc6cf01ec325c3b06ea78b8543f33207b756db8c18a1c96230a8eedf2394ffce08a8baa08d354a3388a3b6c4ca6a227c4bf9a237be1930265eca91
|
7
|
+
data.tar.gz: 58b053d459be2071faa1e09f872fb1c5b894e8a5bb14180f40f130c626fca9072750158c8894eb6e2810da44b7f6188f566c44e260b660129ea7aa59497a1ffc
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,59 @@
|
|
1
|
+
## 4.1.0
|
2
|
+
|
3
|
+
TODO: extract internal :layout, extract builder
|
4
|
+
|
5
|
+
### API Fix/Changes
|
6
|
+
|
7
|
+
* You can no longer pass a block to `ViewModel#call`. Use `tap` if you want the same behavior.
|
8
|
+
```ruby
|
9
|
+
Comment::Cell.new(comment).().tap { |cell| }
|
10
|
+
```
|
11
|
+
* `Concept#cell` now will resolve a concept cell (`Song::Cell`), and not the old-style suffix cell (`SongCell`). The same applies to `Concept#concept`.
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
concept("song/cell", song).cell("song/cell/composer") #=> resolves to Song::Cell::Composer
|
15
|
+
```
|
16
|
+
This decision has been made in regards of the upcoming, ass-kicking Cells 5. It simplifies code dramatically, and we consider it unnatural to mix concept and suffix cells in applications.
|
17
|
+
* In case you were using `@parent_controller`, this doesn't exist anymore (and was never documented, either). Use `options[:context][:controller]`.
|
18
|
+
* `::self_contained!` is no longer included into `ViewModel`. Please try using `Trailblazer::Cell` instead. If you still need it, here's how.
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
class SongCell < Cell::ViewModel
|
22
|
+
extend SelfContained
|
23
|
+
self_contained!
|
24
|
+
```
|
25
|
+
|
26
|
+
* `Cell::Concept` is deprecated and you should be using the excellent `Trailblazer::Cell` class instead, because that's what a concept cell tries to be in an awkward way. The latter is usable without Trailblazer.
|
27
|
+
|
28
|
+
We are hereby dropping support for `Cell::Concept` (it still works).
|
29
|
+
|
30
|
+
### Awesomeness
|
31
|
+
|
32
|
+
* Introduced the concept of a context object that is being passed to all nested cells. This object is supposed to contain dependencies such as `current_user`, in Rails it contains the "parent_controller" under the `context[:controller]` key.
|
33
|
+
|
34
|
+
Simple provide it as an option when rendering the cell.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
cell(:song, song, context: { current_user: current_user })
|
38
|
+
```
|
39
|
+
|
40
|
+
The `#context` method allows to access this very hash.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
def role
|
44
|
+
context[:current_user].admin? "Admin" : "A nobody"
|
45
|
+
end
|
46
|
+
```
|
47
|
+
* The `cell` helper now allows to pass in a constant, too.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
cell(Song::Cell, song)
|
51
|
+
```
|
52
|
+
|
53
|
+
## 4.0.5
|
54
|
+
|
55
|
+
* Fix `Testing` so you can use Capybara matchers on `cell(:song, collection: [..])`.
|
56
|
+
|
1
57
|
## 4.0.4
|
2
58
|
|
3
59
|
* `Escaped::property` now properly escapes all passed properties. Thanks @xzo and @jlogsdon!
|
data/lib/cell/testing.rb
CHANGED
@@ -13,7 +13,12 @@ module Cell
|
|
13
13
|
private
|
14
14
|
def cell_for(baseclass, name, model=nil, options={})
|
15
15
|
cell = baseclass.cell(name, model, options.merge(controller: controller))
|
16
|
-
|
16
|
+
|
17
|
+
if Cell::Testing.capybara? # leaving this here as most people use Capybara.
|
18
|
+
return ::Capybara::string(cell) unless cell.is_a?(Cell::ViewModel) # HORRIBLE hack, will be fixed with new collection API in 4.1 :)
|
19
|
+
cell.extend(Capybara)
|
20
|
+
end
|
21
|
+
|
17
22
|
cell
|
18
23
|
end
|
19
24
|
|
@@ -68,4 +73,4 @@ module Cell
|
|
68
73
|
end
|
69
74
|
|
70
75
|
end
|
71
|
-
end
|
76
|
+
end
|
data/lib/cell/version.rb
CHANGED
data/test/test_case_test.rb
CHANGED
@@ -51,7 +51,9 @@ class CapybaraTest < MiniTest::Spec
|
|
51
51
|
|
52
52
|
it { subject.(:show).has_selector?('b').must_equal true }
|
53
53
|
|
54
|
+
it { cell("capybara_test/capybara", collection: [1, 2]).has_selector?('b').must_equal true }
|
55
|
+
|
54
56
|
# FIXME: this kinda sucks, what if you want the string in a Capybara environment?
|
55
57
|
it { subject.(:show).to_s.must_match "<b>Grunt</b>" }
|
56
58
|
end
|
57
|
-
end
|
59
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cells
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uber
|