Changelog History
Page 1
-
v4.5.0 Changes
- โฌ๏ธ Drop support for rubies prior 2.2.10
-
v4.1.8 Changes
- ๐ Fix ruby warning with undefined instance variable in codebase
-
v4.1.7 Changes
May 05, 2017Collection#join
can now be called without a block.
-
v4.1.6 Changes
January 28, 2017- ๐ Use
Declarative::Option
andDeclarative::Builder
instead ofuber
's. This allows removing theuber
version restriction.
- ๐ Use
-
v4.1.5 Changes
December 09, 2016- ๐ Fix a bug where nested calls of
cell(name, context: {...})
would ignore the new context elements, resulting in the old context being passed on. By addingContext::[]
the new elements are now properly merged into a new context hash. This means that adding elements to the child context won't leak up into the parent context anymore.
- ๐ Fix a bug where nested calls of
-
v4.1.4 Changes
November 10, 2016- โฌ๏ธ Upgrading to Uber 0.1 which handles builders a bit differently.
-
v4.1.3 Changes
August 15, 2016- โ
Load
Uber::InheritableAttr
inTesting
to fix a bug incells-rspec
.
- โ
Load
-
v4.1.2 Changes
July 07, 2016- ๐ฅ๏ธ Testing with Rails 5 now works, by removing code the last piece of Rails-code (I know, it sounds bizarre).
-
v4.1.1 Changes
May 08, 2016- ๐ Fix rendering of
Collection
where in some environments (Rails), the overridden#call
method wouldn't work and strings would be escaped.
- ๐ Fix rendering of
-
v4.1.0 Changes
May 08, 2016API Fix/Changes
- ๐ All Rails code removed. Make sure to use Cells-rails if you want the old Rails behavior.
๐ The
builds
feature is now optional, you have to includeBuilder
in your cell.class CommentCell < Cell::ViewModel include Cell::Builder builds do |..|
A basic, rendering
#show
method is now provided automatically.ViewModel#render
now accepts a block that can beyield
ed in the view.Passing a block to
ViewModel#call
changed. Usetap
if you want the "old" behavior (which was never official or documented).Comment::Cell.new(comment).().tap { |cell| }
The new behavior is to pass that block to your state method. You can pass it on to
render
, and thenyield
it in the template.def show(&block) render &block # yield in show.haml end
Note that this happens automatically in the default
ViewModel#show
method.๐
Concept#cell
now will resolve a concept cell (Song::Cell
), and not the old-style suffix cell (SongCell
). The same applies toConcept#concept
.concept("song/cell", song).cell("song/cell/composer") #=> resolves to Song::Cell::Composer
This decision has been made in regards of the upcoming Cells 5. It simplifies code dramatically, and we consider it unnatural to mix concept and suffix cells in applications.
In case you were using
@parent_controller
, this doesn't exist anymore (and was never documented, either). Usecontext[:controller]
.::self_contained!
is no longer included intoViewModel
. Please try usingTrailblazer::Cell
instead. If you still need it, here's how.class SongCell < Cell::ViewModel extend SelfContained self_contained!
๐
Cell::Concept
is deprecated and you should be using the excellentTrailblazer::Cell
class instead, because that's what a concept cell tries to be in an awkward way. The latter is usable without Trailblazer.We are hereby dropping support for
Cell::Concept
(it still works).๐ Deprecating
:collection_join
and:method
for collections.
Awesomeness
๐ 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 thecontext[:controller]
key.Simple provide it as an option when rendering the cell.
cell(:song, song, context: { current_user: current_user })
The
#context
method allows to access this very hash.def role context[:current_user].admin? "Admin" : "A nobody" end
The
cell
helper now allows to pass in a constant, too.cell(Song::Cell, song)
๐ New API for
:collection
. If used in views, this happens automatically, but here's how it works now.cell(:comment, collection: Comment.all).() # will invoke show. cell(:comment, collection: Comment.all).(:item) # will invoke item. cell(:comment, collection: Comment.all).join { |cell, i| cell.show(index: i) }
Basically, a
Collection
instance is returned that optionally allows to invoke each cell manually.Layout cells can now be injected to wrap the original content.
cell(:comment, Comment.find(1), layout: LayoutCell)
The LayoutCell will be instantiated and the
show
state invoked. The content cell's content is passed as a block, allowing the layout's view toyield
.This works with
:collection
, too.