add status on main page and add showFiles

This commit is contained in:
Seven Du
2013-04-22 21:01:27 +08:00
parent 5f0b5770b6
commit 023203b809
2 changed files with 58 additions and 3 deletions

View File

@@ -35,6 +35,9 @@ var App = Ember.Application.create({
rootElement: $('#container'),
total: 0,
ready: function(){
$.get("/txtapi/status", function(data){
$('#serverStatus').html("<pre>" + data + "</pre>");
});
}
});
@@ -95,6 +98,12 @@ App.ShowCodecsRoute = Ember.Route.extend({
}
});
App.ShowFilesRoute = Ember.Route.extend({
setupController: function(controller) {
App.showCodecsController.load();
}
});
App.UsersRoute = Ember.Route.extend({
setupController: function(controller) {
App.usersController.load();
@@ -109,6 +118,7 @@ App.Router.map(function(){
this.route("showCodecs");
this.route("showFiles");
this.route("showAPIs");
this.route("showStatus");
this.route("show");
this.route("users");
this.route("about", { path: "/about" });
@@ -313,6 +323,24 @@ App.showCodecsController = Ember.ArrayController.create({
}
});
App.showFilesController = Ember.ArrayController.create({
content: [],
init: function(){
},
load: function() {
var me = this;
$.getJSON("/txtapi/show?files%20as%20json", function(data){
// var channels = JSON.parse(data);
me.set('total', data.row_count);
me.content.clear();
if (data.row_count == 0) return;
me.pushObjects(data.rows);
});
}
});
App.usersController = Ember.ArrayController.create({
content: [],
init: function(){