Skip to content

Let view be a directory of views. #20

Open
@3rd-Eden

Description

@3rd-Eden

In the current design of things it's only possible to specify one single view for a pagelet. This view in combination with an optional error view is then also send to the client. If your client code needs additional templates to upgrade the graceful degraded content it needs to find it's own solutions for this (Or if you're using multiple React components to render a single pagelet these will all require addition processing as they don't have templates). The solution for this is to allow the view to be a directory with template files.

By default we could either use view.ext or index.ext for the main template and have all other templates be made available using the pagelet.template method where the first argument of this method will be the base name of the template and it would return the given template and or call the template method with the supplied data as second argument (which has yet to be decided).

var Pagelet = require('pagelet');

Pagelet.extend({
  view: __dirname, 
  get: function get(next) {
    next(undefined, {
     header: this.template('header', { title: 'foo' }),
     other: 'data'
  });
}).on(module);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions