Skip to content

Community Application: Projects

NateFerrero edited this page Sep 22, 2011 · 8 revisions

Community Application: Projects

List of Projects

Code:

e.app.community.projects( function(err, projects) {
    projects.forEach( function(project) {
        // Do something with each project here
    } );
} );

Returned Values for variable projects:

Variable Contents Description
projects.items [Project, Project, ...] Array of projects, up to the amount per page (default 10).
projects._next Function Call this to load the next page of projects automatically.
projects._prev Function Call this to load the previous page of projects automatically.
projects._page(page) Function Call this to load a specific page of projects automatically.
projects.count 10 The number of projects on the current page.
projects.paging Object
  • has_next: true
  • has_prev: false
  • items: 100
  • length: 10
  • page: 1
  • pages: 10
Paging information
  • Is there a next page?
  • Is there a previous page?
  • Total items in the list.
  • Length of a single page
  • Current page number.
  • How many pages there are.

Single Project

Code:

e.app.community.project(43, function(err, project) {
    // Do something with the project here
} );

Get an individual product like that, or using the list as previously demonstrated.

Returned Values for variable project:

Variable Contents Description
project.id 43 ID of the project.
project.name Clean Water Well Name of the project.
project.progress 120.00 Progress in dollars.
project.target 350.00 Target in dollars.
project.country Ghana Country that project is located in.
project.photo /portal/photo/project/43 A URL containing the location of the project photo.
project.charity Charity Object Contains the charity information, see the [Charity API Reference](https://github.com/MomentumApp/JavaScript-API-Docs/wiki/Community-Application:-Charities) for more details.

Clone this wiki locally