-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a series of improvements made to get Skylight booting on this branch: * Implement the new version of `makeBoundHelper` semantics and the param `apply`ing behavior of `Handlebars.makeBoundHelper`. The dependent key behavior of `makeBoundHelper` is not yet implemented. * Implement the HTMLBars helper hooks. * Make `each` support Ember Array-likes and falsy arrays. * Implement partials, including bound partial names * Support pass-through routes with no templates * Implement a very simple `link-to` stub * Implement a passable but not-very-good attribute bindings including fixing up view streams
- Loading branch information
1 parent
81a8592
commit 222dd70
Showing
23 changed files
with
136 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import { guidFor } from "ember-metal/utils"; | ||
import { get } from "ember-metal/property_get"; | ||
import { forEach } from "ember-metal/enumerable_utils"; | ||
|
||
export default function eachHelper(params, hash, blocks) { | ||
var list = params[0]; | ||
var keyPath = hash.key; | ||
|
||
for (var i=0, l=list.length; i<l; i++) { | ||
var item = list[i]; | ||
var key = keyPath ? get(item, keyPath) : guidFor(item); | ||
|
||
this.yieldItem(key, [item, i]); | ||
// TODO: Correct falsy semantics | ||
if (!list) { | ||
if (blocks.inverse.yield) { blocks.inverse.yield(); } | ||
return; | ||
} | ||
|
||
forEach(list, function(item, i) { | ||
var key = keyPath ? get(item, keyPath) : String(i); | ||
blocks.template.yieldItem(key, [item, i]); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import lookupHelper from "ember-htmlbars/system/lookup-helper"; | ||
|
||
export default function hasHelperHook(env, scope, helperName) { | ||
return !!lookupHelper(helperName, scope.self, env); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import lookupHelper from "ember-htmlbars/system/lookup-helper"; | ||
|
||
export default function lookupHelperHook(env, scope, helperName) { | ||
return lookupHelper(helperName, scope.self, env); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
@module ember | ||
@submodule ember-htmlbars | ||
*/ | ||
|
||
import lookupPartial from "ember-views/system/lookup_partial"; | ||
import { internal } from "htmlbars-runtime"; | ||
|
||
export default function partialKeyword(morph, env, scope, params, hash, template, inverse, visitor) { | ||
var found = lookupPartial(env, env.hooks.getValue(params[0])).raw; | ||
|
||
internal.hostBlock(morph, env, scope, found, null, null, visitor, function(options) { | ||
options.templates.template.yield(); | ||
}); | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<a href={{href}}>{{yield}}</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.