All Versions
59
Latest Version
Avg Release Cycle
42 days
Latest Release
-

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, 2017
    • Collection#join can now be called without a block.
  • v4.1.6 Changes

    January 28, 2017
    • ๐Ÿ— Use Declarative::Option and Declarative::Builder instead of uber's. This allows removing the uber version restriction.
  • 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 adding Context::[] 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.
  • 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 in Testing to fix a bug in cells-rspec.
  • 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.
  • v4.1.0 Changes

    May 08, 2016

    API 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 include Builder 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 be yielded in the view.

    • Passing a block to ViewModel#call changed. Use tap 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 then yield 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 to Concept#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). Use context[:controller].

    • ::self_contained! is no longer included into ViewModel. Please try using Trailblazer::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 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.

      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 the context[: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 to yield.

      This works with :collection, too.