Test Client JS now valid. App.JS updates

pull/59/head
Michael Jett 2012-05-04 15:56:12 -04:00
parent e2e2dfca43
commit df174a1695
2 changed files with 99 additions and 59 deletions

View File

@ -13,13 +13,13 @@
refreshTokens:false refreshTokens:false
}, },
urlRoot:"../api/clients" urlRoot:"/resources/test/json/clients.js"
}); });
var ClientCollection = Backbone.Collection.extend({ var ClientCollection = Backbone.Collection.extend({
model:ClientModel, model:ClientModel,
url:"../api/clients" url:"/resources/test/json/clients.js"
}); });
@ -65,26 +65,56 @@
el: $("#client-table"), el: $("#client-table"),
addOne: function(todo) { initialize:function () {
this.model.bind("reset", this.render, this);
},
var view = new ClientView({ render:function (eventName) {
model:new ClientModel() _.each(this.model.models, function (client) {
}); $(this.el).append(new ClientView({model:client}).render().el);
}, this);
var chilly = view.render().el; return this;
this.$('tbody').append(view.render().el);
view.model.set({name:'hello world'});
} }
}); });
// Router
var AppRouter = Backbone.Router.extend({
routes:{
"":"list"
},
initialize:function () {
//$('#header').html(new HeaderView().render().el);
},
list:function () {
this.clientList = new ClientCollection();
this.clientListView = new ClientListView({model:this.clientList});
this.clientList.fetch({
dataType:"json",
success:function (collection, response) {
//console.dir(response);
},
error:function (collection, response) {
//console.dir(response);
}
});
//debugger;
}
});
// main
$(function () { $(function () {
// load templates and append them to the body // load templates and append them to the body
$.get('resources/template/client.html', function (templates) { $.get('resources/template/client.html', function (templates) {
$('body').append(templates); $('body').append(templates);
var app = new AppRouter();
Backbone.history.start();
}); });

View File

@ -1,47 +1,57 @@
var clients = [ [{
{ "name": "A name",
name:"A name", "redirectURL": "http://myURL.domain",
redirectURL:"http://myURL.domain", "grantType": ["my grant type 1", "my grant type 2"],
grantType:["my grant type 1", "my grant type 2"], "scope": ["scope 1", "scope 2"],
scope:["scope 1", "scope 2"], "authority": "my authority",
authority:"my authority", "description": "my description",
description:"my description", "refreshTokens": false
refreshTokens:false }, {
}, "name": "A name",
{ "redirectURL": "http://myURL.domain",
name:"A name", "grantType": ["my grant type 1", "my grant type 2"],
redirectURL:"http://myURL.domain", "scope": ["scope 1", "scope 2"],
grantType:["my grant type 1", "my grant type 2"], "authority": "my authority",
scope:["scope 1", "scope 2"], "description": "my description",
authority:"my authority", "refreshTokens": false
description:"my description", },{
refreshTokens:false "name": "A name",
}, "redirectURL": "http://myURL.domain",
{ "grantType": ["my grant type 1", "my grant type 2"],
name:"A name", "scope": ["scope 1", "scope 2"],
redirectURL:"http://myURL.domain", "authority": "my authority",
grantType:["my grant type 1", "my grant type 2"], "description": "my description",
scope:["scope 1", "scope 2"], "refreshTokens": false
authority:"my authority", },{
description:"my description", "name": "A name",
refreshTokens:false "redirectURL": "http://myURL.domain",
}, "grantType": ["my grant type 1", "my grant type 2"],
{ "scope": ["scope 1", "scope 2"],
name:"A name", "authority": "my authority",
redirectURL:"http://myURL.domain", "description": "my description",
grantType:["my grant type 1", "my grant type 2"], "refreshTokens": false
scope:["scope 1", "scope 2"], },{
authority:"my authority", "name": "A name",
description:"my description", "redirectURL": "http://myURL.domain",
refreshTokens:false "grantType": ["my grant type 1", "my grant type 2"],
}, "scope": ["scope 1", "scope 2"],
{ "authority": "my authority",
name:"A name", "description": "my description",
redirectURL:"http://myURL.domain", "refreshTokens": false
grantType:["my grant type 1", "my grant type 2"], },{
scope:["scope 1", "scope 2"], "name": "A name",
authority:"my authority", "redirectURL": "http://myURL.domain",
description:"my description", "grantType": ["my grant type 1", "my grant type 2"],
refreshTokens:false "scope": ["scope 1", "scope 2"],
} "authority": "my authority",
]; "description": "my description",
"refreshTokens": false
},{
"name": "A name",
"redirectURL": "http://myURL.domain",
"grantType": ["my grant type 1", "my grant type 2"],
"scope": ["scope 1", "scope 2"],
"authority": "my authority",
"description": "my description",
"refreshTokens": false
}]