Commit 5aa2ad84 by Bridger Maxwell

Added xmodule for showing a 'find collaborator' link.

parent ba57e8a7
......@@ -36,6 +36,7 @@ setup(
"videodev = xmodule.backcompat_module:TranslateCustomTagDescriptor",
"videosequence = xmodule.seq_module:SequenceDescriptor",
"discussion = xmodule.discussion_module:DiscussionDescriptor",
"collaborate = xmodule.collaborate_module:CollaborateDescriptor",
]
}
)
from lxml import etree
from pkg_resources import resource_string, resource_listdir
from xmodule.x_module import XModule
from xmodule.raw_module import RawDescriptor
import json
class CollaborateModule(XModule):
# js = {'coffee':
# [resource_string(__name__, 'js/src/time.coffee'),
# resource_string(__name__, 'js/src/discussion/display.coffee')]
# }
# js_module_name = "FindCollaborators"
def get_html(self):
context = {
'collaborate_room': self.collaborate_room,
}
return self.system.render_template('xmodules/collaborate_module.html', context)
def __init__(self, system, location, definition, descriptor, instance_state=None, shared_state=None, **kwargs):
XModule.__init__(self, system, location, definition, descriptor, instance_state, shared_state, **kwargs)
if isinstance(instance_state, str):
instance_state = json.loads(instance_state)
xml_data = etree.fromstring(definition['data'])
self.collaborate_room = xml_data.attrib['collaborate_room']
class CollaborateDescriptor(RawDescriptor):
module_class = CollaborateModule
template_dir_name = "collaborate"
@mixin blue-button {
display: block;
height: 35px;
padding: 0 15px;
border-radius: 3px;
border: 1px solid #2d81ad;
@include linear-gradient(top, #6dccf1, #38a8e5);
font-size: 13px;
font-weight: 700;
line-height: 32px;
color: #fff;
text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 1px 1px rgba(0, 0, 0, .15);
&:hover {
border-color: #297095;
@include linear-gradient(top, #4fbbe4, #2090d0);
}
}
.collaborate_module {
float: right;
.find_collaborator {
@include blue-button;
font-size: 13px;
z-index: 25; // To make the collaborate-status show up below
position: relative; // To make the z-index work
}
.collaborate-status {
//Displays below the .find_collaborator, like a little dropdown menu
font-size: 12px;
display: block;
height: 22px;
border-radius: 3px;
background-color: #10242E;
color: #fff;
margin: -10px 10px;
padding: 12px 15px 0px;
z-index: 20;
position: relative;
}
}
......@@ -29,4 +29,5 @@
@import 'multicourse/help';
@import 'discussion';
@import 'collaborate';
@import 'news';
<%!
import urllib
%>
<div class="collaborate_module">
<a class="find_collaborator" href="#" onclick="window.open('http://127.0.0.1:3000/pair/${collaborate_room | urllib.quote}', 'collaborate_window', 'width=780, height=590'); return false;">Collaborate on ${collaborate_room | h}</a>
<span class="collaborate-status">Connecting...</span>
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment