Hi! I've been quiet lately when it comes to v1.0, but good progress is being made. Most of the recent work has been centered around presenter. Get a feel for where things are headed by taking a look at the WIP PR, Example App, and Presenter API spec (aspects of which are still being defined). Overall, Presenter is becoming much simpler.
Here are a few things I wanted to point out:
Presentation is now a discrete event. In previous versions, presentation is something that occurred throughout the request/response lifecycle. Now it's something that occurs all at once as the very last step in fulfilling a request. Here's an example:
get "/" do
render is called, the request / response cycle halts and a response is immediately returned. If you don't call
render in a route, it will automatically be called for the request path. Logically this makes much more sense than our previous approach.
Presentation now occurs in its own context. Presenters can be defined for a view path, or a specific layout, page, or partial. Data presentation and other view manipulation occurs inside of this context:
view "some/view/path" do
Defining presentation logic in this way makes it easy to reuse view logic across the app. Thinking ahead, presenters will also replace mutators in pakyow/ui.
Presentable state must be explicitly defined. Because presentation occurs in a separate context, any state needed during presentation must be exposed as presentable in the routing context:
get "/" do
presentable :posts, fetch_posts
Presentables can be defined within a route or globally at the router level. If the view calls a presentable that hasn't been defined for a route, Pakyow will raise a runtime error.
I'd say the presenter refactor is about 75% complete at this point. More on this later!