templates
Advanced tools
Comparing version 0.17.2 to 0.17.3
@@ -363,4 +363,5 @@ /*! | ||
Templates.prototype.resolveLayout = function(view) { | ||
if (!utils.isPartial(view)) { | ||
debug('resolving layout for "%s"', view.key); | ||
debug('resolving layout for "%s"', view.key); | ||
if (!utils.isPartial(view) && typeof view.layout === 'undefined') { | ||
var views = this[view.options.collection]; | ||
@@ -367,0 +368,0 @@ var layout = views.resolveLayout(view); |
@@ -439,4 +439,4 @@ 'use strict'; | ||
List.prototype.resolveLayout = function(item) { | ||
if (utils.isRenderable(item)) { | ||
return item.layout || this.option('layout'); | ||
if (utils.isRenderable(item) && typeof item.layout === 'undefined') { | ||
return this.option('layout'); | ||
} | ||
@@ -443,0 +443,0 @@ return item.layout; |
@@ -36,3 +36,3 @@ 'use strict'; | ||
// if no layout is defined, `app.options.layout` | ||
if (utils.isFalsey(name) && utils.isRenderable(view)) { | ||
if (typeof name === 'undefined' && utils.isRenderable(view)) { | ||
name = this.option('layout'); | ||
@@ -106,3 +106,3 @@ } | ||
// if no layout is defined, `app.options.layout` | ||
if (utils.isFalsey(name) && utils.isRenderable(file)) { | ||
if (typeof name === 'undefined' && utils.isRenderable(file)) { | ||
name = app.option('layout'); | ||
@@ -109,0 +109,0 @@ } |
@@ -137,8 +137,11 @@ 'use strict'; | ||
utils.isPartial = function(view) { | ||
if (!view.hasOwnProperty('options')) { | ||
throw new Error('view is expected to have an "options" object'); | ||
if (typeof view.isType !== 'function') { | ||
return false; | ||
} | ||
if (!view.options.hasOwnProperty('viewType')) { | ||
throw new Error('view.options is expected to have a viewType property'); | ||
if (typeof view.options === 'undefined') { | ||
return false; | ||
} | ||
if (typeof view.options.viewType === 'undefined') { | ||
return false; | ||
} | ||
return view.isType('partial'); | ||
@@ -155,2 +158,8 @@ }; | ||
} | ||
if (typeof view.options === 'undefined') { | ||
return false; | ||
} | ||
if (typeof view.options.viewType === 'undefined') { | ||
return false; | ||
} | ||
return view.isType('renderable') && view.viewType.length === 1; | ||
@@ -464,3 +473,3 @@ }; | ||
if (view.isPartial && layout === 'default') { | ||
layout = null; | ||
layout = undefined; | ||
} | ||
@@ -467,0 +476,0 @@ } |
@@ -140,3 +140,2 @@ 'use strict'; | ||
configurable: true, | ||
enumerable: true, | ||
get: function() { | ||
@@ -152,2 +151,3 @@ return utils.arrayify(this.options.viewType || 'renderable'); | ||
utils.define(View.prototype, 'isRenderable', { | ||
configurable: true, | ||
get: function() { | ||
@@ -163,2 +163,3 @@ return this.isType('renderable'); | ||
utils.define(View.prototype, 'isPartial', { | ||
configurable: true, | ||
get: function() { | ||
@@ -174,2 +175,3 @@ return this.isType('partial'); | ||
utils.define(View.prototype, 'isLayout', { | ||
configurable: true, | ||
get: function() { | ||
@@ -185,2 +187,3 @@ return this.isType('layout'); | ||
utils.define(View.prototype, 'layout', { | ||
configurable: true, | ||
set: function(val) { | ||
@@ -203,2 +206,3 @@ this.define('_layout', val); | ||
utils.define(View.prototype, 'engine', { | ||
configurable: true, | ||
set: function(val) { | ||
@@ -205,0 +209,0 @@ this.define('_engine', val); |
@@ -448,10 +448,6 @@ 'use strict'; | ||
Views.prototype.resolveLayout = function(view) { | ||
if (!utils.isPartial(view)) { | ||
var layout = view.layout; | ||
if (typeof layout === 'undefined') { | ||
layout = this.option('layout'); | ||
} | ||
return layout; | ||
if (!utils.isPartial(view) && typeof view.layout === 'undefined') { | ||
return this.option('layout'); | ||
} | ||
return view.layout; | ||
}; |
{ | ||
"name": "templates", | ||
"description": "System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.", | ||
"version": "0.17.2", | ||
"version": "0.17.3", | ||
"homepage": "https://github.com/jonschlinkert/templates", | ||
@@ -126,2 +126,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
} | ||
} | ||
} |
@@ -208,3 +208,3 @@ # templates [![NPM version](https://img.shields.io/npm/v/templates.svg?style=flat)](https://www.npmjs.com/package/templates) [![NPM downloads](https://img.shields.io/npm/dm/templates.svg?style=flat)](https://npmjs.org/package/templates) [![Build Status](https://img.shields.io/travis/jonschlinkert/templates.svg?style=flat)](https://travis-ci.org/jonschlinkert/templates) | ||
### [.setup](index.js#L404) | ||
### [.setup](index.js#L405) | ||
@@ -2017,2 +2017,2 @@ Expose static `setup` method for providing access to an instance before any other use code is run. | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 07, 2016._ | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 20, 2016._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171660
4084