# `ulakbus.crud`

## Installation

First include `undefined` in your HTML:

    <script src="angular.js">
    <script src="">

You can download this file from the following places:

- Google CDN
  e.g. `//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/undefined`
- Bower
  e.g.

      bower install @X.Y.Z

- code.angularjs.org
  e.g.

      "//code.angularjs.org/X.Y.Z/"

where X.Y.Z is the AngularJS version you are running.

Then load the module in your application by adding it as a dependent module:

    angular.module('app', ['ulakbus.crud']);

With that you're ready to get started!

ulakbus.crud module is the main module for ui. It interacts with backend and manipulate data to screen generically.

## Module Components

### Service

Name | Description
--- | ---
CrudUtility | Crud Utility is a service to provide generic functions for Crud controllers to format data and scope object.

### Function

Name | Description
--- | ---
generateParam | generateParam is a function to generate required params to post backend api.
listPageItems | listPageItems is a function to prepare objects to list in the list page.

### Controller

Name | Description
--- | ---
CRUDCtrl | CRUDCtrl controller is base controller for crud module to redirect to related controller This controller play an empty role for api calls. With response data, location path change to related controller
CRUDListFormCtrl | CRUDListFormCtrl is the main controller for crud module Based on the client_cmd parameter it generates its scope items. client_cmd can be in ['show', 'list', 'form', 'reload', 'refresh'] There are 3 directives to manipulate controllers scope objects in crud.html

### Directive

Name | Description
--- | ---
crudListDirective | directive for listing objects. provides template for `scope.objects` object.
crudFormDirective | directive for form generation. provides template for `scope.forms` object.
crudShowDirective | directive for single object or detail of an object. provides template for `scope.object` object.
formLocator | directive for finding form element. we use this directive because when form dynamically generated using schemaform it belongs to a scope which is hard to reach. This makes it easy to locate form object.
crudFilters | directive for filtering functionality. There are three types of filters; `check`, `select`, and `date`.