simple code to add a gateway

This commit is contained in:
Seven Du 2014-03-15 00:04:56 +08:00
parent 5b1ab59f00
commit af4a225b39
2 changed files with 29 additions and 16 deletions

View File

@ -851,9 +851,15 @@ App.SofiaStatusController = Ember.ObjectController.extend({
actions: { actions: {
//Submit the modal //Submit the modal
submit: function() { submit: function() {
alert("Not implemented"); // alert("Not implemented");
return false; // return false;
$.post("/txtapi/lua?create_gw.lua%20" + $("#gateway_name").val(), { url = "/txtapi/lua?create_gateway.lua%20" +
$("#gateway_name").val() + "%20" +
$("#gateway_realm").val() + "%20" +
$("#gateway_username").val() + "%20" +
$("#gateway_password").val() + "%20" +
$("#gateway_register").is(":checked");
$.post(url, {
success: function() { }, success: function() { },
error: function(e) { } error: function(e) { }
}); });

View File

@ -643,30 +643,37 @@
</div> </div>
{{#bs-modal name="newUserForm" fade="true" footerButtonsBinding="addGatewayButtons" title="Add Gateway"}} {{#bs-modal name="newUserForm" fade="true" footerButtonsBinding="addGatewayButtons" title="Add Gateway"}}
<div class="form-group form-horizontal"> <form class="form-horizontal" role="form">
<label class="control-label" for="gateway_name">Name</label> <div class="form-group">
<div class="controls"> <label class="col-sm-2 control-label" for="gateway_name">Name</label>
<input type="text" name="gateway_name" value=""> <div class="col-sm-10">
<input class="form-control" type="text" id="gateway_name" placeholder="gw1">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="gateway_realm">Realm</label> <label class="col-sm-2 control-label" for="gateway_realm">Realm</label>
<div class="controls"> <div class="col-sm-10">
<input type="text" name="gateway_realm" value=""> <input class="form-control" type="text" id="gateway_realm" placeholder="example.com">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="gateway_name">Username</label> <label class="col-sm-2 control-label" for="gateway_username">Username</label>
<div class="controls"> <div class="col-sm-10">
<input type="text" name="gateway_username" value=""> <input class="form-control" type="text" id="gateway_username" placeholder="username">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label" for="gateway_name">Password</label> <label class="col-sm-2 control-label" for="gateway_password">Password</label>
<div class="controls"> <div class="col-sm-10">
<input type="text" name="gateway_password" value=""> <input class="form-control" type="text" id="gateway_password" placeholder="password">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-2 control-label" for="gateway_register">Register?</label>
<input type="checkbox" checked id="gateway_register"/>
</div>
</form>
{{/bs-modal}} {{/bs-modal}}
<h1>Sofia Status</h1> <h1>Sofia Status</h1>