New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor presenter to work within environment #258

Merged
merged 122 commits into from Oct 27, 2017

Conversation

Projects
None yet
2 participants
@bryanp
Member

bryanp commented Apr 1, 2017

The example boots and returns a view, but this is very much a work in progress. I want to change as little as possible and handle other presenter changes in separate PRs, but getting it to fully work will likely require some large architectural changes.

  • auto present with collapsed request path
  • take presentation into account when determining found?
  • present error views when running in development
  • use definable for binders, processors, stores
  • refactor presenter to be instance-based
  • remove the need for view contexts
    • requires large architectural changes
  • view versions in view / collection
  • part inclusion / exclusion
  • view api, including presenter
  • create feature specs
    • possibly replacing the integration tests
  • add content processing back in
  • options_for
  • forms, including setup, restful, etc

Move into separate issues (probably):

  • remove view composer by baking knowledge into view
  • presenter/app-level processors
  • introduce the concept of auto-loading, which includes presenter
  • build dependency exclusion as a way to avoid auto-loading
  • use the new presenter folder structure
  • add the concept of view objects
  • refactor stringdoc to use the renderer concept
  • simplify stringdocparser (with simplified templates)
  • refactor templatestore to use new renderer (with shared partials)
  • support the simplified definition of significant nodes
  • view renderers, with api changes for traversals / transformations (find, present, etc)
  • dependency exclusion

bryanp added some commits Apr 1, 2017

Initial presenter environment work
The example app boots and presents, but several features are still
unavailable and tests are mostly failing.

bryanp added some commits Apr 9, 2017

Don't to_s env
Causes env to be an empty string rather than later set to a default
value.
Initial cut at presenter error presentation
It looks like we can leverage global handlers to provide some default
behavior for users. In development, we can handle MissingView and
provide insight to the user on what to do next. We can also provide
insight into any 500/404 errors that occur, just like we have in
previous versions of the framework.

We can also present built-in error views in development and fall back
to the app’s error views in production. This is possible by registering
Presenter’s error store only in development, but leaving the default
error handlers in place.

Once we introduce the concept of renderers, we can actually populate
the views with data. Until then, error views will appear to be broken.
Introduce view presenters
- moves presentation logic in presenters, registered at a view path
- simplifies template store to know about one path, not multiple
- disables a bunch of features, including binders and view versions
(each will be reimplemented following the new patterns)
Use binders in presenter
When data is presented by a presenter, it is decorated with the binder
for the scope. Binders being a concern of presenter rather than view
will allow us to further simplify, since views no longer have to
concern themselves with context, or even that a binder exists; it’s
just data now.
Refactor string doc parser to support simplified view templates
View templates no longer differentiate between scopes/props. Instead,
both are denoted with the `@` symbol, like this:

```html
<div@post>
  <p@body>body goes here</p>
</div>
```

Pakyow treats a node as a scope if it contains a prop, and a prop
otherwise. There’s no need for the developer to care about this.

bryanp added some commits Sep 25, 2017

Initial reimplementation of view versioning
Presenting across a set of views is something we will not support for v1.0. It is not something we have used in practice, while it adds a lot of complexity both in implementation and in usage. Previous implementations have not been implemented correctly and the time it would take to do so is better spent on core features.

In light of this, VersionedView replaces ViewSet, which means that multiple nodes of the same significance that are "found" together are treated as versions of the same view. The `find_all` method will later be implemented to return an array of found views rather than the single View or VersionedView that `find` returns.
Introduce StringNode labels
Labels keep us from having to define data-* attributes just to keep up with internal state. This commit also removes other attributes that we add to the view (e.g. data-scope/prop/id). These may be needed in pakyow/ui but we can deal with that later on.
Prefix attributes string with a space
Prevents significant nodes from having an extra space when no attributes, e.g. <title >
Introducte PathBuilder for building paths to routes
Allows for better separation of concerns, and makes it so that presenter no longer has to concern itself with the controller when it only cares about paths.
Remove multi-level delegation
This simplifies things, making it easier to follow and understand.

@bryanp bryanp changed the title from [WIP] Refactor presenter to work within environment to Refactor presenter to work within environment Oct 27, 2017

@bryanp bryanp merged commit ebf29bc into environment Oct 27, 2017

@bryanp bryanp deleted the environment-presenter branch Oct 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment