1
1
import { AfterViewChecked , Component , OnDestroy , OnInit , ViewChild } from '@angular/core' ;
2
2
import { Observable , Subscription } from 'rxjs' ;
3
- import { Convention , NextConventionWhereGQL } from 'src/generated/types.graphql-gen' ;
3
+ import { Convention , NextConventionWhereGQL , SingleConventionTypeGQL } from 'src/generated/types.graphql-gen' ;
4
4
import { map } from 'rxjs/operators' ;
5
5
import { Router } from '@angular/router' ;
6
6
import { DomSanitizer , SafeHtml } from '@angular/platform-browser' ;
@@ -22,6 +22,8 @@ export class GeekwaytothewestComponent implements OnInit, OnDestroy, AfterViewCh
22
22
23
23
geekwayToTheWest : Observable < any > ;
24
24
geekwayToTheWestSubscription : Subscription ;
25
+ geekwayType : Observable < any > ;
26
+ geekwayTypeSubscription : Subscription ;
25
27
playAndWinDataSource : MatTableDataSource < any > ;
26
28
content : SafeHtml ;
27
29
workingContent : string ;
@@ -64,12 +66,28 @@ export class GeekwaytothewestComponent implements OnInit, OnDestroy, AfterViewCh
64
66
65
67
constructor (
66
68
private nextGWConventionWhere : NextConventionWhereGQL ,
69
+ private singleConventionType : SingleConventionTypeGQL ,
67
70
private sanitizer : DomSanitizer ,
68
71
private router : Router ,
69
72
private oembedService : OembedService
70
73
) { }
71
74
72
75
ngOnInit ( ) {
76
+ const whereClauseGWT = {
77
+ Name : 'Geekway to the West' ,
78
+ } ;
79
+
80
+ this . geekwayType = this . singleConventionType . watch ( { whereClause : whereClauseGWT } )
81
+ . valueChanges
82
+ . pipe (
83
+ map ( result => result . data . conventiontypes [ 0 ] )
84
+ ) ;
85
+
86
+ this . geekwayTypeSubscription = this . geekwayType . subscribe ( result => {
87
+ this . workingContent = result . Content ;
88
+ this . content = this . sanitizer . bypassSecurityTrustHtml ( this . workingContent ) ;
89
+ } ) ;
90
+
73
91
const whereClauseGW = {
74
92
Type : 'GeekwayToTheWest' ,
75
93
endDate_gt : new Date ( ) . toISOString ( )
@@ -87,7 +105,6 @@ export class GeekwaytothewestComponent implements OnInit, OnDestroy, AfterViewCh
87
105
}
88
106
89
107
this . workingContent = result . conventionType . Content ;
90
- this . content = this . sanitizer . bypassSecurityTrustHtml ( this . workingContent ) ;
91
108
92
109
this . playAndWinDataSource = new MatTableDataSource ( ) ;
93
110
this . playAndWinDataSource . data = result . playAndWins ;
@@ -109,12 +126,11 @@ export class GeekwaytothewestComponent implements OnInit, OnDestroy, AfterViewCh
109
126
this . workingContent = this . workingContent
110
127
. replace ( match [ 0 ] , oembed . html )
111
128
. replace ( 'src="/uploads/' , 'src="https://cms.geekway.com/uploads/' ) ;
112
- this . content = this . sanitizer . bypassSecurityTrustHtml ( this . workingContent ) ;
113
129
} ) ;
114
130
}
115
131
116
132
this . content = this . sanitizer . bypassSecurityTrustHtml (
117
- result . conventionType . Content
133
+ this . workingContent
118
134
. replace (
119
135
/ < o e m b e d u r l = ( .* ) > < \/ o e m b e d > / ,
120
136
' <div class="iframely-embed"><div class="iframely-responsive"><a data-iframely-url href=$1></div></div>'
@@ -130,9 +146,10 @@ export class GeekwaytothewestComponent implements OnInit, OnDestroy, AfterViewCh
130
146
} ) ;
131
147
132
148
for ( let p of v . maps ) {
149
+ console . log ( p ) ;
133
150
this . venueMapsGalleryItems . push ( new ImageItem ( {
134
- src : 'https://cms.geekway.com' + p . Boxart . url ,
135
- thumb : 'https://cms.geekway.com' + p . Boxart . url
151
+ src : 'https://cms.geekway.com' + p . url ,
152
+ thumb : 'https://cms.geekway.com' + p . url
136
153
} ) ) ;
137
154
}
138
155
}
0 commit comments