cells 4.1.0.rc1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -44
- data/lib/cell/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc9fa1e04a8c3b0ad9905c1b01fe31cf432f09fb
|
4
|
+
data.tar.gz: 187264b494b8f78c14a5f33d0376dc97fb0745d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f003307a94784a0bf5ccf2d33694f7a431d8d616e52d1381e8c7dc017281c65a6a61bbbb0e0956870007a67c68c91ad9dc140a728bc062961671df6d70f16d5
|
7
|
+
data.tar.gz: 211b7bd11e8e944422516297e5b2644b0b9405f5caafe335ef9035505d40f5351264709cebca487f02b83b0b793b63addbc90518b297b038abf13c7bea38d132
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Status](https://travis-ci.org/apotonick/cells.svg)](https://travis-ci.org/apoton
|
|
12
12
|
|
13
13
|
Cells allow you to encapsulate parts of your UI into components into _view models_. View models, or cells, are simple ruby classes that can render templates.
|
14
14
|
|
15
|
-
Nevertheless, a cell gives you more than just a template renderer. They allow proper OOP, polymorphic builders, [nesting](#nested-cells), view inheritance, using Rails helpers, [asset packaging](http://trailblazer.to/gems/cells/rails.html#asset-pipeline) to bundle JS, CSS or images, simple distribution via gems or Rails engines, encapsulated testing, [caching](#caching), and [integrate with Trailblazer](
|
15
|
+
Nevertheless, a cell gives you more than just a template renderer. They allow proper OOP, polymorphic builders, [nesting](#nested-cells), view inheritance, using Rails helpers, [asset packaging](http://trailblazer.to/gems/cells/rails.html#asset-pipeline) to bundle JS, CSS or images, simple distribution via gems or Rails engines, encapsulated testing, [caching](#caching), and [integrate with Trailblazer](https://github.com/trailblazer/trailblazer-cells).
|
16
16
|
|
17
17
|
## Full Documentation
|
18
18
|
|
@@ -180,13 +180,19 @@ Properties and escaping are [documented here](http://trailblazer.to/gems/cells/a
|
|
180
180
|
|
181
181
|
## Installation
|
182
182
|
|
183
|
-
Cells
|
183
|
+
Cells runs with any framework.
|
184
184
|
|
185
185
|
```ruby
|
186
|
-
gem
|
186
|
+
gem "cells"
|
187
187
|
```
|
188
188
|
|
189
|
-
|
189
|
+
For Rails, please use the [cells-rails](https://github.com/trailblazer/cells-rails) gem. It supports Rails >= 4.0.
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
gem "cells-rails"
|
193
|
+
```
|
194
|
+
|
195
|
+
Lower versions of Rails will still run with Cells, but you will get in trouble with the helpers. (Note: we use Cells in production with Rails 3.2 and Haml and it works great.)
|
190
196
|
|
191
197
|
Various template engines are supported but need to be added to your Gemfile.
|
192
198
|
|
@@ -207,40 +213,9 @@ class CommentCell < Cell::ViewModel
|
|
207
213
|
end
|
208
214
|
```
|
209
215
|
|
210
|
-
## Concept Cells
|
211
|
-
|
212
|
-
To have real self-contained cells you should use the new _concept cell_ which follows the [Trailblazer](http://trailblazerb.org) naming style. Concept cells need to be derived from `Cell::Concept`, sit in a namespace and are usually named `Cell`.
|
213
|
-
|
214
|
-
```ruby
|
215
|
-
class Comment::Cell < Cell::Concept
|
216
|
-
# ..
|
217
|
-
end
|
218
|
-
```
|
219
|
-
|
220
|
-
Their directory structure looks as follows.
|
221
|
-
|
222
|
-
```
|
223
|
-
app
|
224
|
-
├── concepts
|
225
|
-
│ ├── comment
|
226
|
-
│ │ ├── cell.rb
|
227
|
-
│ │ ├── views
|
228
|
-
│ │ │ ├── show.haml
|
229
|
-
```
|
230
|
-
|
231
|
-
This integrates with Trailblazer where classes for one _concept_ sit in the same directory. Please [read the book](http://leanpub.com/trailblazer) to learn how to use cells with Trailblazer.
|
232
|
-
|
233
|
-
Concept cells are rendered using the `concept` helper.
|
234
|
-
|
235
|
-
```erb
|
236
|
-
<%= concept("comment/cell", @comment) %>
|
237
|
-
```
|
238
|
-
|
239
|
-
Other than that, normal cells and concept cells are identical.
|
240
|
-
|
241
216
|
## Namespaces
|
242
217
|
|
243
|
-
Cells can be namespaced as well.
|
218
|
+
Cells can be namespaced as well.
|
244
219
|
|
245
220
|
```ruby
|
246
221
|
module Admin
|
@@ -371,21 +346,18 @@ In order to render collections, Cells comes with a shortcut.
|
|
371
346
|
|
372
347
|
```ruby
|
373
348
|
comments = Comment.all #=> three comments.
|
374
|
-
cell(:comment, collection: comments)
|
349
|
+
cell(:comment, collection: comments).()
|
375
350
|
```
|
376
351
|
|
377
|
-
This will invoke `cell(:comment, comment).()` three times and concatenate the rendered output automatically. In case you don't want `show` but another state rendered,
|
352
|
+
This will invoke `cell(:comment, comment).()` three times and concatenate the rendered output automatically. In case you don't want `show` but another state rendered, pass the `:method` name to `call`.
|
378
353
|
|
379
354
|
```ruby
|
380
|
-
cell(:comment, collection: comments
|
355
|
+
cell(:comment, collection: comments).(:list)
|
381
356
|
```
|
382
|
-
|
383
|
-
Note that you _don't_ need to invoke call here, the `:collection` behavior internally handles that for you.
|
384
|
-
|
385
357
|
Additional options are passed to every cell constructor.
|
386
358
|
|
387
359
|
```ruby
|
388
|
-
cell(:comment, collection: comments, style: "awesome", volume: "loud")
|
360
|
+
cell(:comment, collection: comments, style: "awesome", volume: "loud").()
|
389
361
|
```
|
390
362
|
|
391
363
|
## Builder
|
@@ -455,7 +427,7 @@ The book picks up where the README leaves off. Go grab a copy and support us - i
|
|
455
427
|
|
456
428
|
## This is not Cells 3.x!
|
457
429
|
|
458
|
-
Temporary note: This is the README and API for Cells 4. Many things have improved. If you want to upgrade, [follow this guide](https://github.com/apotonick/cells/wiki/From-Cells-3-to-Cells-4---Upgrading-Guide). When in trouble, join
|
430
|
+
Temporary note: This is the README and API for Cells 4. Many things have improved. If you want to upgrade, [follow this guide](https://github.com/apotonick/cells/wiki/From-Cells-3-to-Cells-4---Upgrading-Guide). When in trouble, join the [Gitter channel](https://gitter.im/trailblazer/chat).
|
459
431
|
|
460
432
|
## LICENSE
|
461
433
|
|
data/lib/cell/version.rb
CHANGED
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.1.0
|
4
|
+
version: 4.1.0
|
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-05-
|
11
|
+
date: 2016-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uber
|
@@ -184,9 +184,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '0'
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
|
-
- - "
|
187
|
+
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
189
|
+
version: '0'
|
190
190
|
requirements: []
|
191
191
|
rubyforge_project:
|
192
192
|
rubygems_version: 2.4.8
|