summaryrefslogtreecommitdiff
path: root/static/js/jquery.meetingtools.js
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2012-10-04 15:39:08 +0200
committerLeif Johansson <leifj@sunet.se>2012-10-04 15:39:08 +0200
commit2bdad0ae7a3a6e4ec5116becd39910388b679ed2 (patch)
tree5afdfba0a93c1af50d53bdc245d57cc4053e109a /static/js/jquery.meetingtools.js
parent873e7823970352d591deee5f67f47c5436ee0e84 (diff)
restructure
Diffstat (limited to 'static/js/jquery.meetingtools.js')
-rw-r--r--static/js/jquery.meetingtools.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/static/js/jquery.meetingtools.js b/static/js/jquery.meetingtools.js
new file mode 100644
index 0000000..2ce958d
--- /dev/null
+++ b/static/js/jquery.meetingtools.js
@@ -0,0 +1,45 @@
+/*
+ * a jQuery plugin for listing tagged meetings from meetingtools
+ *
+ */
+
+jQuery.fn.meetingtools = function(options) {
+
+ var defaults = {
+ onAdd: function() {},
+ onUpdate: function() {},
+ url: 'http://localhost:8000'
+ };
+ var options = $.extend({}, defaults, options);
+
+ this.each(function() {
+ var tags = options.tags;
+ var url = options.url;
+ var url = options.url+'/room/+'+tags+'.json?callback=?';
+ var div = $(this);
+ $.getJSON(url,function(data) {
+ div.html("<ul class=\"meeting-list\">");
+ ul = div.find('ul.meeting-list');
+ $.each(data,function(i,room) {
+ var 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-button\"><a target=\"_blank\" title=\"Enter "+room['name']+"\" href=\"" + room['url'] + "\">Enter " + room['name'] + "</a></div>";
+ html += "<div class=\"meeting-url\">" + room['url'] + "</a></div>";
+ html += "</div>";
+ html += "</li>";
+ ul.append(html);
+ options.onAdd();
+ });
+ options.onUpdate();
+ });
+
+
+ });
+} \ No newline at end of file