@@ -187,7 +187,8 @@ var ui_builder = function () {
187
187
var patternType = _ . find ( patternlab . patternTypes , [ 'patternType' , pattern . patternType ] ) ;
188
188
189
189
if ( ! patternType ) {
190
- plutils . logRed ( "Could not find patternType" , pattern . patternType , "This is a critical error." ) ;
190
+ plutils . logRed ( 'Could not find patternType' + pattern . patternType + '. This is a critical error.' ) ;
191
+ console . trace ( ) ;
191
192
process . exit ( 1 ) ;
192
193
}
193
194
@@ -205,7 +206,8 @@ var ui_builder = function () {
205
206
var patternSubType = _ . find ( patternType . patternTypeItems , [ 'patternSubtype' , pattern . patternSubType ] ) ;
206
207
207
208
if ( ! patternSubType ) {
208
- plutils . logRed ( "Could not find patternType" , pattern . patternType + '-' + pattern . patternType , "This is a critical error." ) ;
209
+ plutils . logRed ( 'Could not find patternType ' + pattern . patternType + '-' + pattern . patternType + '. This is a critical error.' ) ;
210
+ console . trace ( ) ;
209
211
process . exit ( 1 ) ;
210
212
}
211
213
@@ -220,7 +222,6 @@ var ui_builder = function () {
220
222
*/
221
223
function addPatternSubType ( patternlab , pattern ) {
222
224
var patternType = getPatternType ( patternlab , pattern ) ;
223
-
224
225
patternType . patternTypeItems . push (
225
226
{
226
227
patternSubtypeLC : pattern . patternSubGroup . toLowerCase ( ) ,
@@ -255,9 +256,9 @@ var ui_builder = function () {
255
256
* @param pattern - the pattern to derive the subtypeitem from
256
257
* @param createViewAllVariant - whether or not to create the special view all item
257
258
*/
258
- function addPatternSubTypeItem ( patternlab , pattern , createViewAllVariant ) {
259
+ function addPatternSubTypeItem ( patternlab , pattern , createSubtypeViewAllVarient ) {
259
260
var patternSubType = getPatternSubType ( patternlab , pattern ) ;
260
- if ( createViewAllVariant ) {
261
+ if ( createSubtypeViewAllVarient ) {
261
262
patternSubType . patternSubtypeItems . push (
262
263
{
263
264
patternPartial : 'viewall-' + pattern . patternGroup + '-' + pattern . patternSubGroup ,
@@ -267,7 +268,8 @@ var ui_builder = function () {
267
268
patternSubtype : pattern . patternSubtype
268
269
}
269
270
) ;
270
- } else {
271
+ }
272
+ else {
271
273
patternSubType . patternSubtypeItems . push (
272
274
createPatternSubTypeItem ( pattern )
273
275
) ;
@@ -279,19 +281,32 @@ var ui_builder = function () {
279
281
* @param patternlab - global data store
280
282
* @param pattern - the pattern to add
281
283
*/
282
- function addPatternItem ( patternlab , pattern ) {
284
+ function addPatternItem ( patternlab , pattern , isViewAllVariant ) {
283
285
var patternType = getPatternType ( patternlab , pattern ) ;
284
286
if ( ! patternType ) {
285
- plutils . logRed ( "Could not find patternType" , pattern . patternType , "This is a critical error." ) ;
287
+ plutils . logRed ( 'Could not find patternType' + pattern . patternType + '. This is a critical error.' ) ;
288
+ console . trace ( ) ;
286
289
process . exit ( 1 ) ;
287
290
}
288
291
289
292
if ( ! patternType . patternItems ) {
290
293
patternType . patternItems = [ ] ;
291
294
}
292
295
293
- patternType . patternItems . push ( createPatternSubTypeItem ( pattern ) ) ;
296
+ if ( isViewAllVariant ) {
297
+ if ( ! pattern . isFlatPattern ) {
298
+ //todo: it'd be nice if we could get this into createPatternSubTypeItem someday
299
+ patternType . patternItems . push ( {
300
+ patternPartial : 'viewall-' + pattern . patternGroup + '-all' ,
301
+ patternName : 'View All' ,
302
+ patternSrcPath : encodeURI ( pattern . patternType + '/index.html' ) ,
303
+ patternPath : encodeURI ( pattern . patternType + '/index.html' )
304
+ } ) ;
305
+ }
294
306
307
+ } else {
308
+ patternType . patternItems . push ( createPatternSubTypeItem ( pattern ) ) ;
309
+ }
295
310
}
296
311
297
312
// function getPatternItems(patternlab, patternType) {
@@ -349,6 +364,7 @@ var ui_builder = function () {
349
364
350
365
//todo: Pattern Type View All and Documentation
351
366
//groupedPatterns.patternGroups[pattern.patternGroup]['viewall-' + pattern.patternGroup] = injectDocumentationBlock(pattern, patternlab, false);
367
+ addPatternItem ( patternlab , pattern , true ) ;
352
368
}
353
369
354
370
//continue building navigation for nested patterns
@@ -384,7 +400,7 @@ var ui_builder = function () {
384
400
/**
385
401
* Builds footer HTML from the general footer and user-defined footer
386
402
* @param patternlab - global data store
387
- * @param patternPartial - the partial key to build this for //todo test for relevancy
403
+ * @param patternPartial - the partial key to build this for, either viewall-patternPartial or a viewall-patternType-all
388
404
* @returns HTML
389
405
*/
390
406
function buildFooterHTML ( patternlab , patternPartial ) {
@@ -408,7 +424,7 @@ var ui_builder = function () {
408
424
* Used by the type and subtype viewall sets
409
425
* @param patternlab - global data store
410
426
* @param patterns - the set of patterns to build the viewall page for
411
- * @param patternPartial - a key used to identify the viewall pager
427
+ * @param patternPartial - a key used to identify the viewall page
412
428
* @returns HTML
413
429
*/
414
430
function buildViewAllHTML ( patternlab , patterns , patternPartial ) {
@@ -477,7 +493,7 @@ var ui_builder = function () {
477
493
}
478
494
479
495
//render the footer needed for the viewall template
480
- var footerHTML = buildFooterHTML ( patternlab , patternType ) ;
496
+ var footerHTML = buildFooterHTML ( patternlab , 'viewall-' + patternType + '-all' ) ;
481
497
482
498
//add any flat patterns
483
499
//todo this isn't quite working yet
0 commit comments