updated variables for consistency, tracking down a data-loading bug

pull/263/head
Justin Richer 2012-11-14 15:21:41 -05:00
parent 51cfe1746d
commit f39c254353
2 changed files with 16 additions and 9 deletions

View File

@ -606,12 +606,12 @@
render:function (eventName) {
$(this.el).html($('#tmpl-whitelist-table').html());
_.each(this.model.models, function (whitelist) {
_.each(this.model.models, function (whiteList) {
// look up client
var client = app.clientList.getByClientId(whitelist.get('clientId'));
var client = app.clientList.getByClientId(whiteList.get('clientId'));
$('#whitelist-table', this.el).append(new WhiteListView({model: whitelist, client: client}).render().el);
$('#whitelist-table', this.el).append(new WhiteListView({model: whiteList, client: client}).render().el);
}, this);
return this;
@ -632,7 +632,7 @@
render:function(eventName) {
var json = {whitelist: this.model.toJSON(), client: this.options.client.toJSON()};
var json = {whiteList: this.model.toJSON(), client: this.options.client.toJSON()};
this.$el.html(this.template(json));
return this;
@ -719,9 +719,13 @@
},
cancelWhiteList:function(event) {
app.navigate('admin/whitelists', {trigger:true});
},
render:function (eventName) {
var json = {whitelist: this.model.toJSON(), client: this.options.client.toJSON()};
var json = {whiteList: this.model.toJSON(), client: this.options.client.toJSON()};
this.$el.html(this.template(json));
@ -760,8 +764,10 @@
initialize:function () {
// TODO: lazy load these instead? bootstrap them?
jQuery.ajaxSetup({async:false});
this.clientList = new ClientCollection();
this.whiteListList = new WhiteListCollection();
jQuery.ajaxSetup({async:true});
this.clientListView = new ClientListView({model:this.clientList});
this.whiteListListView = new WhiteListListView({model:this.whiteListList});
@ -876,10 +882,11 @@
]);
var whiteList = this.whiteListList.get(id);
var client = app.clientList.getByClientId(whitelist.get('clientId'));
var client = app.clientList.getByClientId(whiteList.get('clientId'));
this.whiteListFormView = new WhiteListFormView({model: whiteList, client: client});
$('#content').html(this.whiteListFormView.render().el);
}

View File

@ -266,7 +266,7 @@
<script type="text/html" id="tmpl-whitelist">
<td>
<%=whitelist.clientId%>
<%=whiteList.clientId%>
<blockquote><small><%=client.clientDescription%></small></blockquote>
</td>
@ -305,7 +305,7 @@
<script type="text/html" id="tmpl-whitelist-form">
<h1><%=(whitelist.id == null ? 'New' : 'Edit')%> Whitelisted Site</h1>
<h1><%=(whiteList.id == null ? 'New' : 'Edit')%> Whitelisted Site</h1>
<form class="form-horizontal">