Upgrade Angular & Fix Design error

This commit is contained in:
Siroco 2020-01-28 21:14:17 +01:00
parent 3c51715948
commit dd5bf5c85b
15 changed files with 162 additions and 51 deletions

View File

@ -25,3 +25,15 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac
## Further help ## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
## Extend
For redirect index.html:
```
<html>
<header>
<meta http-equiv="refresh" content="0; url=https://www.industriapaisaia.eus/eu/" />
</header>
</html>
```

View File

@ -12,6 +12,7 @@
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:browser",
"options": { "options": {
"outputPath": "dist", "outputPath": "dist",
"rebaseRootRelativeCssUrls": true,
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json", "tsConfig": "src/tsconfig.app.json",
@ -29,14 +30,16 @@
}, },
"configurations": { "configurations": {
"eu": { "eu": {
"aot": true, "deployUrl":"/eu/",
"baseHref":"/eu/",
"outputPath": "dist/eu", "outputPath": "dist/eu",
"i18nFile": "src/locale/messages.eu.xlf", "i18nFile": "src/locale/messages.eu.xlf",
"i18nFormat": "xlf", "i18nFormat": "xlf",
"i18nLocale": "eu", "i18nLocale": "eu",
}, },
"es": { "es": {
"aot": true, "deployUrl":"/es/",
"baseHref":"/es/",
"outputPath": "dist/es", "outputPath": "dist/es",
"i18nFile": "src/locale/messages.es.xlf", "i18nFile": "src/locale/messages.es.xlf",
"i18nFormat": "xlf", "i18nFormat": "xlf",

53
package-lock.json generated
View File

@ -9431,12 +9431,13 @@
} }
}, },
"pdfjs-dist": { "pdfjs-dist": {
"version": "1.10.88", "version": "2.2.228",
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-1.10.88.tgz", "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.2.228.tgz",
"integrity": "sha1-Aw8Ud/QziiKD2wsR7DSUbF/c0qU=", "integrity": "sha512-W5LhYPMS2UKX0ELIa4u+CFCMoox5qQNQElt0bAK2mwz1V8jZL0rvLao+0tBujce84PK6PvWG36Nwr7agCCWFGQ==",
"dev": true,
"requires": { "requires": {
"node-ensure": "^0.0.0", "node-ensure": "^0.0.0",
"worker-loader": "^1.0.0" "worker-loader": "^2.0.0"
} }
}, },
"performance-now": { "performance-now": {
@ -10745,9 +10746,9 @@
"dev": true "dev": true
}, },
"schema-utils": { "schema-utils": {
"version": "0.4.5", "version": "0.4.7",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz",
"integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==",
"requires": { "requires": {
"ajv": "^6.1.0", "ajv": "^6.1.0",
"ajv-keywords": "^3.1.0" "ajv-keywords": "^3.1.0"
@ -11012,13 +11013,33 @@
"dev": true "dev": true
}, },
"simple-pdf-viewer": { "simple-pdf-viewer": {
"version": "2.0.2", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/simple-pdf-viewer/-/simple-pdf-viewer-2.0.2.tgz", "resolved": "https://registry.npmjs.org/simple-pdf-viewer/-/simple-pdf-viewer-2.0.3.tgz",
"integrity": "sha512-/siKUMDqugwHvFSqpgLmB6T8wfqxXArU6uoZ/vL/f7gCgqZ2O95oyYBHDLDRqtvvc8gSP1+t6z//2NEQ0fn3rA==", "integrity": "sha512-niT86ZCwOXeWccouy8oIN1cKKbyDM4yfYmyb9MGJKKB2nvlp8sRLHcEheV3IOxXD8qv5ypHULPrUF2F3IeS64A==",
"requires": { "requires": {
"@types/pdfjs-dist": "0.1.1", "@types/pdfjs-dist": "0.1.1",
"pdfjs-dist": "1.10.88", "pdfjs-dist": "1.10.88",
"tslib": "^1.7.1" "tslib": "^1.7.1"
},
"dependencies": {
"pdfjs-dist": {
"version": "1.10.88",
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-1.10.88.tgz",
"integrity": "sha1-Aw8Ud/QziiKD2wsR7DSUbF/c0qU=",
"requires": {
"node-ensure": "^0.0.0",
"worker-loader": "^1.0.0"
}
},
"worker-loader": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-1.1.1.tgz",
"integrity": "sha512-qJZLVS/jMCBITDzPo/RuweYSIG8VJP5P67mP/71alGyTZRe1LYJFdwLjLalY3T5ifx0bMDRD3OB6P2p1escvlg==",
"requires": {
"loader-utils": "^1.0.0",
"schema-utils": "^0.4.0"
}
}
} }
}, },
"slash": { "slash": {
@ -14180,9 +14201,10 @@
} }
}, },
"worker-loader": { "worker-loader": {
"version": "1.1.1", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-1.1.1.tgz", "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-2.0.0.tgz",
"integrity": "sha512-qJZLVS/jMCBITDzPo/RuweYSIG8VJP5P67mP/71alGyTZRe1LYJFdwLjLalY3T5ifx0bMDRD3OB6P2p1escvlg==", "integrity": "sha512-tnvNp4K3KQOpfRnD20m8xltE3eWh89Ye+5oj7wXEEHKac1P4oZ6p9oTj8/8ExqoSBnk9nu5Pr4nKfQ1hn2APJw==",
"dev": true,
"requires": { "requires": {
"loader-utils": "^1.0.0", "loader-utils": "^1.0.0",
"schema-utils": "^0.4.0" "schema-utils": "^0.4.0"
@ -14336,11 +14358,6 @@
"integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=",
"dev": true "dev": true
}, },
"zlib": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/zlib/-/zlib-1.0.5.tgz",
"integrity": "sha1-bnyXL8NxxkWmr7A6sUdp3vEU/MA="
},
"zone.js": { "zone.js": {
"version": "0.9.1", "version": "0.9.1",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.9.1.tgz", "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.9.1.tgz",

View File

@ -28,11 +28,10 @@
"jquery": "^3.4.1", "jquery": "^3.4.1",
"mousetrap": "^1.6.2", "mousetrap": "^1.6.2",
"rxjs": "^6.5.4", "rxjs": "^6.5.4",
"simple-pdf-viewer": "^2.0.2", "rxjs-compat": "^6.0.0-rc.0",
"simple-pdf-viewer": "^2.0.3",
"tslib": "^1.9.0", "tslib": "^1.9.0",
"zlib": "^1.0.5", "zone.js": "^0.9.1"
"zone.js": "^0.9.1",
"rxjs-compat": "^6.0.0-rc.0"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "^0.803.23", "@angular-devkit/build-angular": "^0.803.23",
@ -52,6 +51,7 @@
"karma-coverage-istanbul-reporter": "^1.2.1", "karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0", "karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2", "karma-jasmine-html-reporter": "^0.2.2",
"pdfjs-dist": "^2.2.228",
"protractor": "^5.4.2", "protractor": "^5.4.2",
"ts-node": "~4.1.0", "ts-node": "~4.1.0",
"tslint": "~5.9.1", "tslint": "~5.9.1",

60
package.json.backup Normal file
View File

@ -0,0 +1,60 @@
{
"name": "industria-paisaia",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"build-i18n": "for lang in es eu; do ng build --output-path=dist/$lang --aot --bh /$lang/ --i18n-file=src/locale/messages.$lang.xlf --i18n-format=xlf --locale=$lang; done",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^8.2.14",
"@angular/common": "^8.2.14",
"@angular/compiler": "^8.2.14",
"@angular/core": "^8.2.14",
"@angular/forms": "^8.2.14",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.14",
"@angular/router": "^8.2.14",
"@ks89/angular-modal-gallery": "^6.2.3",
"bootstrap": "^4.4.1",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"jquery": "^3.4.1",
"mousetrap": "^1.6.2",
"rxjs": "^6.5.4",
"rxjs-compat": "^6.0.0-rc.0",
"simple-pdf-viewer": "^2.0.2",
"tslib": "^1.9.0",
//"zlib": "^1.0.5",
"zone.js": "^0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.23",
"@angular/cli": "^8.3.23",
"@angular/compiler-cli": "^8.2.14",
"@angular/language-service": "^8.2.14",
"@types/hammerjs": "^2.0.36",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/mousetrap": "^1.6.0",
"@types/node": "~6.0.60",
"codelyzer": "^4.5.0",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.4.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.4.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~3.5.3"
}
}

View File

@ -1,6 +1,8 @@
import { BrowserModule, Title } from '@angular/platform-browser'; import { BrowserModule, Title } from '@angular/platform-browser';
import { NgModule, LOCALE_ID } from '@angular/core'; import { NgModule, LOCALE_ID } from '@angular/core';
import { HttpModule } from '@angular/http'; // import { HttpModule } from '@angular/http';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
/*pdf*/ /*pdf*/
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { SimplePdfViewerModule } from 'simple-pdf-viewer'; import { SimplePdfViewerModule } from 'simple-pdf-viewer';
@ -43,7 +45,8 @@ import { TextComponent } from './text/text.component';
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
HttpModule, // HttpModule,
HttpClientModule,
AppRoutingModule, AppRoutingModule,
FormsModule, FormsModule,
SimplePdfViewerModule, SimplePdfViewerModule,

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Http, Response, RequestOptions, Headers, URLSearchParams } from '@angular/http'; import { HttpClient,HttpResponse } from '@angular/common/http';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
@ -15,16 +14,10 @@ export class DedaloService {
constructor( constructor(
private http: HttpClient, private http: HttpClient,
private http: Http
) {} ) {}
getInterviews() : Observable<Entrevistas> { getInterviews() : Observable<Entrevistas> {
return this.http.get(this.apiUrl) return this.http.get<Entrevistas>(this.apiUrl);
.map( (res: Response)=> {
//console.log('response :')
// console.log(res.json())
return res.json()
})
} }
} }

View File

@ -2,6 +2,6 @@
<p>&copy; <span i18n>Museo Zumalakarregi</span>. 2018 - <span i18n="copyright text">El contenido de este sitio web está bajo la licencia <a target="_blank" href="https://creativecommons.org/licenses/by-nc-sa/3.0/deed.es_ES">Creative Commons By-SA-NC</a></span> - <span i18n><a [routerLink]="_link_texto_legal">{{_name_texto_legal}}</a></span> </p> <p>&copy; <span i18n>Museo Zumalakarregi</span>. 2018 - <span i18n="copyright text">El contenido de este sitio web está bajo la licencia <a target="_blank" href="https://creativecommons.org/licenses/by-nc-sa/3.0/deed.es_ES">Creative Commons By-SA-NC</a></span> - <span i18n><a [routerLink]="_link_texto_legal">{{_name_texto_legal}}</a></span> </p>
<p>www.zumalakarregimuseoa.eus - mzumalakarregi@gipuzkoa.eus - +34 943 88 99 00 - Muxika Egurastokia 6. 20216 Ormaiztegi (Gipuzkoa)</p> <p>www.zumalakarregimuseoa.eus - mzumalakarregi@gipuzkoa.eus - +34 943 88 99 00 - Muxika Egurastokia 6. 20216 Ormaiztegi (Gipuzkoa)</p>
<p>Developed by <a href="https://www.audio-lab.org">Audio-lab</a></p> <p>Developed by <a href="https://www.audio-lab.org">Audio-lab</a></p>
<a href="http://www.zumalakarregimuseoa.eus"><img title="Iniciativa del Museo Zumalakarregi" src="assets/zuma-dipu.jpg" style="margin:0 30px;"/></a> <a href="http://www.zumalakarregimuseoa.eus"><img title="Iniciativa del Museo Zumalakarregi" [src]="_logoZuma" style="margin:0 30px;"/></a>
<a href="http://www.irizar.com/"><img title="Con el patrocinio de Irizar Sociedad Cooperativa" src="assets/irizar.jpg" style="max-width:100px;margin:0 30px;"/></a> <a href="http://www.irizar.com/"><img title="Con el patrocinio de Irizar Sociedad Cooperativa" [src]="_logoIriziar" style="max-width:100px;margin:0 30px;"/></a>
</footer> </footer>

View File

@ -1,4 +1,6 @@
import { Component, OnInit,LOCALE_ID, Inject } from '@angular/core'; import { Component, OnInit,LOCALE_ID, Inject } from '@angular/core';
import {environment} from '../../environments/environment';
@Component({ @Component({
selector: 'app-footer', selector: 'app-footer',
@ -9,12 +11,15 @@ export class FooterComponent implements OnInit {
_link_texto_legal:string; _link_texto_legal:string;
_name_texto_legal:string; _name_texto_legal:string;
_logoIriziar:string = environment.urlLogoIrizar;
_logoZuma:string = environment.urlLogoZuma;
constructor( constructor(
@Inject(LOCALE_ID) protected localeId: string @Inject(LOCALE_ID) protected localeId: string
) { } ) { }
ngOnInit() { ngOnInit() {
switch (this.localeId) { switch (this.localeId) {
case "eu": case "eu":
this._link_texto_legal = "lege-oharra"; this._link_texto_legal = "lege-oharra";
@ -24,6 +29,8 @@ export class FooterComponent implements OnInit {
this._link_texto_legal = "texto-legal"; this._link_texto_legal = "texto-legal";
this._name_texto_legal = "Texto Legal"; this._name_texto_legal = "Texto Legal";
} }
this._logoIriziar = '/'+this.localeId+'/'+environment.urlLogoIrizar;
this._logoZuma = '/'+this.localeId+'/'+environment.urlLogoZuma;
} }
} }

View File

@ -1,5 +1,5 @@
<div class="menu"> <div class="menu">
<a routerLink="/"><img src="./assets/{{homeImage}}" width="150" height="60" alt=""/></a> <a routerLink="/"><img [src]="logoIndustriaPaisaia" width="150" height="60" alt=""/></a>
<nav> <nav>
<ul class="nav"> <ul class="nav">
<!-- <li class="nav-item" [routerLink]='home' [routerLinkActive]="['active']">Inicio</li> --> <!-- <li class="nav-item" [routerLink]='home' [routerLinkActive]="['active']">Inicio</li> -->

View File

@ -12,6 +12,7 @@ export class MenuComponent implements OnInit {
@Input() pages : PageItem[]; @Input() pages : PageItem[];
homeImage = "industria-paisaia.es.svg"; homeImage = "industria-paisaia.es.svg";
logoIndustriaPaisaia:string;
constructor( constructor(
@Inject(LOCALE_ID) protected localeId: string, @Inject(LOCALE_ID) protected localeId: string,
@ -21,6 +22,9 @@ export class MenuComponent implements OnInit {
ngOnInit() { ngOnInit() {
if (this.localeId==='es') this.homeImage = "industria-paisaia.es.svg"; if (this.localeId==='es') this.homeImage = "industria-paisaia.es.svg";
else if (this.localeId==='eu') this.homeImage = "industria-paisaia.svg"; else if (this.localeId==='eu') this.homeImage = "industria-paisaia.svg";
this.logoIndustriaPaisaia = "/"+this.localeId+"/assets/"+this.homeImage;
//console.log(this.pages); //console.log(this.pages);
// this.pages = this.pages.filter(page => page.slug != 'texto-legal'); // this.pages = this.pages.filter(page => page.slug != 'texto-legal');
} }

View File

@ -1,5 +1,7 @@
import { Injectable,LOCALE_ID, Inject } from '@angular/core'; import { Injectable,LOCALE_ID, Inject } from '@angular/core';
import { Http, Response, RequestOptions, Headers, URLSearchParams } from '@angular/http'; //import { Http, Response, RequestOptions, Headers, URLSearchParams } from '@angular/http';
import { HttpClient,HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
import { PageItem } from './page'; import { PageItem } from './page';
@ -18,7 +20,7 @@ export class PageService {
apiUrl : string = "https://backend.industriapaisaia.eus/wp-json/wp/v2" apiUrl : string = "https://backend.industriapaisaia.eus/wp-json/wp/v2"
constructor( constructor(
private http: Http, private http: HttpClient,
public sanitizer: DomSanitizer, public sanitizer: DomSanitizer,
@Inject(LOCALE_ID) protected localeId: string @Inject(LOCALE_ID) protected localeId: string
) { } ) { }
@ -64,14 +66,21 @@ export class PageService {
getPages(searchParams, childs = false) : Observable<PageItem[]> { getPages(searchParams, childs = false) : Observable<PageItem[]> {
searchParams.set('orderby','menu_order'); searchParams.set('orderby','menu_order');
searchParams.set('_embed',''); //searchParams.set('_embed','');
searchParams.set('per_page',20); searchParams.set('per_page',20);
searchParams.set('lang',this.localeId); searchParams.set('lang',this.localeId);
//searchParams.set('context','embed'); //searchParams.set('context','embed');
let url = `${this.apiUrl}/pages`;
return this.http.get(url,{search:searchParams}) let url = `${this.apiUrl}/pages`+'?_embed&'+searchParams.toString();
return this.http.get<any[]>(url)
.map(res => { .map(res => {
return res.json().map(item => {
//console.log(res)
return res.map( (item) => {
//console.log(item)
let page = new PageItem( let page = new PageItem(
item.id as string, item.id as string,
item.title.rendered, item.title.rendered,

View File

@ -1,3 +1,5 @@
export const environment = { export const environment = {
production: true production: true,
urlLogoIrizar: "/assets/irizar.jpg",
urlLogoZuma: "/assets/zuma-dipu.jpg",
}; };

View File

@ -4,5 +4,7 @@
// The list of which env maps to which file can be found in `.angular-cli.json`. // The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = { export const environment = {
production: false production: false,
urlLogoIrizar: "/assets/irizar.jpg",
urlLogoZuma: "/assets/zuma-dipu.jpg",
}; };

View File

@ -10,18 +10,17 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="/assets/favicon.ico"> <link rel="icon" type="image/x-icon" href="/assets/favicon.ico">
<!-- Global site tag (gtag.js) - Google Analytics --> <meta name="google-site-verification" content="OZI2HZ03xE118ZHu9QaWfRGm-dpUgFS4zrwfHlbj_UE" />
<meta name="google-site-verification" content="OZI2HZ03xE118ZHu9QaWfRGm-dpUgFS4zrwfHlbj_UE" />
</head> </head>
<body> <body>
<app-root></app-root> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-17688134-4"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-17688134-4"></script> <script>
<script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);} function gtag(){dataLayer.push(arguments);}
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-17688134-4'); gtag('config', 'UA-17688134-4');
</script> </script>
<app-root></app-root>
</body> </body>
</html> </html>