@@ -4,7 +4,6 @@ const path = require('path');
4
4
const _ = require ( 'lodash' ) ;
5
5
const eol = require ( 'os' ) . EOL ;
6
6
7
- const jsonCopy = require ( './json_copy' ) ;
8
7
const ae = require ( './annotation_exporter' ) ;
9
8
const of = require ( './object_factory' ) ;
10
9
const Pattern = of . Pattern ;
@@ -13,6 +12,7 @@ const logger = require('./log');
13
12
//these are mocked in unit tests, so let them be overridden
14
13
let render = require ( './render' ) ; //eslint-disable-line prefer-const
15
14
let fs = require ( 'fs-extra' ) ; //eslint-disable-line prefer-const
15
+ let buildFooter = require ( './buildFooter' ) ; //eslint-disable-line prefer-const
16
16
17
17
const ui_builder = function ( ) {
18
18
@@ -407,36 +407,6 @@ const ui_builder = function () {
407
407
return groupedPatterns ;
408
408
}
409
409
410
- /**
411
- * Builds footer HTML from the general footer and user-defined footer
412
- * @param patternlab - global data store
413
- * @param patternPartial - the partial key to build this for, either viewall-patternPartial or a viewall-patternType-all
414
- * @returns A promise which resolves with the HTML
415
- */
416
- function buildFooterHTML ( patternlab , patternPartial ) {
417
- //first render the general footer
418
- return render ( Pattern . createEmpty ( { extendedTemplate :patternlab . footer } ) , {
419
- patternData : JSON . stringify ( {
420
- patternPartial : patternPartial ,
421
- } ) ,
422
- cacheBuster : patternlab . cacheBuster
423
- } ) . then ( footerPartial => {
424
-
425
- let allFooterData ;
426
- try {
427
- allFooterData = jsonCopy ( patternlab . data , 'config.paths.source.data plus patterns data' ) ;
428
- } catch ( err ) {
429
- logger . warning ( 'There was an error parsing JSON for patternlab.data' ) ;
430
- logger . warning ( err ) ;
431
- }
432
- allFooterData . patternLabFoot = footerPartial ;
433
-
434
- return render ( Pattern . createEmpty ( { extendedTemplate : patternlab . userFoot } ) , allFooterData ) ;
435
- } ) . catch ( reason => {
436
- console . log ( reason ) ;
437
- logger . error ( 'Error building buildFooterHTML' ) ;
438
- } ) ;
439
- }
440
410
441
411
/**
442
412
* Takes a set of patterns and builds a viewall HTML page for them
@@ -493,7 +463,7 @@ const ui_builder = function () {
493
463
}
494
464
495
465
//render the footer needed for the viewall template
496
- return buildFooterHTML ( patternlab , 'viewall-' + patternPartial ) . then ( footerHTML => {
466
+ return buildFooter ( patternlab , 'viewall-' + patternPartial ) . then ( footerHTML => {
497
467
498
468
//render the viewall template by finding these smallest subtype-grouped patterns
499
469
const subtypePatterns = sortPatterns ( _ . values ( patternSubtypes ) ) ;
@@ -535,7 +505,7 @@ const ui_builder = function () {
535
505
}
536
506
537
507
//render the footer needed for the viewall template
538
- return buildFooterHTML ( patternlab , 'viewall-' + patternType + '-all' ) . then ( footerHTML => {
508
+ return buildFooter ( patternlab , 'viewall-' + patternType + '-all' ) . then ( footerHTML => {
539
509
540
510
//add any flat patterns
541
511
//todo this isn't quite working yet
0 commit comments