@@ -56,7 +56,11 @@ MmtMap.clickInteractions = {
56
56
className : 'detail_popup'
57
57
} ) ,
58
58
59
- pageHeaderHtmlTemplate : '<div class="feature_detail shadow col-12"><br /><button type="button" class="close close_feature" aria-label="Close"><span aria-hidden="true">×</span></button><div class="row"><div class="col-xs-12 col-sm-8 col-lg-6" style="margin: auto"><br /><img src="<%= banner %>" alt="Photo of <%= feature_name %>" class="feature_banner img-fluid" /><p class="small"><em><%= banner_copyright %></em></p><h2><%= feature_name %></h2><br /><article>' ,
59
+ pageHeaderHtmlTemplate : '<div class="feature_detail shadow col-12"><br /><button type="button" class="close close_feature" aria-label="Close"><span aria-hidden="true">×</span></button><div class="row"><div class="col-xs-12 col-sm-8 col-lg-6" style="margin: auto"><br />' ,
60
+
61
+ headerTitleHmtlTemplate : '<article><h2><%= feature_name %></h2><br />' ,
62
+
63
+ headerImageHtmlTemplate : '<img src="<%= banner %>" alt="Photo of <%= feature_name %>" class="feature_banner img-fluid" /><p class="small"><em><%= banner_copyright %></em></p>' ,
60
64
61
65
documentHtmlTemplate : '<%= document_body %><hr /><br />' ,
62
66
@@ -77,7 +81,7 @@ MmtMap.clickInteractions = {
77
81
}
78
82
} ;
79
83
80
- let url = '/api/1.0/features/' + sourceLayer + '/' + id + '/attachments/' ;
84
+ const url = '/api/1.0/features/' + sourceLayer + '/' + id + '/attachments/' ;
81
85
82
86
// Then get the data for the page and display it as an overlay to the map
83
87
$ . get ( url , function ( data ) {
@@ -88,13 +92,28 @@ MmtMap.clickInteractions = {
88
92
89
93
// Once you have the data, compile the HTML fragments
90
94
91
- var pageHeader = _ . template ( MmtMap . clickInteractions . pageHeaderHtmlTemplate ) ;
95
+ const pageHeader = _ . template ( MmtMap . clickInteractions . pageHeaderHtmlTemplate ) ;
96
+ const pageTitle = _ . template ( MmtMap . clickInteractions . headerTitleHmtlTemplate ) ;
92
97
93
- page = pageHeader ( {
94
- banner : data . properties . banner_image ,
95
- feature_name : data . properties . name ,
96
- banner_copyright : data . properties . banner_image_copyright
97
- } ) ;
98
+ let page = pageHeader ( ) ;
99
+
100
+ if ( data . properties . banner_image ) {
101
+
102
+ const headerImgTemplate = _ . template ( MmtMap . clickInteractions . headerImageHtmlTemplate ) ;
103
+ const headerImg = headerImgTemplate ( {
104
+ banner : data . properties . banner_image ,
105
+ banner_copyright : data . properties . banner_image_copyright ,
106
+ feature_name : data . properties . name
107
+ } )
108
+
109
+ page = page + headerImg ;
110
+ }
111
+
112
+ let title = pageTitle ( {
113
+ feature_name : data . properties . name
114
+ } ) ;
115
+
116
+ page = page + title ;
98
117
99
118
if ( data . properties . popup_audio_file != null ) {
100
119
var popupAudio = _ . template ( MmtMap . clickInteractions . audioFileHtmlTemplate ) ;
@@ -115,7 +134,7 @@ MmtMap.clickInteractions = {
115
134
case 'document' :
116
135
var doc = _ . template ( MmtMap . clickInteractions . documentHtmlTemplate ) ;
117
136
doc = doc ( {
118
- document_body : attachment . body_processed
137
+ document_body : attachment . body
119
138
} ) ;
120
139
page = page + doc ;
121
140
break ;
@@ -222,8 +241,6 @@ MmtMap.clickInteractions = {
222
241
clickFeature : function ( source , sourceLayer , feature , id , coords ) {
223
242
// Loads the feature from the server and adds a large click popup with an audio player (if there is an audio file related to it)
224
243
225
-
226
-
227
244
$ . get ( 'api/1.0/features/' + sourceLayer + '/' + id , function ( data ) {
228
245
// Construct the HTML for the popup and add it to the map
229
246
let popupPlayerId = undefined ;
0 commit comments