[CORD-1630] Adding model verbose_name and description

Change-Id: If50b38f0328f59852c6ac0a925fb724fdf86782e
diff --git a/src/app/views/crud/crud.html b/src/app/views/crud/crud.html
index adeaaa4..b347c31 100644
--- a/src/app/views/crud/crud.html
+++ b/src/app/views/crud/crud.html
@@ -22,16 +22,17 @@
             <div class="pull-right text-right" style="line-height: 14px">
                 <!--<small>UI Elements<br>General<br> <span class="c-white">Grid system</span></small>-->
                 <a class="btn btn-default" ng-if="vm.list" href="{{vm.baseUrl}}add">Add</a>
-                <a class="btn btn-default" ng-if="!vm.list" href="{{vm.baseUrl}}">Back to {{vm.title.toLowerCase()}} list</a>
+                <a class="btn btn-default" ng-if="!vm.list" href="{{vm.baseUrl}}">Back to {{vm.pluralTitle.toLowerCase()}} list</a>
             </div>
             <div class="header-icon">
                 <i class="pe page-header-icon pe-7s-note2"></i>
             </div>
             <div class="header-title">
-                <h3>{{vm.title}}</h3>
-                <!--<small>-->
-                    <!--Responsive, mobile first fluid grid system.-->
-                <!--</small>-->
+                <h3 ng-if="vm.list">{{vm.pluralTitle}}</h3>
+                <h3 ng-if="!vm.list">{{vm.singularTitle}}</h3>
+                <small>
+                    {{vm.modelDef.description}}
+                </small>
             </div>
         </div>
         <hr>
diff --git a/src/app/views/crud/crud.ts b/src/app/views/crud/crud.ts
index 325790f..bcac6a9 100644
--- a/src/app/views/crud/crud.ts
+++ b/src/app/views/crud/crud.ts
@@ -22,7 +22,7 @@
 import * as _ from 'lodash';
 import {IXosResourceService} from '../../datasources/rest/model.rest';
 import {IStoreHelpersService} from '../../datasources/helpers/store.helpers';
-import {IXosModelDiscovererService} from '../../datasources/helpers/model-discoverer.service';
+import {IXosModelDiscovererService, IXosModel} from '../../datasources/helpers/model-discoverer.service';
 import './crud.scss';
 import {IXosCrudRelationService} from './crud.relations.service';
 import {IXosDebugService, IXosDebugStatus} from '../../core/debug/debug.service';
@@ -57,9 +57,12 @@
   public formCfg: any;
   public baseUrl: string;
   public list: boolean;
-  public title: string;
+  public modelName: string;
+  public pluralTitle: string;
+  public singularTitle: string;
   public tableData: any[];
-  public model: any;
+  public model: any; // holds the real model
+  public modelDef: IXosModel;
   public related: {manytoone: IXosModelRelation[], onetomany: IXosModelRelation[]} = {
     manytoone: [],
     onetomany: []
@@ -87,16 +90,18 @@
     this.$log.info('[XosCrud] Setup', $state.current.data);
 
     this.data = this.$state.current.data;
-    this.model = this.XosModelDiscovererService.get(this.data.model);
-    this.title = this.ConfigHelpers.pluralize(this.data.model);
+    this.modelDef = this.XosModelDiscovererService.get(this.data.model);
+    this.modelName = this.modelDef.verbose_name ? this.modelDef.verbose_name : this.modelDef.name;
+    this.pluralTitle = this.ConfigHelpers.pluralize(this.modelName);
+    this.singularTitle = this.ConfigHelpers.pluralize(this.modelName, 1);
 
     this.list = true;
 
     // TODO get the proper URL from model discoverer
-    this.baseUrl = '#/' + this.model.clientUrl.replace(':id?', '');
+    this.baseUrl = '#/' + this.modelDef.clientUrl.replace(':id?', '');
 
-    this.tableCfg = this.model.tableCfg;
-    this.formCfg = this.model.formCfg;
+    this.tableCfg = this.modelDef.tableCfg;
+    this.formCfg = this.modelDef.formCfg;
 
     this.debugTab = this.XosDebug.status.modelsTab;
     this.$scope.$on('xos.debug.status', (e, status: IXosDebugStatus) => {
@@ -109,7 +114,6 @@
         (event) => {
           // NOTE Observable mess with $digest cycles, we need to schedule the expression later
           $scope.$evalAsync(() => {
-            this.title = this.ConfigHelpers.pluralize(this.data.model, event.length);
             this.tableData = event;
 
             // if it is a detail page for an existing model