-
Notifications
You must be signed in to change notification settings - Fork 236
Cells 5 Design
Nick Sutterer edited this page Aug 26, 2021
·
8 revisions
Is anyone using Cell::layout
to set a cell-wide layout?
class Cell::Form < Trailblazer::Cell
layout :bla
Do we really need the cell instance? I envision the public API to be cell(...)
and that's it.
Is anyone using cell instances and passing down the cells in nested setups, eg
Email: <%= user_cell.email %>
Current way
Cell.new(..., layout: Layout::Cell)
People have to override Controller#cell
.
def cell(cell_class, model, options={})
super(cell_class, model, options.merge(layout: Layout::Cell::Authentication)) # FIXME: this interface sucks.
end # FIXME
We need to be able to configure the layout at call-time, too (or only there). Otherwise, it's very clumsy to add a controller-wide layout.
cell = Cell.new(layout: ..) # happens in cell(...)
cell.(we need layout here) # happens in {render cell()}
Currently, when you want to evaluate a ERB view passed as a string, this is how it's done (and it sucks).
class Final < Cell::ViewModel
def show(html:, **locals)
render view: html, locals: {**locals}
end
def find_template(view:, **, &block)
template = Tilt::ERBTemplate.new { view }
end
end