Commit 7dc4e55b by marjev

Added title attribute to iframe/img

parent c5e6c708
......@@ -51,7 +51,7 @@ class GoogleCalendarBlock(XBlock):
view = "Week" if self.default_view==0 else "Month" if self.default_view==1 else "Agenda"
iframe = "<iframe src=\"https://www.google.com/calendar/embed?mode={}&amp;src={}&amp;showCalendars=0\"></iframe>".format(view, self.calendar_id)
iframe = '<iframe src="https://www.google.com/calendar/embed?mode={}&amp;src={}&amp;showCalendars=0" title="{}"></iframe>'.format(view, self.calendar_id, self.display_name)
context.update({
"self": self,
......
......@@ -49,8 +49,9 @@ class GoogleDocumentBlock(XBlock):
fragment = Fragment()
context.update({
"self": self,
"self": self
})
fragment.add_content(loader.render_template('/templates/html/google_docs.html', context))
fragment.add_css(loader.load_unicode('public/css/google_docs.css'))
fragment.add_javascript(loader.load_unicode('public/js/google_docs.js'))
......
......@@ -2,6 +2,9 @@
function GoogleDocumentBlock(runtime, element) {
var iframe = $('iframe', element);
var image = $('img', element);
var display_name = $('.google-docs-xblock-wrapper', element).attr('data-display-name');
if(iframe.length > 0){
var iframe_src = iframe.attr('src');
......@@ -10,6 +13,10 @@ function GoogleDocumentBlock(runtime, element) {
/* add class to iframe containing Google document or spreadsheet*/
iframe.addClass('no-width-height');
}
iframe.attr('title', display_name);
}else if(image.length > 0){
image.attr('title', display_name);
}
function SignalDocumentLoaded(ev, presented_within){
......@@ -23,7 +30,7 @@ function GoogleDocumentBlock(runtime, element) {
})
});
}
$('iframe', element).load(function(e){SignalDocumentLoaded(e, 'iframe');});
$('img', element).load(function(e){SignalDocumentLoaded(e, 'img');});
iframe.load(function(e){SignalDocumentLoaded(e, 'iframe');});
image.load(function(e){SignalDocumentLoaded(e, 'img');});
}
<div class="google-docs-xblock-wrapper">
<div class="google-docs-xblock-wrapper" data-display-name="{{self.display_name}}">
{{ self.embed_code|safe }}
</div>
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