From 66ddfa295dbff679b523adb158fab02b7fdc3ed9 Mon Sep 17 00:00:00 2001 From: Arthur Barrett Date: Fri, 22 Feb 2013 16:33:28 -0500 Subject: [PATCH] more refactoring and work on annotationinput (should be working now). --- common/lib/capa/capa/inputtypes.py | 5 ++++ .../capa/capa/templates/annotationinput.html | 13 +++++++---- .../lib/xmodule/xmodule/annotatable_module.py | 20 ++++------------ .../xmodule/css/annotatable/display.scss | 11 --------- .../lib/xmodule/xmodule/css/capa/display.scss | 8 +++++++ .../xmodule/js/src/annotatable/display.coffee | 12 ---------- lms/templates/annotatable.html | 9 ++++---- lms/templates/annotatable_problem.html | 23 ------------------- 8 files changed, 29 insertions(+), 72 deletions(-) delete mode 100644 lms/templates/annotatable_problem.html diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py index e1a6b35359..14d98be1e6 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -949,7 +949,9 @@ class AnnotationInput(InputTypeBase): Example: + Annotation Exercise Dr Seuss uses colors! How? + Why does Dr Seuss use colors!? Write down some notes: Now pick the right color @@ -970,6 +972,8 @@ class AnnotationInput(InputTypeBase): def setup(self): xml = self.xml + self.debug = False # set to True to display extra debug info with input + self.title = xml.findtext('./title', 'Annotation Exercise') self.text = xml.findtext('./text') self.comment = xml.findtext('./comment') @@ -1020,6 +1024,7 @@ class AnnotationInput(InputTypeBase): 'comment_prompt': self.comment_prompt, 'tag_prompt': self.tag_prompt, 'options': self.options, + 'debug': self.debug } unpacked_value = self._unpack_value() extra_context.update(unpacked_value) diff --git a/common/lib/capa/capa/templates/annotationinput.html b/common/lib/capa/capa/templates/annotationinput.html index 808df1ece1..38f8f5f726 100644 --- a/common/lib/capa/capa/templates/annotationinput.html +++ b/common/lib/capa/capa/templates/annotationinput.html @@ -21,11 +21,16 @@ % endfor + % if debug:
- Rendered Value:
${value}

