Add Intro texto to Homepage

This commit is contained in:
Siroco 2019-02-03 00:47:13 +01:00
parent 38ed7cda56
commit 6390e82599
6 changed files with 61 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import { InterviewComponent } from './interview/interview.component';
import { InterviewGridComponent } from './interview-grid/interview-grid.component'; import { InterviewGridComponent } from './interview-grid/interview-grid.component';
import { DedaloService } from './dedalo.service'; import { DedaloService } from './dedalo.service';
import { HideMarkers } from './pipe'; import { HideMarkers } from './pipe';
import { TextComponent } from './text/text.component';
@NgModule({ @NgModule({
@ -38,6 +39,7 @@ import { HideMarkers } from './pipe';
InterviewComponent, InterviewComponent,
InterviewGridComponent, InterviewGridComponent,
HideMarkers, HideMarkers,
TextComponent,
], ],
imports: [ imports: [
BrowserModule, BrowserModule,

View File

@ -1,2 +1,4 @@
<header class="homepage" id="header" [ngStyle]="{'background-image': 'url(\'./assets/'+homeImage+'\')'}"></header> <header class="homepage" id="header" [ngStyle]="{'background-image': 'url(\'./assets/'+homeImage+'\')'}"></header>
<app-text *ngIf="localeId==='eu'" slug='aurkezpena-industria-paisaia'></app-text>
<app-text *ngIf="localeId==='es'" slug='presentacion-paisaje-industrial'></app-text>
<app-section [pages]=pages></app-section> <app-section [pages]=pages></app-section>

View File

View File

@ -0,0 +1,5 @@
<article *ngIf="pages">
<div class="row">
<div class="col-md-10 offset-md-1 info col-xm-12" [innerHTML]="pages[0].content" style="font-size:1.5em;margin-bottom:50px;"></div>
</div>
</article>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TextComponent } from './text.component';
describe('TextComponent', () => {
let component: TextComponent;
let fixture: ComponentFixture<TextComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TextComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TextComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,27 @@
import { Component, OnInit, Input, Inject, LOCALE_ID} from '@angular/core';
import { PageService } from '../page.service';
import { PageItem } from '../page';
@Component({
selector: 'app-text',
templateUrl: './text.component.html',
styleUrls: ['./text.component.css']
})
export class TextComponent implements OnInit {
@Input() slug:string;
pages:PageItem[];
constructor(
private pageService: PageService,
@Inject(LOCALE_ID) protected localeId: string
) { }
ngOnInit() {
this.pageService.getPage(this.slug)
.subscribe(data => {
this.pages = data;
});
}
}