Conditionally show calculator
This commit is contained in:
@@ -127,6 +127,24 @@ class CourseDescriptor(SequenceDescriptor):
|
||||
def grade_cutoffs(self):
|
||||
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
|
||||
def grading_context(self):
|
||||
"""
|
||||
|
||||
@@ -73,35 +73,38 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="calc-main">
|
||||
<a aria-label="Open Calculator" href="#" class="calc">Calculator</a>
|
||||
|
||||
<div id="calculator_wrapper">
|
||||
<form id="calculator">
|
||||
<div class="input-wrapper">
|
||||
<input type="text" id="calculator_input" />
|
||||
% if course.show_calculator:
|
||||
<div class="calc-main">
|
||||
<a aria-label="Open Calculator" href="#" class="calc">Calculator</a>
|
||||
|
||||
<div class="help-wrapper">
|
||||
<a href="#">Hints</a>
|
||||
<dl class="help">
|
||||
<dt>Suffixes:</dt>
|
||||
<dd> %kMGTcmunp</dd>
|
||||
<dt>Operations:</dt>
|
||||
<dd>^ * / + - ()</dd>
|
||||
<dt>Functions:</dt>
|
||||
<dd>sin, cos, tan, sqrt, log10, log2, ln, arccos, arcsin, arctan, abs </dd>
|
||||
<dt>Constants</dt>
|
||||
<dd>e, pi</dd>
|
||||
<div id="calculator_wrapper">
|
||||
<form id="calculator">
|
||||
<div class="input-wrapper">
|
||||
<input type="text" id="calculator_input" />
|
||||
|
||||
<!-- 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.
|
||||
<div class="help-wrapper">
|
||||
<a href="#">Hints</a>
|
||||
<dl class="help">
|
||||
<dt>Suffixes:</dt>
|
||||
<dd> %kMGTcmunp</dd>
|
||||
<dt>Operations:</dt>
|
||||
<dd>^ * / + - ()</dd>
|
||||
<dt>Functions:</dt>
|
||||
<dd>sin, cos, tan, sqrt, log10, log2, ln, arccos, arcsin, arctan, abs </dd>
|
||||
<dt>Constants</dt>
|
||||
<dd>e, pi</dd>
|
||||
|
||||
<dt>Unsupported:</dt> <dd>||, j </dd> -->
|
||||
</dl>
|
||||
<!-- 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.
|
||||
|
||||
<dt>Unsupported:</dt> <dd>||, j </dd> -->
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input id="calculator_button" type="submit" value="="/>
|
||||
<input type="text" id="calculator_output" readonly />
|
||||
</form>
|
||||
<input id="calculator_button" type="submit" value="="/>
|
||||
<input type="text" id="calculator_output" readonly />
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
% endif
|
||||
|
||||
Reference in New Issue
Block a user