Provides a logical structure for assembling layouts with Backbone Views. Designed to be adaptive and configurable for painless integration.

Layout Manager. v0.7.0

Introduction

Depends on Underscore, Backbone and jQuery. You can swap out the dependencies completely with a custom configuration.

Download

Include

Tutorials

Screencasts

Examples

Quick start.

API Reference.

There are two distinct constructors within LayoutManager: Layout and LayoutView. These have various aliases and share many methods, but they differ in two key places.

Backbone.View

Properties

manage Boolean
Set this value to true in order to gain the benefits of LayoutManager.

Layout/LayoutView

Properties

template Any datatype
The template property specifies your template in any format and is provided to the render method.
data Object/Function
This data will be provided to the render method.

Methods

setView([selector], view, [append])
setViews(views)
getView([filterFn])
Returns the first View that matches the getViews filter function.
getViews([filterFn])
Provide a filter function to get a flattened array of all the nested views. If the filter function is omitted it will return all nested Views.
insertView([selector], view)
insertViews(views)
Iterate over an object and ensure every value is wrapped in an array to ensure they will be appended, then pass that object to setViews.
render()
By default this should find all nested views and render them into the this.el and call done once all of them have successfully been resolved. This function returns a promise that can be chained to determine once all subviews and main view have been rendered into the view.el.
remove

Options

Customize these options to

paths Object
Two valid property names: template and layout. Must end with a trailing /.
deferred() Returns Promise/A deferred.
fetch(template) Returns template function.
partial(parent, selector, child, [append]) Returns Undefined.
html(parent, child)
append(parent, child)
when(promises)
render(template, data)
contains(parent, child)

Migration Guides.