Sidebar

Daryl Hedley edited this page May 15, 2014 · 6 revisions
Clone this wiki locally

Description

The sidebar enables the core modules to add views into the sidebar view. It handles views being removed and added. When creating a new sidebar view - use the SidebarView and extend.

API

Origin.sidebar.addView([view.$el], [optionsObject]); - Adds a view into the Sidebar.

The options object allows the following settings:

backButtonText - Text displayed at the top of the Sidebar view.

backButtonRoute - When the user clicks the back link this route will be fired. If no route is specified then the backButtonText will not display.

// Create the new view
var editorPageSidebarView = new EditorPageSidebarView().$el;
// Setup back button breadcrumb
var optionsObject = {
    "backButtonText": "Back to courses",
    "backButtonRoute": "/#/dashboard"
};
// Add to sidebar view
Origin.sidebar.addView(editorPageSidebarView, optionsObject);

By calling the sidebar view the views already opened inside the sidebar will be removed and cleaned up.