diff options
-rw-r--r-- | src/meetingtools/apps/room/views.py | 10 | ||||
-rw-r--r-- | src/meetingtools/urls.py | 1 | ||||
-rw-r--r-- | src/site-media/css/style.css | 5 | ||||
-rw-r--r-- | src/templates/apps/room/list.html | 13 | ||||
-rw-r--r-- | src/templates/base.html | 2 |
5 files changed, 28 insertions, 3 deletions
diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index ba949fe..e612141 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -358,6 +358,16 @@ def _clean(request,room): room.sco_id = None return _update_room(request, room) +def occupation(request,rid): + room = get_object_or_404(Room,pk=rid) + with ac_api_client(room.acc) as api: + api.poll_user_counts(room) + d = {'nusers': room.user_count, 'nhosts': room.host_count} + return respond_to(request, + {'text/html': 'apps/room/fragments/occupation.txt', + 'application/json': json_response(d, request)}, + d) + def go_by_id(request,id): room = get_object_or_404(Room,pk=id) return goto(request,room) diff --git a/src/meetingtools/urls.py b/src/meetingtools/urls.py index ed541b9..c5401b3 100644 --- a/src/meetingtools/urls.py +++ b/src/meetingtools/urls.py @@ -45,6 +45,7 @@ urlpatterns = patterns('', (r'^api/stats/user/(.*)$','meetingtools.apps.stats.views.user_minutes_api'), (r'^api/stats/domain/(.+)$','meetingtools.apps.stats.views.domain_minutes_api'), (r'^api/stats/room/(\d+)$','meetingtools.apps.stats.views.room_minutes_api'), + (r'^api/room/(\d+)/occupation$','meetingtools.apps.room.views.occupation'), (r'^stats$','meetingtools.apps.stats.views.user'), (r'^stats/user/(.+)$','meetingtools.apps.stats.views.user'), (r'^stats/domain/(.+)$','meetingtools.apps.stats.views.domain'), diff --git a/src/site-media/css/style.css b/src/site-media/css/style.css index 706bbcf..89b604b 100644 --- a/src/site-media/css/style.css +++ b/src/site-media/css/style.css @@ -48,11 +48,14 @@ form fieldset { margin-left: 20px; } form fieldset input[type=text] { height: 25px; } form fieldset label {font-weight: bold; } .error { padding: 5px; } +div.room { overflow-y: hidden; overflow-x: hidden; } ul.links { list-style: none inside; padding: 0; margin: 0; } li.links { padding: 0; margin: 0; } form .ui-widget ul { list-style: none inside; padding: 0; margin: 0; } form .ui-widget li { float: right; border-right: 1px solid #CECECE; padding-right: 5px; margin: 0; vertical-align: middle;} -.ui-icon { display: inline-block !important; } +.ui-icon { display: inline-block !important; vertical-align: bottom; } +.spinner { margin-left: 10px; } +.spinner > div { width: 16px; vertical-align: bottom; } .minipanel { padding-top: 5px; padding-bottom: 5px; padding-left: 6px; padding-right: 6px; } .right { float: right; } .left { float: left; } diff --git a/src/templates/apps/room/list.html b/src/templates/apps/room/list.html index a21848f..34f5b6e 100644 --- a/src/templates/apps/room/list.html +++ b/src/templates/apps/room/list.html @@ -12,6 +12,15 @@ animated: true, autoHeight: false }); + $(".occupation").click(function(e) { + $(this).find(".occupation-info").first().load("{% prefix %}/api/room/"+$(this).parents('.room').first().attr('id')+"/occupation") + }); + $(".occupation").ajaxStart(function() { + $(".occupation > span.ui-icon-refresh").removeClass("ui-icon-refresh").removeClass("ui-icon").addClass("spinner").spin("custom"); + }).ajaxStop(function() { + $(".occupation > span.spinner").spin(false); + $(".occupation > span.spinner").addClass("ui-icon-refresh").addClass("ui-icon").removeClass("spinner"); + }); {% endblock %} {% block meta %} {% if tags %} @@ -24,7 +33,7 @@ {% if rooms %} <div id="rooms"> {% for r in rooms %} - <div id="{{r.id}}"> + <div class="room" id="{{r.id}}"> <h3><a href="#{{r.id}}" class="listheader">{{r.name}}</a></h3> <div> {% tags_for_object r as tags %} @@ -33,7 +42,7 @@ <ul class="nlist square" style="padding-left: 2px;"> <li>» Tags: {% for tag in tags %}<a style="margin-right: 5px;" class="ui-widget" href="{% prefix %}/room/+{{tag}}">{{tag}}</a>{% endfor %} {%if edit %}<a style="font-size: 75%;" href="{% prefix %}/room/{{r.id}}/tag"><em>... manage room tags</em></a>{%endif%}</li> <li>» Created by {{r.creator}} {{r.timecreated|datehumanize}}.</li> - <li>» {%if r.nusers%}There are {{r.nusers}} users present, {{r.nhosts}} of whom are hosts.{%else%}The room is currently unoccupied.{%endif%}</li> + <li>» <span class="occupation"><span class="occupation-info">{%if r.nusers%}There are {{r.nusers}} users present, {{r.nhosts}} of whom are hosts.{%else%}The room is currently unoccupied.{%endif%}</span><span class="ui-icon ui-icon-refresh"></span></span></li> {% if r.self_cleaning %}<li>» Room will be reset when empty.</li>{%else%}<li>» Room state is preserved between sessions.</li>{% endif %} {% if r.allow_host %}<li>» First participant can elect to become host.</li>{% endif %} {% if r.lastvisited %}<li>» Last visited {{r.lastvisited|datehumanize}}</li>{%endif%} diff --git a/src/templates/base.html b/src/templates/base.html index e0b3ac4..6b6d19b 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -18,6 +18,8 @@ <script type="text/javascript" src="{% prefix %}/site-media/js/jquery.meetingtools.js"></script> <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="{% prefix %}/site-media/js/excanvas.min.js"></script><![endif]--> <script type="text/javascript" src="{% prefix %}/site-media/js/jquery.flot.min.js"></script> + <script type="text/javascript" src="{% prefix %}/site-media/js/spin.min.js"></script> + <script type="text/javascript" src="{% prefix %}/site-media/js/jquery.spin.js"></script> <!--[if IE]> <link href="css/sunet-ie6.css" rel="stylesheet" type="text/css" /> <![endif]--> |