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

Changelog History
Page 1

  • v4.5.0

    • ⬇️ Drop support for rubies prior 2.2.10
  • v4.1.8

    • 🛠 Fix ruby warning with undefined instance variable in codebase
  • v4.1.7

    May 05, 2017
    • Collection#join can now be called without a block.
  • v4.1.6

    January 28, 2017
    • 🏗 Use Declarative::Option and Declarative::Builder instead of uber's. This allows removing the uber version restriction.
  • v4.1.5

    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

    November 10, 2016
    • ⬆️ Upgrading to Uber 0.1 which handles builders a bit differently.
  • v4.1.3

    August 15, 2016
    • ✅ Load Uber::InheritableAttr in Testing to fix a bug in cells-rspec.
  • v4.1.2

    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

    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

    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.