Commit a8178de4 by Arthur Barrett

Added styling to the annotationinput capa problem.

parent cc7f7910
...@@ -970,6 +970,7 @@ class AnnotationInput(InputTypeBase): ...@@ -970,6 +970,7 @@ class AnnotationInput(InputTypeBase):
def setup(self): def setup(self):
xml = self.xml xml = self.xml
self.title = xml.findtext('./title', 'Annotation Exercise')
self.text = xml.findtext('./text') self.text = xml.findtext('./text')
self.comment_prompt = xml.findtext('./comment_prompt') self.comment_prompt = xml.findtext('./comment_prompt')
self.tag_prompt = xml.findtext('./tag_prompt') self.tag_prompt = xml.findtext('./tag_prompt')
...@@ -981,15 +982,15 @@ class AnnotationInput(InputTypeBase): ...@@ -981,15 +982,15 @@ class AnnotationInput(InputTypeBase):
for option in self.xml.findall('./options/option'): for option in self.xml.findall('./options/option'):
options.append({ options.append({
'id': index, 'id': index,
'tag': option.text, 'description': option.text,
'description': option.get('description', ''),
'score': option.get('score', 0) 'score': option.get('score', 0)
}) })
index += 1 index += 1
return options return options
def _extra_context(self): def _extra_context(self):
return {'text': self.text, return {'title': self.title,
'text': self.text,
'comment_prompt': self.comment_prompt, 'comment_prompt': self.comment_prompt,
'tag_prompt': self.tag_prompt, 'tag_prompt': self.tag_prompt,
'options': self.options} 'options': self.options}
......
<form class="annotation-input"> <form class="annotation-input">
TODO: make the textline hidden once it all works
<div class="script_placeholder" data-src="/static/js/capa/annotationinput.js"/> <div class="script_placeholder" data-src="/static/js/capa/annotationinput.js"/>
<p>Text: ${text}</p> <div class="header">${title}</div>
<div class="body">
<p>Comment prompt: ${comment_prompt}</p> <div class="prompt prompt-text">${text}</div>
<div class="prompt">${comment_prompt}</div>
<textarea id="input_${id}_comment" name="input_${id}_comment"/> <textarea id="input_${id}_comment" name="input_${id}_comment"/>
<div class="prompt">${tag_prompt}</div>
<p>Tag prompt: ${tag_prompt}</p> <ul class="tags">
% for option in options:
<input type="text" style="" name="input_${id}" id="input_${id}"/> <li data-id="${option['id']}"><span>${option['description']}</span></li>
% endfor
Value: ${value} </ul>
% for option in options: <!--
<p>${option['id']}, ${option['tag']}, ${option['description']}, ${option['score']}</p>
% endfor Value: ${value} <input type="text" style="" name="input_${id}" id="input_${id}"/>
TODO: make the textline hidden once it all works
<span id="answer_${id}"></span> <span id="answer_${id}"></span>
% if status == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
% elif status == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}"></span> <span class="correct" id="status_${id}"></span>
% elif status == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% elif status == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"></span>
% endif % endif
-->
</div>
</form> </form>
% if msg: % if msg:
......
...@@ -66,56 +66,57 @@ ...@@ -66,56 +66,57 @@
.annotatable-discussion { .annotatable-discussion {
display: none; display: none;
} }
} .annotatable-problem {
.annotatable-problem {
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 1em; border-radius: 1em;
margin: 0 0 1em 0; margin: 0 0 1em 0;
} }
.annotatable-problem-header { .annotatable-problem-header {
font-weight: bold; font-weight: bold;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
.annotatable-problem-index { font-weight: normal; } .annotatable-problem-index { font-weight: normal; }
} }
.annotatable-problem-body { .annotatable-problem-body {
position: relative; position: relative;
textarea { textarea {
display: inline-block; display: inline-block;
width: 55%; width: 55%;
} }
.annotatable-problem-prompt { .annotatable-problem-prompt {
font-style: italic; font-style: italic;
} }
ul.annotatable-problem-tags { ul.annotatable-problem-tags {
display: block; display: block;
list-style-type: none; list-style-type: none;
margin: 1em 0; margin: 1em 0;
padding: 0; padding: 0;
li { li {
cursor: pointer; cursor: pointer;
display: inline; display: inline;
padding: .5em; padding: .5em;
margin: 0 .5em 0 0; margin: 0 .5em 0 0;
background-color: #ccc; background-color: #ccc;
border: 1px solid #000; border: 1px solid #000;
&.selected { &.selected {
background-color: rgba(255,255,10,0.3); background-color: rgba(255,255,10,0.3);
}
} }
}
} }
.annotatable-problem-controls { .annotatable-problem-controls {
display: inline-block; display: inline-block;
margin: 0 4px 0 8px; margin: 0 4px 0 8px;
} }
} }
.annotatable-problem-footer {} .annotatable-problem-footer {}
.annotatable-problem-header, .annotatable-problem-header,
.annotatable-problem-body, .annotatable-problem-body,
.annotatable-problem-footer { .annotatable-problem-footer {
padding: .5em 1em; padding: .5em 1em;
}
} }
.ui-tooltip.qtip.ui-tooltip { .ui-tooltip.qtip.ui-tooltip {
font-size: $body-font-size; font-size: $body-font-size;
border: 1px solid #333; border: 1px solid #333;
......
...@@ -802,4 +802,49 @@ section.problem { ...@@ -802,4 +802,49 @@ section.problem {
display: none; display: none;
} }
} }
.annotation-input {
$yellow: rgba(255,255,10,0.3);
border: 1px solid #ccc;
border-radius: 1em;
margin: 0 0 1em 0;
.header {
font-weight: bold;
border-bottom: 1px solid #ccc;
padding: .5em 1em;
}
.body { padding: .5em 1em; }
.prompt { font-style: italic; }
.prompt.prompt-text {
padding: .5em;
color: #333;
background-color: $yellow;
font-style: normal;
border: 1px solid darken($yellow, 10%);
}
.prompt, ul.tags {
margin: .5em 0;
padding: 0;
}
ul.tags {
display: block;
list-style-type: none;
margin-left: 1em;
li {
display: block;
margin: 1em 0 0 1.5em;
span {
cursor: pointer;
display: inline-block;
padding: .25em .5em;
border: 1px solid rgb(102,102,102);
&.selected {
background-color: $yellow;
}
}
}
}
textarea { width: 100%; }
}
} }
(function () { (function () {
console.log('annotation input loaded: ', this);
var update = function() { var update = function() {
alert("o hi"); alert("o hi");
}; };
......
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