Releases: aaronmallen/phlex-hanami
Releases · aaronmallen/phlex-hanami
Release list
v0.2.0
First stable release by the new maintainer. It shares no code with 0.1.0, so treat an upgrade from 0.1.0 as a move
to a new gem and start from the usage docs. The
alpha sections below record each change as it landed. This section gathers them in one place.
Added
Phlex::Hanami::ViewandPhlex::Hanami::Layout, the base classes for a view and a layout, and
Phlex::Hanami::Renderablefor aPhlex::HTMLbase class you already have.- Auto render. An action renders the Phlex view whose container key matches its own, so
MyApp::Actions::Posts::IndexrendersMyApp::Views::Posts::Indexwith noresponse.rendercall and no
configuration. An action with no matching view renders nothing, so a slice can move to Phlex one action at a time. - A view receives the exposures and params its
initializeasks for and drops the rest, so a stray query param does
not raise. An initializer that takes**receives all of it. - A layout convention:
Views::Layoutin a slice wraps that slice's views.layoutsets a different one, and
layout nilopts out. The view renders before its layout, so acontent_forset in the view shows up in the
layout'shead. - The view context in every view and every component under it:
path,url,asset_url,content_for,
csrf_token,flash,session,requestand more. A view reads the same whether or not hanami-view is bundled. t, which resolves a relative key against the view's container key, sot(".title")in
MyApp::Views::Posts::Indexlooks upposts.index.title.Phlex::Hanami::Helpers, an opt in for Hanami's helper library, such asform_forandformat_number. It needs
hanami-view. Their output renders as markup rather than escaped twice, and Phlex keeps its ownrawandtag.Phlex::Hanami::Componentfor everything below a view,Phlex::Hanami::Contextualfor a component base class you
already have, and support for Phlex kits.- Phlex views for hanami-mailer, through
Phlex::Hanami::Mailer::Viewand
Phlex::Hanami::Mailer::Layout. A mailer renders the view whose container key matches its own, and the gem builds
the plain text part from the HTML unless the view definestext_body. Phlex::Hanami::Testing::ViewHelpers, for testing a view or a component without a request, and
require "phlex/hanami/rspec"to include them in every example group taggedtype: :view.- RBS signatures for the public API, shipped in
sig. - Usage docs for every part of the gem, including how it hooks into Hanami and why code reloading needs no extra
work.
v0.2.0-alpha.3
Added
Phlex::Hanami::Component, the base class for everything below a view. It reads the same view context a view
does, and has neither a layout nor thecallcontract Hanami renders a view through, so Hanami cannot render one
by accident.Phlex::Hanami::Contextual, the view context and the slice on their own, for a component base class you already
have.Phlex::Hanami::Renderableincludes it and adds the view half.- Support for Phlex kits. Extend a component namespace with
Phlex::Kit, include it in a base view, and a view
calls its components as methods. A kit registers in the slice container as the module, soslice["components"]
returns the kit rather than raisingNoMethodError. Phlex::Hanami::Testing::ViewHelpers, for testing a view or a component without a request.renderrenders the
instance you give it,view_contextbuilds the context an action would have, andview_requestfakes a request
for the session, the flash and the CSRF token.require "phlex/hanami/rspec"includes those helpers into every RSpec example group taggedtype: :view. Under
any other framework, requirephlex/hanami/testingand include the module where your view tests run.- RBS signatures for the public API, shipped in
sig. - Documentation for components, testing and
responses.
v0.2.0-alpha.2
Added
- Phlex views for hanami-mailer. A mailer renders the Phlex class whose container key matches its own, so
MyApp::Mailers::WelcomerendersMyApp::Views::Mailers::Welcomewith no configuration. Phlex::Hanami::Mailer::ViewandPhlex::Hanami::Mailer::Layout, andPhlex::Hanami::Mailer::Renderablefor an
existingPhlex::HTMLbase class.- A plain text alternative part, converted from the rendered HTML by
Phlex::Hanami::Mailer::Text. Override
text_bodyon the view to write it by hand. - A mail layout convention:
Views::Mailers::Layoutin a slice wraps that slice's mail views. - Usage documentation under docs/usage, covering views, layouts, the view context,
helpers, mailers and how the gem hooks into Hanami. Phlex::Hanami::MailerViewError, raised when a mailer is paired with a Phlex view that is not a mail view,
rather than sending a message whose plain text part is markup.
Changed
urlin a view returns a String. Hanami's routes helper returns aURI, which Phlex rejects as an attribute
value, soa(href: url(:posts))raised.
Fixed
pathin a mail view raisesPhlex::Hanami::RelativePathErrorinstead of writing a relative link an email client
cannot follow.
v0.2.0-alpha.1
Initial alpha release