From e608f9dd1f71515e0c31e5608ba05b4b0326d98e Mon Sep 17 00:00:00 2001 From: astex <0astex@gmail.com> Date: Fri, 29 Apr 2016 14:06:13 -0400 Subject: [PATCH 1/5] Add a client service. --- front/current/services/project/client.service.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 front/current/services/project/client.service.ts diff --git a/front/current/services/project/client.service.ts b/front/current/services/project/client.service.ts new file mode 100644 index 0000000..4e5ade0 --- /dev/null +++ b/front/current/services/project/client.service.ts @@ -0,0 +1,9 @@ +import { Injectable } from 'angular2/core'; +import { config } from '../../config'; + + +@Injectable() +export class ClientService { + public config:any = config.SERVICES.project; + public url:string = '/client/'; +}; -- GitLab From 5b45085bde577c66081df87a8b562c2f5ce9a27b Mon Sep 17 00:00:00 2001 From: astex <0astex@gmail.com> Date: Fri, 29 Apr 2016 14:06:24 -0400 Subject: [PATCH 2/5] Register the client service on the app component. --- front/current/components/app/app.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front/current/components/app/app.component.ts b/front/current/components/app/app.component.ts index 5db938c..5b94763 100644 --- a/front/current/components/app/app.component.ts +++ b/front/current/components/app/app.component.ts @@ -6,6 +6,7 @@ import { config } from '../../config'; import { RestService } from '../../services/rest.service'; import { ProjectService } from '../../services/project/project.service'; +import { ClientService } from '../../services/project/client.service'; import { AddressService } from '../../services/project/address.service'; import { ContactService } from '../../services/project/contact.service'; import { ContactMethodService } from '../../services/project/contact-method.service'; @@ -23,7 +24,7 @@ import { ProjectDetailComponent } from '../project/detail.component' providers: [ ROUTER_PROVIDERS, RestService, - ProjectService, AddressService, ContactService, ContactMethodService, + ProjectService, ClientService, AddressService, ContactService, ContactMethodService, DocumentSlotService, DocumentService ], -- GitLab From a4b21540412bd1ff19085a22a262bd6dd261b336 Mon Sep 17 00:00:00 2001 From: astex <0astex@gmail.com> Date: Fri, 29 Apr 2016 14:10:08 -0400 Subject: [PATCH 3/5] Fetch the client in the project detail component. --- front/current/components/project/detail.component.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/front/current/components/project/detail.component.ts b/front/current/components/project/detail.component.ts index c2c0812..63500c4 100644 --- a/front/current/components/project/detail.component.ts +++ b/front/current/components/project/detail.component.ts @@ -5,6 +5,7 @@ import { config } from '../../config'; import { RestService, Model, Collection } from '../../services/rest.service'; import { ProjectService } from '../../services/project/project.service'; +import { ClientService } from '../../services/project/client.service'; import { AddressService } from '../../services/project/address.service'; import { ContactService } from '../../services/project/contact.service'; import { ContactMethodService } from '../../services/project/contact-method.service'; @@ -26,6 +27,7 @@ export class ProjectDetailComponent implements OnInit { private _routeParams:RouteParams, private _restService:RestService, public projectService:ProjectService, + public clientService:ClientService, public addressService:AddressService, public contactService:ContactService, public contactMethodService:ContactMethodService, @@ -34,7 +36,9 @@ export class ProjectDetailComponent implements OnInit { ) {}; project:Model; - addresses:Collection; + clients:Collection; // A throwaway collection. The client is pulled from here. + client:Model; + addresses:Collection; // A throwaway collection. The address is pulled from here. address:Model; contacts:Collection; contact_methods:Collection; @@ -45,6 +49,8 @@ export class ProjectDetailComponent implements OnInit { let project_id = this._routeParams.get('id'); this.project = this._restService.Model(this.projectService, {id: project_id}); + this.clients = (this._restService.Collection(this.clientService, []) + .setFilters({'project_id': project_id})); this.addresses = (this._restService.Collection(this.addressService, []) .setFilters({'project_id': project_id})); this.contacts = (this._restService.Collection(this.contactService, []) @@ -60,6 +66,10 @@ export class ProjectDetailComponent implements OnInit { fetch() { this.project.fetch(); + this.clients.fetch(() => { + if (this.clients.models.length) + this.client = this.clients.models[0]; + }); this.addresses.fetch(() => { if (this.addresses.models.length) this.address = this.addresses.models[0]; -- GitLab From 19e61aba00d7c95b532645c6d5fc327148e4289b Mon Sep 17 00:00:00 2001 From: astex <0astex@gmail.com> Date: Fri, 29 Apr 2016 14:10:25 -0400 Subject: [PATCH 4/5] Display the client in the project detail component. --- front/current/components/project/detail.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/current/components/project/detail.component.html b/front/current/components/project/detail.component.html index 08e5f39..58b0764 100644 --- a/front/current/components/project/detail.component.html +++ b/front/current/components/project/detail.component.html @@ -17,7 +17,7 @@
- {{ project.data['name'] }} + {{ project.data['name'] }} {{ client.data['name'] }}

-- GitLab From 23a68eb629fbc86d036f33194872cb1281abf108 Mon Sep 17 00:00:00 2001 From: astex <0astex@gmail.com> Date: Fri, 29 Apr 2016 14:10:43 -0400 Subject: [PATCH 5/5] Add better styling for the client name in the project detail component. --- front/current/assets/styles/components/_project.scss | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/front/current/assets/styles/components/_project.scss b/front/current/assets/styles/components/_project.scss index 413adc9..bccde26 100644 --- a/front/current/assets/styles/components/_project.scss +++ b/front/current/assets/styles/components/_project.scss @@ -24,7 +24,14 @@ project { padding-bottom: 20px; h1, h4 { margin-left: 22px; } - h1 { margin-top: 20px; } + h1 { + margin-top: 20px; + + small { + color: $gray-01; + font-style: italic; + } + } h4 { margin-top: 10px; color: $gray-01; } } .project-contacts { -- GitLab