Last active
September 29, 2015 22:37
-
-
Save johanobergman/60483a8f49c30f245eef to your computer and use it in GitHub Desktop.
Revisions
-
johanobergman revised this gist
Oct 11, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,8 @@ section = function(name, options) { yieldSection = function(name, options) { var context, section; if ((context = this.get('parent')) && (sectionBlock = context.get(name + "Section"))) { sectionBlock(context); } }; -
johanobergman revised this gist
Oct 11, 2014 . 5 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes.File renamed without changes. -
johanobergman renamed this gist
Oct 11, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
johanobergman revised this gist
Oct 11, 2014 . 3 changed files with 1 addition and 1 deletion.There are no files selected for viewing
File renamed without changes.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,5 +13,5 @@ {{else}} <p>Just some generic content in case nothing else was specified.</p> {{/if}} </div> File renamed without changes. -
johanobergman revised this gist
Oct 11, 2014 . 3 changed files with 20 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ import { section, yieldSection } from 'app-name/helpers/section-helpers'; Ember.Handlebars.registerHelper('section', section); Ember.Handlebars.registerHelper('yield-section', yieldSection); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ Simply register the two helpers "section" and "yield-section", and start right away! See example below, using ember-cli: This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ import Ember from 'ember'; var section, yieldSection; section = function(name, options) { this.set(name + "Section", options.fn); }; yieldSection = function(name, options) { var context, section; if ((context = this.get('parent')) && (section = context.get(name + "Section"))) { section(context); } }; export { section, yieldSection }; -
johanobergman revised this gist
Oct 11, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,8 @@ {{#if parent.footerSection}} <div class="component-footer"> {{yield-section 'footer'}} </div> {{else}} <p>Just some generic content in case nothing else was specified.</p> {{/if}} -
johanobergman revised this gist
Oct 11, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ {{yield-section 'footer'}} </div> {{else}} <p>Just some generic content in case nothing else was specified.</p> {{/if}} </div> -
johanobergman revised this gist
Oct 11, 2014 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,12 +6,12 @@ {{yield}} {{#if parent.footerSection}} <div class="component-footer"> {{yield-section 'footer'}} </div> {{else}} <p>Just some generic content in case nothing else was specified.</p> {{/if}} </div> -
johanobergman renamed this gist
Oct 11, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
johanobergman revised this gist
Oct 11, 2014 . 3 changed files with 20 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ Simply register the two helpers "section" and "yield-section", and start right away! See example below: This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ <h1>Hello from the index page!</h1> {{#my-component parent=this}} {{#section 'header'}} <h2>Header inside my awesome component.</h2> @@ -12,7 +12,7 @@ <p> {{#section 'footer'}} <p>Show me in the footer, please.<p> {{/section}} {{/my-component}} This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,17 @@ <div class="my-component"> <div class="component-header"> {{yield-section 'header'}} </div> {{yield}} {{#if parent.footerSection}} <div class="component-footer"> {{yield-section 'footer'}} </div> {{else}} <p>Just some generic content in case nothing else was specified.</p> {{/if}} </div> -
johanobergman revised this gist
Oct 11, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ <div class="my-component"> </div> -
johanobergman created this gist
Oct 11, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ <h1>Hello from the index page!</h1> {{#my-component parent=controller}} {{#section 'header'}} <h2>Header inside my awesome component.</h2> {{/section}} <p> Here goes the main body that fits into the standard "yield" helper. That's because I'm not in a section. <p> {{#section 'footer'}} <p>Copyright FooCompany {{/section}} {{/my-component}}