Browse Source

implement auto-loading the right™ way and add a button to switch to the details page

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
b9afc7e40b
  1. 22
      pyweb/mumble/templates/mumble/list.html
  2. 3
      pyweb/mumble/views.py

22
pyweb/mumble/templates/mumble/list.html

@ -43,7 +43,8 @@
],
items: [{
xtype: "listview",
title: gettext("Available servers"),
title: gettext("Available servers"),
ref: "serverlist",
region: "west",
width: 350,
split: true,
@ -51,7 +52,12 @@
store: new Ext.data.DirectStore({
directFn: MumbleList.servers,
fields: [ 'id', 'name' ],
autoLoad: true
autoLoad: true,
listeners: {
load: function( store, records, objects ){
mainpanel.serverlist.select(0);
}
}
}),
columns: [{
header: gettext("Name"),
@ -59,11 +65,6 @@
width: 1.
}],
listeners: {
beforerender: function( listview ){
listview.store.on("load", function( store, records, objects ){
listview.select(0);
});
},
dblclick: function(listview){
selectedstuff = listview.getSelectedRecords();
MumbleList.serverurl( selectedstuff[0].data.id, function(provider, response){
@ -73,6 +74,7 @@
selectionchange: function(listview, nodes){
selectedstuff = listview.getSelectedRecords();
MumbleList.serverinfo( selectedstuff[0].data.id, function(provider, response){
mainpanel.selectedServer = response.result;
var info = renderserverinfos(response.result);
mainpanel.descrippanel.el.dom.children[1].children[0].innerHTML = info;
});
@ -84,6 +86,12 @@
title: gettext("Server overview"),
ref: 'descrippanel',
html: gettext("Loading..."),
buttons: [{
text: gettext('Server details'),
handler: function( button, state ){
location.href = mainpanel.selectedServer.detailsurl;
}
}]
}],
});
function updateLayout(){

3
pyweb/mumble/views.py

@ -129,7 +129,8 @@ def serverinfo( request, server ):
'channel_cnt': srv.channel_cnt,
'uptime': srv.uptime,
'upsince': unicode(srv.upsince),
'minurl': reverse( mobile_show, args=(server,) )
'minurl': reverse( mobile_show, args=(server,) ),
'detailsurl': reverse( show, args=(server,) ),
}
@EXT_DIRECT_PROVIDER.register_method( "MumbleList" )

Loading…
Cancel
Save