From b9afc7e40bcc9b5e06cd7aee26424c798e1cab69 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sat, 21 Aug 2010 14:45:20 +0200 Subject: [PATCH] =?UTF-8?q?implement=20auto-loading=20the=20right=E2=84=A2?= =?UTF-8?q?=20way=20and=20add=20a=20button=20to=20switch=20to=20the=20deta?= =?UTF-8?q?ils=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyweb/mumble/templates/mumble/list.html | 22 +++++++++++++++------- pyweb/mumble/views.py | 3 ++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/pyweb/mumble/templates/mumble/list.html b/pyweb/mumble/templates/mumble/list.html index aee3637..012018a 100644 --- a/pyweb/mumble/templates/mumble/list.html +++ b/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(){ diff --git a/pyweb/mumble/views.py b/pyweb/mumble/views.py index 51dbf93..6c0176b 100644 --- a/pyweb/mumble/views.py +++ b/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" )