From 94b73dc92154395fd12e550a29a442e3e6d2f395 Mon Sep 17 00:00:00 2001 From: Sarina Canelake Date: Sun, 20 Sep 2015 11:10:30 -0400 Subject: [PATCH] Remove blank lines from tooltip display --- common/lib/xmodule/xmodule/seq_module.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/common/lib/xmodule/xmodule/seq_module.py b/common/lib/xmodule/xmodule/seq_module.py index 886fb317cd..f9b3d1cdbf 100644 --- a/common/lib/xmodule/xmodule/seq_module.py +++ b/common/lib/xmodule/xmodule/seq_module.py @@ -179,7 +179,9 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule): rendered_child = child.render(STUDENT_VIEW, context) fragment.add_frag_resources(rendered_child) - titles = child.get_content_titles() + # `titles` is a list of titles to inject into the sequential tooltip display. + # We omit any blank titles to avoid blank lines in the tooltip display. + titles = [title.strip() for title in child.get_content_titles() if title.strip()] childinfo = { 'content': rendered_child.content, 'title': "\n".join(titles), @@ -193,13 +195,14 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule): childinfo['title'] = child.display_name_with_default contents.append(childinfo) - params = {'items': contents, - 'element_id': self.location.html_id(), - 'item_id': self.location.to_deprecated_string(), - 'position': self.position, - 'tag': self.location.category, - 'ajax_url': self.system.ajax_url, - } + params = { + 'items': contents, + 'element_id': self.location.html_id(), + 'item_id': self.location.to_deprecated_string(), + 'position': self.position, + 'tag': self.location.category, + 'ajax_url': self.system.ajax_url, + } fragment.add_content(self.system.render_template("seq_module.html", params))