Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Latest commit

 

History

History
45 lines (34 loc) · 1.57 KB

readme.markdown

File metadata and controls

45 lines (34 loc) · 1.57 KB

LiquidPlanner

This extension is meant to provide useful functionality in Chrome, and to serve as an example of accessing the LiquidPlanner API.

Key Files

liquid_planner.js is responsible for accessing the LiquidPlanner API. options.html and popup.html define the interface for the extension options and the popup menu respectively.

Using the LiquidPlanner API

LiquidPlanner exposes a lot of its functionality through a RESTful API. The extension uses four resources workspaces, workspace members, comments, and tasks. We define a resource function in liquid_planner.js to facilitate fetching resources from the LiquidPlanner API. This is then used to set up the resources we might want to access:

LiquidPlanner.workspaces = resource(':host/:api_path/workspaces/');

Now we can call LiquidPlanner.workspaces to get a list of workspaces.

LiquidPlanner.workspaces({success: showWorkSpaces});

The success option defines the callback to use, in this case it is showWorkSpaces.

Behind the scenes jQuery will call LiquidPlanner's API and parse the JSON response. Normal Javascript objects are then passed into showWorkSpaces:

function showWorkSpaces(spaces, status) {
  ...
  for (var i = 0, space; space = spaces[i]; i++) {
    var name = space.name;
    ...
  }
  ...
}

This pattern is repeated throughout the LiquidPlanner plugin. For more information, see "LiquidPlanner Resource Management" in liquid_planner.js.

adam sanderson, LiquidPlanner
[email protected]