Commit 4607606f by Brittany Cheng

Merge branch 'master' of github.com:MITx/mitx into discussion

parents 986f2a22 2984d7a4
...@@ -27,9 +27,6 @@ ...@@ -27,9 +27,6 @@
<br/> <br/>
<script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/codemirror.js"></script>
<script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/python.js"></script>
<link rel="stylesheet" href="${ settings.LIB_URL }CodeMirror/codemirror.css" />
<script> <script>
// Note: We need to make the area follow the CodeMirror for this to work. // Note: We need to make the area follow the CodeMirror for this to work.
$(function(){ $(function(){
...@@ -42,7 +39,10 @@ ...@@ -42,7 +39,10 @@
}); });
</script> </script>
<style type="text/css"> <style type="text/css">
.CodeMirror {border-style: solid; .CodeMirror {
border-width: 1px;} border: 2px solid black;
font-size: 14px;
line-height: 18px;
}
</style> </style>
</section> </section>
...@@ -31,8 +31,20 @@ class @Problem ...@@ -31,8 +31,20 @@ class @Problem
else else
$.postWithPrefix "#{@url}/problem_get", (response) => $.postWithPrefix "#{@url}/problem_get", (response) =>
@el.html(response.html) @el.html(response.html)
@executeProblemScripts()
@bind() @bind()
executeProblemScripts: ->
@el.find(".script_placeholder").each (index, placeholder) ->
s = $("<script>")
s.attr("type", "text/javascript")
s.attr("src", $(placeholder).attr("data-src"))
# Need to use the DOM elements directly or the scripts won't execute
# properly.
$('head')[0].appendChild(s[0])
$(placeholder).remove()
check: => check: =>
Logger.log 'problem_check', @answers Logger.log 'problem_check', @answers
$.postWithPrefix "#{@url}/problem_check", @answers, (response) => $.postWithPrefix "#{@url}/problem_check", @answers, (response) =>
......
...@@ -104,7 +104,8 @@ class HTMLSnippet(object): ...@@ -104,7 +104,8 @@ class HTMLSnippet(object):
""" """
Return the html used to display this snippet Return the html used to display this snippet
""" """
raise NotImplementedError("get_html() must be provided by specific modules") raise NotImplementedError("get_html() must be provided by specific modules - not present in {0}"
.format(self.__class__))
class XModule(HTMLSnippet): class XModule(HTMLSnippet):
......
...@@ -88,7 +88,7 @@ class XmlDescriptor(XModuleDescriptor): ...@@ -88,7 +88,7 @@ class XmlDescriptor(XModuleDescriptor):
# The attributes will be removed from the definition xml passed # The attributes will be removed from the definition xml passed
# to definition_from_xml, and from the xml returned by definition_to_xml # to definition_from_xml, and from the xml returned by definition_to_xml
metadata_attributes = ('format', 'graceperiod', 'showanswer', 'rerandomize', metadata_attributes = ('format', 'graceperiod', 'showanswer', 'rerandomize',
'start', 'due', 'graded', 'name', 'slug') 'start', 'due', 'graded', 'name', 'slug', 'hide_from_toc')
# A dictionary mapping xml attribute names to functions of the value # A dictionary mapping xml attribute names to functions of the value
# that return the metadata key and value # that return the metadata key and value
......
...@@ -56,11 +56,13 @@ def toc_for_course(user, request, course, active_chapter, active_section): ...@@ -56,11 +56,13 @@ def toc_for_course(user, request, course, active_chapter, active_section):
active = (chapter.metadata.get('display_name') == active_chapter and active = (chapter.metadata.get('display_name') == active_chapter and
section.metadata.get('display_name') == active_section) section.metadata.get('display_name') == active_section)
hide_from_toc = section.metadata.get('hide_from_toc', 'false').lower() == 'true'
sections.append({'name': section.metadata.get('display_name'), if not hide_from_toc:
'format': section.metadata.get('format', ''), sections.append({'name': section.metadata.get('display_name'),
'due': section.metadata.get('due', ''), 'format': section.metadata.get('format', ''),
'active': active}) 'due': section.metadata.get('due', ''),
'active': active})
chapters.append({'name': chapter.metadata.get('display_name'), chapters.append({'name': chapter.metadata.get('display_name'),
'sections': sections, 'sections': sections,
......
...@@ -43,6 +43,10 @@ p { ...@@ -43,6 +43,10 @@ p {
span { span {
font: normal 1em/1.6em $sans-serif; font: normal 1em/1.6em $sans-serif;
} }
/* Fix for CodeMirror: prevent top-level span from affecting deeply-embedded span in CodeMirror */
.CodeMirror span {
font: inherit;
}
p + p, ul + p, ol + p { p + p, ul + p, ol + p {
margin-top: 20px; margin-top: 20px;
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<%def name="make_chapter(chapter)"> <%def name="make_chapter(chapter)">
<h3><a href="#">${chapter['name']}</a></h3> <h3><a href="#">${chapter['name']}</a></h3>
<ul> <ul>
% for section in chapter['sections']: % for section in chapter['sections']:
<li${' class="active"' if 'active' in section and section['active'] else ''}> <li${' class="active"' if 'active' in section and section['active'] else ''}>
<a href="${reverse('courseware_section', args=[course_id] + format_url_params([chapter['name'], section['name']]))}"> <a href="${reverse('courseware_section', args=[course_id] + format_url_params([chapter['name'], section['name']]))}">
<p>${section['name']} <p>${section['name']}
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
${section['format']} ${"due " + section['due'] if 'due' in section and section['due'] != '' else ''} ${section['format']} ${"due " + section['due'] if 'due' in section and section['due'] != '' else ''}
</span> </span>
</p> </p>
</a> </a>
% endfor </li>
</ul> % endfor
</%def> </ul>
</%def>
% for chapter in toc: % for chapter in toc:
${make_chapter(chapter)} ${make_chapter(chapter)}
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<article class="response"> <article class="response">
<h3>What will UC Berkeley's direct participation entail?</h3> <h3>What will UC Berkeley's direct participation entail?</h3>
<p>UC Berkeley will begin by offering two courses on edX in Fall 2012, and will collaborate on the development of the technology platform. We will explore, experiment and innovate together.</p> <p>UC Berkeley will begin by offering two courses on edX in Fall 2012, and will collaborate on the development of the technology platform. We will explore, experiment and innovate together.</p>
<p>UC Berkeley will also serve as the inaugural chair of the "X University" Consortium for an initial 5 year period. As Chair, UC Berkeley will participate on the edX Board on behalf of the X Universities.</p>
</article> </article>
<article class="response"> <article class="response">
<h3>Why is edX only adding one X University?</h3> <h3>Why is edX only adding one X University?</h3>
......
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