Presents basic information about the structure of controllers in ember-flexberry applications.

Description

Controllers in Ember applications are inherit from base class Ember.Controller.

Technology implemented in the base controller:

Typical for the technology controller location, see this article.

Controllers for list forms

Controller for list form is as follows. It derives from a certain technology controller list-form.

import ListFormController from 'ember-flexberry/controllers/list-form';

var EmployeesController = ListFormController; // Can be defined in a separate variable. 
export default EmployeesController;

Controllers for forms to edit and create

Controller edit form is as follows. It derives from a certain technology controller edit-form.

import EditFormController from 'ember-flexberry/controllers/edit-form';

export default EditFormController; // You can not define in a separate variable. 

Separate base controller for form is not implemented. In General, the controller, the controller overrides the edit form:

import EmployeeController from '../employee';

var EmployeeNewController = EmployeeController;
export default EmployeeNewController;

App controller

The controller application is located in file application.js in the folder components.

In this controller it is possible to define the site menu (see example below), configure the processing common to all forms of settings (e.g., in order to hide the menu bar on forms for the parameter).

import Ember from 'ember';

export default Ember.Controller.extend({
  sitemap: {
    nodes: [{
      link: 'index',
      title: 'Home',
      children: null
    }, {
      link: null,
      title: 'Objects',
      children: [{
        link: 'employees',
        title: 'Employees',
        children: null
      }, {
        link: 'orders',
        title: 'Orders',
        children: null
      }]
    }]
  }
});