Commit 8d747e44 by Matthew Mongeau

Conditionally show calculator

parent db492cc4
...@@ -127,6 +127,24 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -127,6 +127,24 @@ class CourseDescriptor(SequenceDescriptor):
def grade_cutoffs(self): def grade_cutoffs(self):
return self._grading_policy['GRADE_CUTOFFS'] return self._grading_policy['GRADE_CUTOFFS']
@property
def show_calculator(self):
return self.metadata.get("show_calculator", None) == "Yes"
@lazyproperty
def __grading_policy(self):
policy_string = ""
try:
with self.system.resources_fs.open("grading_policy.json") as grading_policy_file:
policy_string = grading_policy_file.read()
except (IOError, ResourceNotFoundError):
log.warning("Unable to load course settings file from grading_policy.json in course " + self.id)
grading_policy = load_grading_policy(policy_string)
return grading_policy
@lazyproperty @lazyproperty
def grading_context(self): def grading_context(self):
""" """
......
...@@ -73,35 +73,38 @@ ...@@ -73,35 +73,38 @@
</div> </div>
</section> </section>
<div class="calc-main">
<a aria-label="Open Calculator" href="#" class="calc">Calculator</a> % if course.show_calculator:
<div class="calc-main">
<div id="calculator_wrapper"> <a aria-label="Open Calculator" href="#" class="calc">Calculator</a>
<form id="calculator">
<div class="input-wrapper"> <div id="calculator_wrapper">
<input type="text" id="calculator_input" /> <form id="calculator">
<div class="input-wrapper">
<div class="help-wrapper"> <input type="text" id="calculator_input" />
<a href="#">Hints</a>
<dl class="help"> <div class="help-wrapper">
<dt>Suffixes:</dt> <a href="#">Hints</a>
<dd> %kMGTcmunp</dd> <dl class="help">
<dt>Operations:</dt> <dt>Suffixes:</dt>
<dd>^ * / + - ()</dd> <dd> %kMGTcmunp</dd>
<dt>Functions:</dt> <dt>Operations:</dt>
<dd>sin, cos, tan, sqrt, log10, log2, ln, arccos, arcsin, arctan, abs </dd> <dd>^ * / + - ()</dd>
<dt>Constants</dt> <dt>Functions:</dt>
<dd>e, pi</dd> <dd>sin, cos, tan, sqrt, log10, log2, ln, arccos, arcsin, arctan, abs </dd>
<dt>Constants</dt>
<!-- Students won't know what parallel means at this time. Complex numbers aren't well tested in the courseware, so we would prefer to not expose them. If you read the comments in the source, feel free to use them. If you run into a bug, please let us know. But we can't officially support them right now. <dd>e, pi</dd>
<dt>Unsupported:</dt> <dd>||, j </dd> --> <!-- Students won't know what parallel means at this time. Complex numbers aren't well tested in the courseware, so we would prefer to not expose them. If you read the comments in the source, feel free to use them. If you run into a bug, please let us know. But we can't officially support them right now.
</dl>
<dt>Unsupported:</dt> <dd>||, j </dd> -->
</dl>
</div>
</div> </div>
</div> <input id="calculator_button" type="submit" value="="/>
<input id="calculator_button" type="submit" value="="/> <input type="text" id="calculator_output" readonly />
<input type="text" id="calculator_output" readonly /> </form>
</form>
</div>
</div> </div>
</div> % endif
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