Reference Source
public class | source

BikeDetailsPresenter

Extends:

* → BikeDetailsPresenter

Class for the BikeDetails presenter and view

Constructor Summary

Public Constructor
public

Creates an instance of BikeDetailsPresenter

Member Summary

Public Members
public

Convert the case of a string to title case (first letter of each word is uppercase).

public

findElement(data: List, key: string): Object: *

Finds if an element exists with a specific title based on a key.

public

Gets the data from the model and returns it to the caller.

public

getDetailsOrder: List: *

Returns the order of the details as a list.

public

Ignore this list of properties when transforming data objects to formed data.

public

goToDirectionsOnMap(data: Object, onError: Function): *

Asks the model to open the prompt to open directions.

public

If the view or presenter is destroyed, unsubscribe the presenter from the model.

public

onUpdated(newData: Object): *

Called when the model is updated with new data.

public

reorderData(data: List): List: *

Reorders the data to be based on a specific order defined in getDetailsOrder.

public

translateData(data: Object): List, List: *

Translates the data from a list of objects to a title and text with an id.

public

update(newData: Object): *

Updates the bike model with new data.

public

view: *

Method Summary

Public Methods
public

confirmFound(rawData: *, callback: *)

public
public

rejectFound(rawData: *, callback: *)

Public Constructors

public constructor(view: Object) source

Creates an instance of BikeDetailsPresenter

Params:

NameTypeAttributeDescription
view Object

An instance of a view class

Public Members

public convertCase(str: string): string: * source

Convert the case of a string to title case (first letter of each word is uppercase).

Return:

string

The string converted to title case

public findElement(data: List, key: string): Object: * source

Finds if an element exists with a specific title based on a key.

Return:

Object

The first element found since data titles should be unique anyway

public getData: Object: * source

Gets the data from the model and returns it to the caller.

Return:

Object

Data from the model.

public getDetailsOrder: List: * source

Returns the order of the details as a list. List will appear in this order. Keys should be defined as the property name replacing all underscores with spaces then converted to title case (Does not include ': ').

Return:

List

A list of title case key names in the order that is needed

public getIgnoredDetails: List: * source

Ignore this list of properties when transforming data objects to formed data.

Return:

List

A list of string properties to ignore

public goToDirectionsOnMap(data: Object, onError: Function): * source

Asks the model to open the prompt to open directions.

public onDestroy: * source

If the view or presenter is destroyed, unsubscribe the presenter from the model.

public onUpdated(newData: Object): * source

Called when the model is updated with new data. Refreshes the state of the view. Method is supplied with the data to add. Better way to refresh the state?

public reorderData(data: List): List: * source

Reorders the data to be based on a specific order defined in getDetailsOrder.

Return:

List

The reordered data

public translateData(data: Object): List, List: * source

Translates the data from a list of objects to a title and text with an id.

Return:

List, List

An object with two lists. 1. The formed data; 2. The list of thumbnails

public update(newData: Object): * source

Updates the bike model with new data.

public view: * source

Public Methods

public confirmFound(rawData: *, callback: *) source

Params:

NameTypeAttributeDescription
rawData *
callback *

public getDataFromID(id: *): string source

Params:

NameTypeAttributeDescription
id *

Return:

string

public rejectFound(rawData: *, callback: *) source

Params:

NameTypeAttributeDescription
rawData *
callback *