New clients now attempt to POST to client API
parent
7375d00e88
commit
f91071c350
|
@ -102,6 +102,34 @@
|
|||
}
|
||||
},
|
||||
|
||||
events:{
|
||||
"click .btn-primary":"saveClient"
|
||||
},
|
||||
|
||||
saveClient:function () {
|
||||
this.model.set({
|
||||
name:$('#name').val(),
|
||||
redirectURL:$('#redirectURL').val(),
|
||||
description:$('#description').val()
|
||||
});
|
||||
if (this.model.isNew()) {
|
||||
var self = this;
|
||||
app.clientList.create(this.model, {
|
||||
success:function () {
|
||||
alert('bravo!');
|
||||
},
|
||||
error: function () {
|
||||
alert('boo!');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
this.model.save();
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
render:function (eventName) {
|
||||
|
||||
var action = "Edit";
|
||||
|
@ -137,12 +165,16 @@
|
|||
},
|
||||
|
||||
newClient:function() {
|
||||
this.clientFormView = new ClientFormView();
|
||||
this.clientFormView = new ClientFormView({model:new ClientModel()});
|
||||
$('#content').html(this.clientFormView.render().el);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// holds the global app.
|
||||
// this gets init after the templates load
|
||||
var app = null;
|
||||
|
||||
// main
|
||||
$(function () {
|
||||
|
||||
|
@ -150,7 +182,7 @@
|
|||
$.get('resources/template/client.html', function (templates) {
|
||||
$('body').append(templates);
|
||||
|
||||
var app = new AppRouter();
|
||||
app = new AppRouter();
|
||||
Backbone.history.start();
|
||||
});
|
||||
|
||||
|
|
|
@ -87,14 +87,14 @@
|
|||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<label>Client name</label>
|
||||
<input type="text" class="" placeholder="Type something"> <span class="help-inline">Associated help text!</span>
|
||||
<input id="name" type="text" class="" placeholder="Type something"> <span class="help-inline">Associated help text!</span>
|
||||
|
||||
<label>Refresh URL</label>
|
||||
<input type="text" class="" placeholder="http://"><span class="help-inline">Associated help text!</span>
|
||||
<label>Redirect URL</label>
|
||||
<input id="redirectURL" type="text" class="" placeholder="http://"><span class="help-inline">Associated help text!</span>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<label>Description</label>
|
||||
<textarea class="input-xlarge" id="textarea" placeholder="Type a description"
|
||||
<textarea id="description" class="input-xlarge" placeholder="Type a description"
|
||||
rows="3"></textarea> <span class="help-inline">Associated help text!</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -108,7 +108,7 @@
|
|||
<label class="checkbox">
|
||||
<input type="checkbox"> Allow refresh tokens?
|
||||
</label>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<button class="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
Loading…
Reference in New Issue