summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2011-05-30 11:17:02 +0200
committerLeif Johansson <leifj@sunet.se>2011-05-30 11:17:02 +0200
commit1866e375b69aecb53b617da8993fc71c798af8f4 (patch)
treed93eaf3f65b6a72763874815be18215353695500
parentdb3632c30e9262adbe7a35be404ace0436a20271 (diff)
A simple jquery-based widget for disaplaying stuff from meetingtools.
-rw-r--r--src/meetingtools/apps/room/views.py13
-rw-r--r--src/meetingtools/urls.py1
-rw-r--r--src/site-media/css/jquery.meetingtools.css1
-rw-r--r--src/site-media/html/widget-test.html20
-rw-r--r--src/site-media/js/jquery.meetingtools.js29
5 files changed, 42 insertions, 22 deletions
diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py
index 6c22c14..e253d87 100644
--- a/src/meetingtools/apps/room/views.py
+++ b/src/meetingtools/apps/room/views.py
@@ -388,21 +388,12 @@ def _goto(request,room,clean=True,promote=False):
def _room2dict(room):
return {'name':room.name,
'description':room.description,
- 'user_count':room.user_count,
+ 'user_count':room.nusers(),
+ 'host_count':room.nhosts(),
'updated': rfc3339_date(room.lastupdated),
'self_cleaning': room.self_cleaning,
'url': room.go_url()}
-@login_required
-def widget(request,tn):
- tags = tn.split('+')
- rooms = TaggedItem.objects.get_by_model(Room, tags)
- title = 'Rooms tagged with %s' % " and ".join(tags)
- now = timeAsrfc822( datetime.now() )
- return respond_to(request,
- {'text/html':'apps/room/widget-test.html'},
- {'title':title,'description':title ,'edit':False,'date': now,'tags': tn,'rooms':rooms.all()})
-
# should not require login
def list_by_tag(request,tn):
tags = tn.split('+')
diff --git a/src/meetingtools/urls.py b/src/meetingtools/urls.py
index ec10376..703b49a 100644
--- a/src/meetingtools/urls.py
+++ b/src/meetingtools/urls.py
@@ -31,7 +31,6 @@ urlpatterns = patterns('',
(r'^room/(\d+)/tag$','meetingtools.apps.room.views.tag'),
(r'^room/(\d+)/untag/(.+)$','meetingtools.apps.room.views.untag'),
(r'^room/(\d+)/recordings$','meetingtools.apps.room.views.recordings'),
- (r'^widget/\+(.+)$','meetingtools.apps.room.views.widget'),
(r'^room/\+(.+)\.(?:json|html|htm)$','meetingtools.apps.room.views.list_by_tag'),
(r'^room/\+(.+)\.(?:atom)$',RoomAtomTagFeed()),
(r'^room/\+(.+)\.(?:rss)$',RoomRSSTagField()),
diff --git a/src/site-media/css/jquery.meetingtools.css b/src/site-media/css/jquery.meetingtools.css
new file mode 100644
index 0000000..293b8a8
--- /dev/null
+++ b/src/site-media/css/jquery.meetingtools.css
@@ -0,0 +1 @@
+.meeting-list li { list-style: none; display: block; } \ No newline at end of file
diff --git a/src/site-media/html/widget-test.html b/src/site-media/html/widget-test.html
new file mode 100644
index 0000000..3b27c16
--- /dev/null
+++ b/src/site-media/html/widget-test.html
@@ -0,0 +1,20 @@
+<html>
+ <head>
+ <script type="text/javascript" src="../js/jquery-1.5.1.min.js"></script>
+ <script type="text/javascript" src="../js/jquery-ui-1.8.11.custom.min.js"></script>
+ <link type="text/css" href="../css/sunet/jquery-ui-1.8.11.custom.css" rel="stylesheet"></link>
+ <link href="../css/jquery.meetingtools.css" rel="stylesheet" type="text/css" />
+
+ <script type="text/javascript" src="../js/jquery.meetingtools.js"></script>
+
+ <script type="text/javascript">
+ $(function() {
+ $("#meetings").meetingtools({tags: 'kaka'});
+ });
+ </script>
+ </head>
+ <body>
+ <h1>Meetings...</h1>
+ <div id="meetings"/>
+ </body>
+</html> \ No newline at end of file
diff --git a/src/site-media/js/jquery.meetingtools.js b/src/site-media/js/jquery.meetingtools.js
index 5bed8f3..1453226 100644
--- a/src/site-media/js/jquery.meetingtools.js
+++ b/src/site-media/js/jquery.meetingtools.js
@@ -1,6 +1,5 @@
/*
- *
- *
+ * a jQuery plugin for listing tagged meetings from meetingtools
*
*/
@@ -12,17 +11,27 @@ jQuery.fn.meetingtools = function(options) {
if (!url) {
url = 'http://localhost:8000';
}
- var url = url+'/room/+'+tags+'.json'
- var div = $(this)
+ var url = url+'/room/+'+tags+'.json';
+ var div = $(this);
$.getJSON(url,function(data) {
- div.append("<ul style=\"list-style: none;\">")
- $.each(data,function(room) {
- div.append("<li style=\"display: list-item; list-style: none; padding: 2px; 5px;\" class=\"ui-helper-reset ui-widget ui-state-highlight ui-corner-all\">");
- div.append(room['url']);
- div.append("</li>");
+ html = "<ul class=\"meeting-list\">";
+ $.each(data,function(i,room) {
+ html += "<li class=\"meeting\"><h4>"+room['name']+"</h4><div class=\"meeting-info\">";
+ if (room['description']) {
+ html += "<div class=\"meeting-description\">";
+ html += room['description'];
+ html += "</div>";
+ }
+ html += "<div class=\"meeting-participants\">"
+ html += "There are currently " + room['user_count'] + " participant(s) and " + room['host_count'] + " host(s) in the room.";
+ html += "</div>";
+ html += "<div class=\"meeting-url\"><a href=\"" + room['url'] + "\">" + room['url'] + "</a></div>";
+ html += "</li>";
});
- div.append("</ul>")
+ html += "</ul>";
+ div.append(html);
});
+
});
} \ No newline at end of file