- Input Value:
-
Hide this value input box when it's all working!!! + Rendered with value:
+
${value}
+ Current input value:
+
+ % else: + + % endif @@ -39,8 +44,6 @@ % endif - - Return to Annotation
diff --git a/common/lib/xmodule/xmodule/annotatable_module.py b/common/lib/xmodule/xmodule/annotatable_module.py index 15d1b5d5a0..295790e46a 100644 --- a/common/lib/xmodule/xmodule/annotatable_module.py +++ b/common/lib/xmodule/xmodule/annotatable_module.py @@ -1,7 +1,4 @@ -import pprint -import json import logging -import re from lxml import etree from pkg_resources import resource_string, resource_listdir @@ -12,9 +9,6 @@ from xmodule.modulestore.mongo import MongoModuleStore from xmodule.modulestore.django import modulestore from xmodule.contentstore.content import StaticContent -import datetime -import time - log = logging.getLogger(__name__) class AnnotatableModule(XModule): @@ -99,7 +93,6 @@ class AnnotatableModule(XModule): 'display_name': self.display_name, 'element_id': self.element_id, 'discussion_id': self.discussion_id, - 'help_text': self.help_text, 'content_html': self._render_content() } @@ -111,18 +104,13 @@ class AnnotatableModule(XModule): instance_state, shared_state, **kwargs) xmltree = etree.fromstring(self.definition['data']) - root_attr = {} - for key in ('discussion', 'help_text'): - if key in xmltree.attrib: - root_attr[key] = xmltree.get(key) - del xmltree.attrib[key] - + self.discussion_id = xmltree.get('discussion', '') + del xmltree.attrib['discussion'] self.content = etree.tostring(xmltree, encoding='unicode') self.element_id = self.location.html_id() - self.discussion_id = root_attr['discussion'] - self.help_text = root_attr['help_text'] class AnnotatableDescriptor(RawDescriptor): module_class = AnnotatableModule stores_state = True - template_dir_name = "annotatable" \ No newline at end of file + template_dir_name = "annotatable" + diff --git a/common/lib/xmodule/xmodule/css/annotatable/display.scss b/common/lib/xmodule/xmodule/css/annotatable/display.scss index 0e18de5ff9..8ce71cd6a7 100644 --- a/common/lib/xmodule/xmodule/css/annotatable/display.scss +++ b/common/lib/xmodule/xmodule/css/annotatable/display.scss @@ -13,18 +13,7 @@ border-radius: 3px; .annotatable-toggle { position: absolute; - right: 30px; - } - .annotatable-help-icon { - display: block; - position: absolute; - top: 0; right: 0; - width: 17px; - height: 17px; - background: url(../images/info-icon.png) no-repeat; - } - .annotatable-toggle, .annotatable-help-icon { margin: 2px 7px 2px 0; } } diff --git a/common/lib/xmodule/xmodule/css/capa/display.scss b/common/lib/xmodule/xmodule/css/capa/display.scss index f7a1885a05..277ac307ef 100644 --- a/common/lib/xmodule/xmodule/css/capa/display.scss +++ b/common/lib/xmodule/xmodule/css/capa/display.scss @@ -857,7 +857,15 @@ section.problem { margin: 1em 0; background-color: #999; border: 1px solid #000; + input[type="text"] { width: 100%; } pre { background-color: #CCC; color: #000; } + &:before { + display: block; + content: "debug input value"; + text-transform: uppercase; + font-weight: bold; + font-size: 1.5em; + } } } } diff --git a/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee b/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee index fb1f774a55..22e84c6c07 100644 --- a/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/annotatable/display.coffee @@ -5,7 +5,6 @@ class @Annotatable toggleSelector: '.annotatable-toggle' spanSelector: '.annotatable-span' replySelector: '.annotatable-reply' - helpSelector: '.annotatable-help-icon' problemXModuleSelector: '.xmodule_CapaModule' problemSelector: 'section.problem' @@ -48,20 +47,9 @@ class @Annotatable initTips: () -> @savedTips = [] - - # Adds a tooltip to each annotation span to display the instructor prompt @$(@spanSelector).each (index, el) => $(el).qtip(@getTipOptions el) - @$(@helpSelector).qtip - position: - my: 'right top' - at: 'bottom left' - container: @$(@wrapperSelector) - content: - title: 'Instructions' - text: true # use title attribute of this element - getTipOptions: (el) -> content: title: diff --git a/lms/templates/annotatable.html b/lms/templates/annotatable.html index 60b64c6955..a5cf5efb82 100644 --- a/lms/templates/annotatable.html +++ b/lms/templates/annotatable.html @@ -1,13 +1,12 @@
% if display_name is not UNDEFINED and display_name is not None: -
${display_name}
+
${display_name}
% endif
- Guided Discussion - Hide Annotations -
+ Guided Discussion + Hide Annotations
${content_html}
-
\ No newline at end of file + diff --git a/lms/templates/annotatable_problem.html b/lms/templates/annotatable_problem.html deleted file mode 100644 index 2d6ef21db2..0000000000 --- a/lms/templates/annotatable_problem.html +++ /dev/null @@ -1,23 +0,0 @@ -<%def name="render_problem(problem,index,total)"> -
-
- Classification Exercise: (${index + 1} / ${total}) -
-
-
${problem['prompt']}
-
    - % for tag in problem['tags']: -
  • ${tag['name']}
  • - % endfor -
- Explain the rationale for your tag selections:
- -
- - -
-
- -
- \ No newline at end of file