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. 20
      pyweb/mumble/templates/mumble/list.html
  2. 3
      pyweb/mumble/views.py

20
pyweb/mumble/templates/mumble/list.html

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

3
pyweb/mumble/views.py

@ -129,7 +129,8 @@ def serverinfo( request, server ):
'channel_cnt': srv.channel_cnt, 'channel_cnt': srv.channel_cnt,
'uptime': srv.uptime, 'uptime': srv.uptime,
'upsince': unicode(srv.upsince), '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" ) @EXT_DIRECT_PROVIDER.register_method( "MumbleList" )

Loading…
Cancel
Save