@@ -216,10 +216,10 @@ angular.module('homepage', ['ngAnimate', 'ui.bootstrap', 'download-data'])
216
216
} ;
217
217
} )
218
218
219
- . directive ( 'appSource' , function ( fetchCode , escape , $compile , $timeout , templateBuilder ) {
219
+ . directive ( 'appSource' , function ( fetchCode , escape , $compile , $timeout , templateBuilder , $sce ) {
220
220
return {
221
221
terminal : true ,
222
- scope : true ,
222
+ scope : { } ,
223
223
link : function ( scope , element , attrs ) {
224
224
var tabs = [ ] ,
225
225
annotation = attrs . annotate && angular . fromJson ( fetchCode ( attrs . annotate ) ) || { } ;
@@ -251,19 +251,22 @@ angular.module('homepage', ['ngAnimate', 'ui.bootstrap', 'download-data'])
251
251
counter = 0 ;
252
252
253
253
angular . forEach ( annotation [ filename ] , function ( text , key ) {
254
+ counter ++ ;
254
255
255
256
text = text . replace ( '{{' , '{{' ) . replace ( '}}' , '}}' ) ;
256
257
257
258
var regexp = new RegExp ( '(\\W|^)(' + key . replace ( / ( [ \W \- ] ) / g, '\\$1' ) + ')(\\W|$)' ) ;
258
259
260
+ scope [ 'popover' + index + counter ] = $sce . trustAsHtml ( text ) ;
261
+
259
262
content = content . replace ( regexp , function ( _ , before , token , after ) {
260
- token = "__" + ( counter ++ ) + "__" ;
263
+ token = "__" + ( counter ) + "__" ;
261
264
popovers [ token ] =
262
265
'<span class="nocode"\n' +
263
266
' popover-title="' + escape ( key ) + '"\n' +
264
- ' popover-trigger="click "\n' +
267
+ ' popover-trigger="outsideClick "\n' +
265
268
' popover-append-to-body="true"\n' +
266
- ' popover-html-unsafe=" ' + escape ( text ) + '"><code>' + escape ( key ) + '</code>' +
269
+ ' uib- popover-html="popover ' + index + counter + '"><code>' + escape ( key ) + '</code>' +
267
270
'</span>' ;
268
271
return before + token + after ;
269
272
} ) ;
@@ -274,22 +277,21 @@ angular.module('homepage', ['ngAnimate', 'ui.bootstrap', 'download-data'])
274
277
} ) ;
275
278
276
279
tabs . push (
277
- '<tab heading="' + ( index ? filename : 'index.html' ) + '">\n' +
280
+ '<uib- tab heading="' + ( index ? filename : 'index.html' ) + '">\n' +
278
281
' <pre class="prettyprint linenums nocode"><code>' + content + '</code></pre>\n' +
279
- '</tab>\n'
282
+ '</uib- tab>\n'
280
283
) ;
281
284
} ) ;
282
285
283
286
element . html (
284
- '<tabset>' +
287
+ '<uib- tabset>' +
285
288
tabs . join ( '' ) +
286
- '</tabset>' ) ;
287
- // element.find('[rel=popover]').popover().pulse();
289
+ '</uib-tabset>' ) ;
288
290
289
291
// Compile up the HTML to get the directives to kick-in
290
292
$compile ( element . children ( ) ) ( scope ) ;
291
293
$timeout ( function ( ) {
292
- var annotationElements = element . find ( 'span[popover-html-unsafe ]' ) ;
294
+ var annotationElements = element . find ( 'span[uib- popover-html]' ) ;
293
295
$compile ( annotationElements ) ( scope ) ;
294
296
} , 0 ) ;
295
297
}
@@ -368,23 +370,23 @@ angular.module('homepage', ['ngAnimate', 'ui.bootstrap', 'download-data'])
368
370
. directive ( 'hint' , function ( ) {
369
371
return {
370
372
template : '<em>Hint:</em> Click ' +
371
- '<code class="nocode" popover-title="Hover" popover-trigger="click " popover-append-to-body="true"' +
372
- 'popover="Click highlighted areas in the code for explanations.">me</code>.'
373
+ '<code class="nocode" popover-title="Hover" popover-trigger="outsideClick " popover-append-to-body="true"' +
374
+ 'uib- popover="Click highlighted areas in the code for explanations.">me</code>.'
373
375
} ;
374
376
} )
375
377
376
- . controller ( 'AppController' , function ( $scope , $modal , BRANCHES ) {
378
+ . controller ( 'AppController' , function ( $scope , $uibModal , BRANCHES ) {
377
379
$scope . BRANCHES = BRANCHES ;
378
380
379
381
$scope . showDownloadModal = function ( ) {
380
- $modal . open ( {
382
+ $uibModal . open ( {
381
383
templateUrl : 'partials/download-modal.html' ,
382
384
windowClass : 'download-modal'
383
385
} ) ;
384
386
} ;
385
387
386
388
$scope . showVideo = function ( videoUrl ) {
387
- $modal . open ( {
389
+ $uibModal . open ( {
388
390
templateUrl : 'partials/video-modal.html' ,
389
391
windowClass : 'video-modal' ,
390
392
controller : 'VideoController' ,
@@ -458,36 +460,6 @@ angular.module('homepage', ['ngAnimate', 'ui.bootstrap', 'download-data'])
458
460
459
461
} )
460
462
461
-
462
- // Angular UI Bootstrap provide some excellent directives, but the popover didn't allow for HTML content
463
- // The popoverHtmlUnsafe and popoverHtmlUnsafePopup implement this on top of the AngularUI Bootstrap's $tooltip service
464
- . directive ( 'popoverHtmlUnsafePopup' , function ( $templateCache ) {
465
-
466
- $templateCache . put ( "template/popover/popover-html-unsafe-popup.html" ,
467
- "<div class=\"popover {{placement}}\" ng-class=\"{ in: isOpen(), fade: animation() }\">\n" +
468
- " <div class=\"arrow\"></div>\n" +
469
- "\n" +
470
- " <div class=\"popover-inner\">\n" +
471
- " <h3 class=\"popover-title\" ng-bind=\"title\" ng-show=\"title\"></h3>\n" +
472
- " <div class=\"popover-content\" bind-html-unsafe=\"content\"></div>\n" +
473
- " </div>\n" +
474
- "</div>\n" +
475
- "" ) ;
476
-
477
- return {
478
- restrict : 'EA' ,
479
- replace : true ,
480
- scope : { title : '@' , content : '@' , placement : '@' , animation : '&' , isOpen : '&' } ,
481
- templateUrl : 'template/popover/popover-html-unsafe-popup.html'
482
- } ;
483
- } )
484
-
485
- . directive ( 'popoverHtmlUnsafe' , [ '$compile' , '$timeout' , '$parse' , '$window' , '$tooltip' , function ( $compile , $timeout , $parse , $window , $tooltip ) {
486
- return $tooltip ( 'popoverHtmlUnsafe' , 'popover' , 'click' ) ;
487
- } ] )
488
-
489
-
490
-
491
463
. run ( function ( $rootScope , startPulse ) {
492
464
$rootScope . version = angular . version ;
493
465
0 commit comments