Browse Source

auto-truncate channel and player names

Natenom/support-murmur-13-1446181288462
Michael Ziegler 16 years ago
parent
commit
e9de0eca08
  1. 6
      pyweb/mumble/templatetags/mumble_extras.py
  2. 4
      template/mumble/content.htm

6
pyweb/mumble/templatetags/mumble_extras.py

@ -28,4 +28,10 @@ def mrange( value ):
register.filter( 'mrange', mrange ); register.filter( 'mrange', mrange );
### FILTER: trunc -- converts "a very very extaordinary long text" to "a very very extra..."
def trunc( string, maxlen = 50 ):
if len(string) < maxlen:
return string;
return string[:(maxlen - 3)] + "...";
register.filter( 'trunc', trunc );

4
template/mumble/content.htm

@ -26,14 +26,14 @@
{% endspaceless %} {% endspaceless %}
{% if item.1.is_player %} {% if item.1.is_player %}
<img src="/static/mumble/talking_off.png" alt="player" /> <img src="/static/mumble/talking_off.png" alt="player" />
<a id="link_{{ item.1.id }}" class="dingen" href="#">{{ item.1.name }}</a>
<a id="link_{{ item.1.id }}" class="dingen" href="#" title="{{ item.1.name }}">{{ item.1.name|trunc:30 }}</a>
{% else %} {% else %}
{% if item.1.linked %} {% if item.1.linked %}
<img src="/static/mumble/channel_linked.png" alt="linked channel"/> <img src="/static/mumble/channel_linked.png" alt="linked channel"/>
{% else %} {% else %}
<img src="/static/mumble/channel.png" alt="channel"/> <img src="/static/mumble/channel.png" alt="channel"/>
{% endif %} {% endif %}
<a href="mumble://{% if mumbleAccount %}{{ mumbleAccount.name }}@{% endif %}{{ DBaseObject.addr }}:{{ DBaseObject.port }}/{% for chan in item.2 %}{{ chan|urlencode }}/{% endfor %}{{ item.1.name|urlencode }}" class="dingen" id="link_{{ item.1.id }}">{{ item.1.name }}</a>
<a href="mumble://{% if mumbleAccount %}{{ mumbleAccount.name }}@{% endif %}{{ DBaseObject.addr }}:{{ DBaseObject.port }}/{% for chan in item.2 %}{{ chan|urlencode }}/{% endfor %}{{ item.1.name|urlencode }}" class="dingen" id="link_{{ item.1.id }}" title="{{ item.1.name }}">{{ item.1.name|trunc:30 }}</a>
{% endif %} {% endif %}
</span> </span>
</td> </td>

Loading…
Cancel
Save