Skip to content

Commit

Permalink
Fix display of correct button for image upload
Browse files Browse the repository at this point in the history
Implement logic to show either the "Add Image to Question" or
"Remove Image" button in Studio view.
  • Loading branch information
jleong-openedx committed Jul 26, 2017
1 parent 1f258ee commit 0eeb2d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 6 additions & 2 deletions ubcpi/static/html/ubcpi_edit.html
Expand Up @@ -35,8 +35,12 @@
<div class="pi-label-and-hint">
<label class="label setting-label pi-setting-label" for="pi-question-text" aria-describedby="pi-question-text-tip" translate>Question Text <font color="red">*</font></label>
<span class="tip setting-help" id="pi-question-text-tip" translate>The question appears above the possible answers that you set below. You can use text, an image, or a combination of both. If you wish to add an image to your question, press the "Add Image To Question" button.</span>
<button id="add-image-question-button" type="button" class="button action-primary add-image-button" ng-click="esc.image_show_fields(false)" onclick="this.style.display='block';this.style.display='none'; document.getElementById('remove-image-question-button').style.display='block'" name="add-image-button">{{'Add Image To Question' | translate}}</button>
<button id="remove-image-question-button" type="button" style="display: none;" type="button" class="button action-primary add-image-button" ng-click="esc.image_show_fields(false)" onclick="this.style.display='block';this.style.display='none'; document.getElementById('add-image-question-button').style.display='block'" name="add-image-button">{{'Remove Image' | translate}}</button>
<div ng-if="!esc.data.question_text.image_show_fields">
<button id="add-image-question-button" type="button" class="button action-primary add-image-button" ng-click="esc.image_show_fields(false)" onclick="this.style.display='block';this.style.display='none'; document.getElementById('remove-image-question-button').style.display='block'" name="add-image-button">{{'Add Image To Question' | translate}}</button>
</div>
<div ng-if="esc.data.question_text.image_show_fields">
<button id="remove-image-question-button" type="button" type="button" class="button action-primary add-image-button" ng-click="esc.image_show_fields(false)" onclick="this.style.display='block';document.getElementById('add-image-question-button').style.display='block'" name="add-image-button">{{'Remove Image' | translate}}</button>
</div>
</div>
<textarea class="input setting-input" name="question_text" id="pi-question-text" ng-model="esc.data.question_text.text" ng-model-options="{ debounce: 500 }"></textarea>

Expand Down
4 changes: 0 additions & 4 deletions ubcpi/ubcpi.py
Expand Up @@ -512,11 +512,7 @@ def record_response(self, answer, rationale, status):
truncated_rationle, was_truncated = truncate_rationale(rationale)
event_dict = {
'answer': answer,
'answer_text': self.options[answer].get('text'),
'rationale': truncated_rationle,
'correct_answer': self.correct_answer,
'correct_answer_text': self.options[self.correct_answer].get('text'),
'correct_rationale': self.correct_rationale,
'truncated': was_truncated
}
if not answers.has_revision(0) and status == STATUS_NEW:
Expand Down

0 comments on commit 0eeb2d5

Please sign in to comment.