Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builtin poll_question block rendering is broken #32827

Closed
kdmccormick opened this issue Jul 24, 2023 · 2 comments
Closed

Builtin poll_question block rendering is broken #32827

kdmccormick opened this issue Jul 24, 2023 · 2 comments
Labels
wontfix This will not be worked on

Comments

@kdmccormick
Copy link
Member

The Problem

poll_question rendering seems broken (see screenshots below).

The Studio view shows an error which may be helpful:

We're having trouble rendering your component

Students will not be able to access this component. Re-edit your component to fix the error.

Error: 'PollBlockWithMixins' object has no attribute 'mako_template' 

Note: This is not xblock-poll, a.k.a. the poll component. This is the poll_question component, a former XModule which is defined in edx-platform.

Steps to reproduce

I found this in both master (using tutor dev & local) and Palm (using current-release.openedx.org).

  • Go to a course in Studio

  • In advanced settings, add "poll_question" to the advanced module list. Save.

  • In the unit editor, add an Advanced->poll_question component.

  • Author view:

    image

  • Edit view:

    image

  • Click "Publish" and then "View Live Version"

  • Student view

    image

@ormsbee ormsbee self-assigned this Jul 24, 2023
@Agrendalath
Copy link
Member

Agrendalath commented Aug 1, 2023

@kdmccormick, according to #26873, this XBlock never had a Studio editor. It was modified by changing the XML and re-importing the course.

I verified that this behavior in Nutmeg, as I didn't have an older instance around.

Theoretically, an editor can be easily added by:

  1. Changing
    "PollBlockEditor": "./xmodule/js/src/xmodule.js",
    to
"PollBlockEditor": [
  "./xmodule/js/src/xmodule.js",
  "./xmodule/js/src/raw/edit/metadata-only.js",
],
  1. Adding the following code to PollBlock:
studio_js_module_name = "MetadataOnlyEditingDescriptor"
    mako_template = "widgets/metadata-edit.html"
    
    def studio_view(self, _context):
        """
        Return the studio view.
        """
        fragment = Fragment(self.runtime.service(self, 'mako').render_template(self.mako_template, self.get_context()))
        add_webpack_js_to_fragment(fragment, 'PollBlockEditor')
        shim_xmodule_js(fragment, self.studio_js_module_name)
        return fragment
  1. Rebuilding the statics.

However, getting it to work properly would likely require creating a custom editor. That's because the answers have a bit unusual format:

# List of answers, in the form {'id': 'some id', 'text': 'the answer text'}
answers = List(
help=_("Poll answers from xml"),
scope=Scope.content,
default=[]
)

cc: @ormsbee

@kdmccormick kdmccormick changed the title Builtin poll_question block rendering is broken Add editor for poll_question or mark it as unsupported Dec 11, 2023
@kdmccormick kdmccormick changed the title Add editor for poll_question or mark it as unsupported Builtin poll_question block rendering is broken Dec 11, 2023
@kdmccormick
Copy link
Member Author

Makes sense @Agrendalath , thank you.

Given that this block is opt-in and a better Poll block exists, I don't think we need to make a Studio editor for it. It would be nice if Studio's error were more helpful (a la "There is no Studio editor for this component type. It may only be edited by exporting to XML.") but that's a different issue.

@kdmccormick kdmccormick closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2023
@github-project-automation github-project-automation bot moved this to Done in Arch-BOM Dec 11, 2023
@kdmccormick kdmccormick added the wontfix This will not be worked on label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants