Update syntax in ember templates.

No Issue.
- Outlet names must be quoted.
- {{#each}} helper will no longer implicitly switch context.
  Change usage to {{#each foo in bar}}.
This commit is contained in:
Jason Williams 2014-12-05 21:54:42 +00:00
parent aca7577b60
commit 6f595c959a
9 changed files with 40 additions and 40 deletions

View File

@ -1,7 +1,7 @@
{{#if importErrors}} {{#if importErrors}}
<table class="table"> <table class="table">
{{#each importErrors}} {{#each error in importErrors}}
<tr><td>{{message}}</td></tr> <tr><td>{{error.message}}</td></tr>
{{/each}} {{/each}}
</table> </table>
{{/if}} {{/if}}

View File

@ -10,6 +10,6 @@
{{outlet}} {{outlet}}
</main> </main>
{{outlet modal}} {{outlet "modal"}}
{{outlet settings-menu}} {{outlet "settings-menu"}}

View File

@ -1,3 +1,3 @@
{{#each messages}} {{#each message in messages}}
{{gh-notification message=this}} {{gh-notification message=message}}
{{/each}} {{/each}}

View File

@ -1,5 +1,5 @@
<select {{bind-attr id=selectId name=selectName}}> <select {{bind-attr id=selectId name=selectName}}>
{{#each roles}} {{#each role in roles}}
<option {{bind-attr value=id}}>{{name}}</option> <option {{bind-attr value=role.id}}>{{role.name}}</option>
{{/each}} {{/each}}
</select> </select>

View File

@ -16,11 +16,11 @@
<h3>Stack Trace</h3> <h3>Stack Trace</h3>
<p><strong>{{message}}</strong></p> <p><strong>{{message}}</strong></p>
<ul class="error-stack-list"> <ul class="error-stack-list">
{{#each stack}} {{#each item in stack}}
<li> <li>
at at
{{#if function}}<em class="error-stack-function">{{function}}</em>{{/if}} {{#if item.function}}<em class="error-stack-function">{{item.function}}</em>{{/if}}
<span class="error-stack-file">({{at}})</span> <span class="error-stack-file">({{item.at}})</span>
</li> </li>
{{/each}} {{/each}}
</ul> </ul>

View File

@ -5,8 +5,8 @@
</div> </div>
<div class="publish-bar-tags"> <div class="publish-bar-tags">
<div class="tags-wrapper tags"> <div class="tags-wrapper tags">
{{#each controller.tags}} {{#each tag in controller.tags}}
<span class="tag" {{action "deleteTag" this target=view}}>{{name}}</span> <span class="tag" {{action "deleteTag" tag target=view}}>{{tag.name}}</span>
{{/each}} {{/each}}
</div> </div>
</div> </div>
@ -14,8 +14,8 @@
<input type="hidden" class="tags-holder" id="tags-holder"> <input type="hidden" class="tags-holder" id="tags-holder">
{{view view.tagInputView class="tag-input js-tag-input" id="tags" value=newTagText}} {{view view.tagInputView class="tag-input js-tag-input" id="tags" value=newTagText}}
<ul class="suggestions dropdown-menu dropdown-triangle-bottom" {{bind-attr style=view.overlayStyles}}> <ul class="suggestions dropdown-menu dropdown-triangle-bottom" {{bind-attr style=view.overlayStyles}}>
{{#each suggestions}} {{#each suggestion in suggestions}}
{{#view view.suggestionView suggestion=this}} {{#view view.suggestionView suggestion=suggestion}}
<a href="javascript:void(0);">{{view.suggestion.highlightedName}}</a> <a href="javascript:void(0);">{{view.suggestion.highlightedName}}</a>
{{/view}} {{/view}}
{{/each}} {{/each}}

View File

@ -13,17 +13,17 @@
</header> </header>
{{#view "paginated-scroll-box" tagName="section" classNames="content-list-content"}} {{#view "paginated-scroll-box" tagName="section" classNames="content-list-content"}}
<ol class="posts-list"> <ol class="posts-list">
{{#each itemController="posts/post" itemView="post-item-view" itemTagName="li"}} {{#each post in model itemController="posts/post" itemView="post-item-view" itemTagName="li"}}
{{#link-to "posts.post" this class="permalink" title="Edit this post"}} {{#link-to "posts.post" post class="permalink" title="Edit this post"}}
<h3 class="entry-title">{{title}}</h3> <h3 class="entry-title">{{post.title}}</h3>
<section class="entry-meta"> <section class="entry-meta">
<span class="status"> <span class="status">
{{#if isPublished}} {{#if post.isPublished}}
{{#if page}} {{#if post.page}}
<span class="page">Page</span> <span class="page">Page</span>
{{else}} {{else}}
<time datetime="{{unbound published_at}}" class="date published"> <time datetime="{{unbound post.published_at}}" class="date published">
Published {{gh-format-timeago published_at}} Published {{gh-format-timeago post.published_at}}
</time> </time>
{{/if}} {{/if}}
{{else}} {{else}}

View File

@ -10,14 +10,14 @@
<th>Status</th> <th>Status</th>
</thead> </thead>
<tbody> <tbody>
{{#each itemController="settings/app"}} {{#each app in model itemController="settings/app"}}
<tr> <tr>
<td> <td>
{{#if package}}{{package.name}} - {{package.version}}{{else}}{{name}} - package.json missing :({{/if}} {{#if app.package}}{{app.package.name}} - {{app.package.version}}{{else}}{{app.name}} - package.json missing :({{/if}}
</td> </td>
<td> <td>
<button type="button" {{action toggleApp this}} {{bind-attr class=":btn :js-button-active activeClass:btn-red inactiveClass:btn-green activeClass:js-button-deactivate"}}> <button type="button" {{action toggleApp app}} {{bind-attr class=":btn :js-button-active activeClass:btn-red inactiveClass:btn-green activeClass:js-button-deactivate"}}>
{{buttonText}} {{app.buttonText}}
</button> </button>
</td> </td>
</tr> </tr>

View File

@ -15,16 +15,16 @@
<h4 class="user-list-title">Invited users</h4> <h4 class="user-list-title">Invited users</h4>
{{#each invitedUsers itemController="settings/users/user"}} {{#each user in invitedUsers itemController="settings/users/user"}}
<div class="user-list-item"> <div class="user-list-item">
<span class="user-list-item-icon icon-mail">ic</span> <span class="user-list-item-icon icon-mail">ic</span>
<div class="user-list-item-body"> <div class="user-list-item-body">
<span class="name">{{email}}</span><br> <span class="name">{{user.email}}</span><br>
{{#if pending}} {{#if user.pending}}
<span class="red">Invitation not sent - please try again</span> <span class="red">Invitation not sent - please try again</span>
{{else}} {{else}}
<span class="description">Invitation sent: {{created_at}}</span> <span class="description">Invitation sent: {{user.created_at}}</span>
{{/if}} {{/if}}
</div> </div>
<aside class="user-list-item-aside"> <aside class="user-list-item-aside">
@ -42,23 +42,23 @@
<h4 class="user-list-title">Active users</h4> <h4 class="user-list-title">Active users</h4>
{{#each activeUsers itemController="settings/users/user"}} {{#each user in activeUsers itemController="settings/users/user"}}
{{#link-to 'settings.users.user' this class="user-list-item" }} {{#link-to 'settings.users.user' user class="user-list-item" }}
<span class="user-list-item-figure" {{bind-attr style=image}}> <span class="user-list-item-figure" {{bind-attr style=user.image}}>
<span class="hidden">Photo of {{unbound name}}</span> <span class="hidden">Photo of {{unbound user.name}}</span>
</span> </span>
<div class="user-list-item-body"> <div class="user-list-item-body">
<span class="name"> <span class="name">
{{name}} {{user.name}}
</span> </span>
<br> <br>
<span class="description">Last seen: {{unbound last_login}}</span> <span class="description">Last seen: {{unbound user.last_login}}</span>
</div> </div>
<aside class="user-list-item-aside"> <aside class="user-list-item-aside">
{{#unless isAuthor}} {{#unless user.isAuthor}}
{{#each roles}} {{#each role in user.roles}}
<span class="role-label {{unbound lowerCaseName}}">{{name}}</span> <span class="role-label {{unbound role.lowerCaseName}}">{{role.name}}</span>
{{/each}} {{/each}}
{{/unless}} {{/unless}}
</aside> </aside>