@@ -143,6 +143,32 @@ var table = new DataTable("#indicatorSetsTable", {
143143 } ,
144144} ) ;
145145
146+ function escapeAttr ( str ) {
147+ return String ( str ?? "" )
148+ . replace ( / & / g, "&" )
149+ . replace ( / " / g, """ )
150+ . replace ( / ' / g, "'" )
151+ . replace ( / < / g, "<" )
152+ . replace ( / > / g, ">" ) ;
153+ }
154+
155+ function initIndicatorPopovers ( childContainer ) {
156+ if ( ! childContainer || typeof mdb === "undefined" ) {
157+ return ;
158+ }
159+ $ ( childContainer ) . find ( "[data-mdb-popover-init]" ) . each ( function ( ) {
160+ const existing = mdb . Popover . getInstance ( this ) ;
161+ if ( existing ) {
162+ existing . dispose ( ) ;
163+ }
164+ new mdb . Popover ( this , {
165+ container : "body" ,
166+ trigger : "hover" ,
167+ delay : { show : 0 , hide : 100 } ,
168+ } ) ;
169+ } ) ;
170+ }
171+
146172function format ( indicatorSetId , relatedIndicators , indicatorSetDescription ) {
147173 if ( ! relatedIndicators ) {
148174 return '<div class="d-flex justify-content-start my-3" style="padding-left: 20px;"><div class="spinner-border text-primary" role="status"><span class="visually-hidden">Loading...</span></div></div>' ;
@@ -191,10 +217,11 @@ function format(indicatorSetId, relatedIndicators, indicatorSetDescription) {
191217 checkboxTitle =
192218 "Access to this data source is restricted. Contact delphi-support@andrew.cmu.edu for more information." ;
193219 }
220+
194221 tableMarkup +=
195222 "<tr>" +
196223 `<td><input ${ disabled } title="${ checkboxTitle } " type="checkbox" name="selectedIndicator" onclick="addSelectedIndicator(this)" data-indicator-displayname='${ indicator . display_name } ' data-endpoint="${ indicator . endpoint } " data-datasource="${ indicator . source } " data-indicator="${ indicator . name } " data-time-type="${ indicator . time_type } " data-indicator-set="${ indicator . indicator_set_name } " data-indicator-set-short-name="${ indicator . indicator_set_short_name } " data-member-short-name="${ indicator . member_short_name } " ${ checked } ></td>` +
197- `<td>${ indicator . display_name } </td>` +
224+ `<td><span tabindex="0" data-mdb-container="body" data-mdb-popover-init data-mdb-trigger="hover" data-mdb-placement="right" data-mdb-content=" ${ escapeAttr ( indicator . description ) } "> ${ indicator . display_name } </span> </td>` +
198225 `<td>${ indicator . member_name } </td>` +
199226 `<td>${ indicator . member_description } </td>` +
200227 '<td style="width: 60%"></td>' +
0 commit comments