wiki:DeveloperGuidelines/EdenMobile/Structure

EdenMobile Structure

Overview

The following diagram illustrates the general structure of the EdenMobile app.

User Interface

The user interface layer implements AngularJS directives (i.e. HTML extensions) to render the user interface, represent data and facilitate user interactions.

EdenMobile directives can be found in the www/directives folder.

App States and Controllers

Being a single-page application (SPA), EdenMobile implements "states" (instead of pages) to render different views, i.e. the single front-page is loaded only once, and has parts of its contents replaced as the user interacts with it.

Each state has its own "view template" that defines the inner HTML of the front-page for that state, and a controller that supplies data and processing methods for the UI widgets. The view template is rendered and the state controller executed when the state is entered.

The routing of user actions to the different app states is provided by the AngularJS UI router. The UI router works with so-called "state references", and can either be called directly, or via in-page HTML links using fragment identifiers to encode the state reference. State references can contain parameters which are then passed to the state, so that it is possible to implement a REST-like routing schema.

The states for the EdenMobile app, including their respective view templates and state controllers, are configured in www/config/routing.js.

State controllers live in the www/controllers folder, and view templates in www/views. The role of controllers and views is equivalent to controllers/views in the Sahana Eden web application.

Framework Layer

The framework layer provides services for state controllers and UI directives - i.e. generic/common functionality and introspection methods, as well as interfaces to access data and configuration settings.

This layer is largely what the "S3" package is for the Sahana Eden web application (except for the front-end widgets, which are implemented as directives instead).

Back-end Abstraction Layer

The back-end abstraction layer provides abstract interfaces to external components - which are mainly the mobile database, the device's file system and the Sahana Eden server.

This layer has a role similar to "PyDAL" in the Sahana Eden web application (except that it also covers other external resources).

Models

All database schemas ("models") in EdenMobile are stored in the database itself (unlike in Sahana Eden web application, where they are executable code).

Table schemas and settings are either configured in www/config/schema.js (from where they are installed into the database during the first run of the app), or downloaded and imported from a Sahana Eden server.

Last modified 8 years ago Last modified on 03/30/17 13:31:18

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.