diff --git a/pyweb/mumble/mmobjects.py b/pyweb/mumble/mmobjects.py index 339af8f..adbfc44 100755 --- a/pyweb/mumble/mmobjects.py +++ b/pyweb/mumble/mmobjects.py @@ -60,7 +60,10 @@ class mmChannel( object ): lambda self: len( self.players ) + sum( [ chan.playerCount for chan in self.subchans ] ), None ); - id = property( lambda self: "channel_%d"%self.chanid, None ); + + id = property( lambda self: "channel_%d"%self.chanid, None ); + + show = property( lambda self: self.parent is None or self.playerCount > 0, None ); def __str__( self ): return '' % ( self.name, self.chanid ); diff --git a/pyweb/mumble/templatetags/mumble_extras.py b/pyweb/mumble/templatetags/mumble_extras.py index d8ca75e..2a098b8 100644 --- a/pyweb/mumble/templatetags/mumble_extras.py +++ b/pyweb/mumble/templatetags/mumble_extras.py @@ -18,16 +18,6 @@ from django.template.loader import render_to_string register = template.Library(); -### FILTER: mrange -- used to render the ||| lines in the channel tree - -def mrange( value ): - "If value > 1, returns range( value - 1 ), else returns an empty list." - val = int( value ); - if( val > 1 ): - return range( val - 1 ); - return list(); - -register.filter( 'mrange', mrange ); ### FILTER: trunc -- converts "a very very extaordinary long text" to "a very very extra..." def trunc( string, maxlen = 50 ): diff --git a/template/mumble/channel.htm b/template/mumble/channel.htm index 381528c..52fcdbb 100644 --- a/template/mumble/channel.htm +++ b/template/mumble/channel.htm @@ -9,9 +9,11 @@ {{ Channel.name|trunc:30 }} - {% for sub in Channel.subchans %} - {{ sub|chanview:MumbleAccount }} - {% endfor %} - {% for player in Channel.players %}{{ player|chanview }}{% endfor %} + {% if Channel.show %} + {% for sub in Channel.subchans %} + {{ sub|chanview:MumbleAccount }} + {% endfor %} + {% for player in Channel.players %}{{ player|chanview }}{% endfor %} + {% endif %}