Skip to content

Commit

Permalink
Add Mobile Support
Browse files Browse the repository at this point in the history
Added decorator to student_view for mobile compatibility.
Removed inline `cols` property from view.html.
Styled textarea from within the view.less file.
  • Loading branch information
libremente committed Jan 26, 2017
1 parent 6349ab4 commit 29713a3
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions freetextresponse/freetextresponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ def workbench_scenarios():
'submitted_message',
)

# Decorate the view in order to support multiple devices e.g. mobile
# See: https://openedx.atlassian.net/wiki/display/MA/Course+Blocks+API
# section 'View @supports(multi_device) decorator'
@XBlock.supports('multi_device')
def student_view(self, context=None):
# pylint: disable=unused-argument
"""
Expand Down
2 changes: 1 addition & 1 deletion freetextresponse/private/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h2 class="problem-header">{self.display_name}</h2>
<div class="word-count-message">{word_count_message}</div>
<div class="capa_inputtype textline">
<div class="user_input {indicator_class}">
<textarea class="student_answer" rows="20" cols="70">{self.student_answer}</textarea>
<textarea class="student_answer" rows="20">{self.student_answer}</textarea>
<span class="status {visibility_class}" aria-describedby="student_answer"></span>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions freetextresponse/private/view.less
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
border-radius:3px;
border:2px solid #e4e4e4;
min-width:160px;
width:85%;
}

&.unanswered .student_answer {
Expand Down
2 changes: 1 addition & 1 deletion freetextresponse/public/view.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class="freetextresponse xmodule_display xmodule_CapaModule problem"><h2 class="problem-header">{self.display_name}</h2><div class="problem-progress">{problem_progress}</div><p>{self.prompt}</p><div class="word-count-message">{word_count_message}</div><div class="capa_inputtype textline"><div class="user_input {indicator_class}"><textarea class="student_answer" rows="20" cols="70">{self.student_answer}</textarea><span class="status {visibility_class}" aria-describedby="student_answer"></span></div></div><div class="capa_alert submission-received">{submitted_message}</div><div class="action"><button class="check Submit {nodisplay_class}" data-checking="Checking..." data-value="Submit">Submit</button> <button class="save {nodisplay_class}" data-value="Save">Save</button><div class="used-attempts-feedback" aria-live="polite">{used_attempts_feedback}</div></div><div class="capa_alert user_alert">{user_alert}</div></div>
<div class="freetextresponse xmodule_display xmodule_CapaModule problem"><h2 class="problem-header">{self.display_name}</h2><div class="problem-progress">{problem_progress}</div><p>{self.prompt}</p><div class="word-count-message">{word_count_message}</div><div class="capa_inputtype textline"><div class="user_input {indicator_class}"><textarea class="student_answer" rows="20">{self.student_answer}</textarea><span class="status {visibility_class}" aria-describedby="student_answer"></span></div></div><div class="capa_alert submission-received">{submitted_message}</div><div class="action"><button class="check Submit {nodisplay_class}" data-checking="Checking..." data-value="Submit">Submit</button> <button class="save {nodisplay_class}" data-value="Save">Save</button><div class="used-attempts-feedback" aria-live="polite">{used_attempts_feedback}</div></div><div class="capa_alert user_alert">{user_alert}</div></div>
2 changes: 1 addition & 1 deletion freetextresponse/public/view.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.freetextresponse {


.user_input {

.status {
Expand Down Expand Up @@ -32,6 +31,7 @@
border-radius:3px;
border:2px solid #e4e4e4;
min-width:160px;
width:85%;
}

&.unanswered .student_answer {
Expand Down
2 changes: 1 addition & 1 deletion freetextresponse/public/view.less.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion freetextresponse/public/view.less.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 29713a3

Please sign in to comment.