Skip to content

Instantly share code, notes, and snippets.

@davydotcom
Last active December 11, 2015 04:48
Show Gist options
  • Save davydotcom/4547596 to your computer and use it in GitHub Desktop.
Save davydotcom/4547596 to your computer and use it in GitHub Desktop.
<div class="modal hide fade in" id="modal">
{{outlet modal}}
</div>
<a {{action editAccount}} class="btn btn-primary pull-right">New Account</a>
<h3>Chart of Accounts</h3>
<hr/>
<table id="accounts" class="table table-striped table-hover">
<thead>
<tr class="account">
<th>Acct. #</th>
<th>Name</th>
<th>Type</th>
<th class="account_balance">Balance</th>
<th></th>
</tr>
</thead>
<tbody>
{{#each account in controller}}
<tr>
<td>{{account.accountNumber}}</td>
<td>{{account.name}}</td>
<td>{{account.accountType}}</td>
<td>{{account.balance}}</td>
<td>
<a {{action editAccount account}} class="btn pull-right">Edit</a>
</td>
</tr>
{{/each}}
</tbody>
</table>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
{{#if id}}
<h3 id="myModalLabel">Edit Account</h3>
{{else}}
<h3 id="myModalLabel">New Account</h3>
{{/if}}
</div>
<div class="modal-body">
{{name}}
Loading...
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
Cointrace.GlAccountsEditView = Ember.View.extend
templateName: 'gl_accounts_edit'
didInsertElement: ->
$('#modal').modal("show")
Cointrace.GlAccountsRoute = Ember.Route.extend
setupController: (controller) ->
controller.set 'content', Cointrace.Gl.Account.find()
events:
editAccount: (account) ->
controller = this.controllerFor 'glAccountsEdit'
controller.set "content", (account || Cointrace.Gl.Account.createRecord())
this.render 'gl_accounts_edit',
into: 'application'
outlet: 'modal'
controller: controller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment