On many of the standard question types in openedx, I am able to see a “settings” button and an “editor” button:
I’m hoping to organize my custom xblock so that it has this separation between settings and content. However, I don’t really understand how to do that. Currently, all of my xblock settings appear in the editor along with the content. My xblock does inherit from XBlockWithSettingsMixin and StudioEditableXBlockMixin, and generally I am able to have settings in my xblock that persist appropriately. Right now, I’m just trying to get a simple setting, which I have set up as:
#Adding in a random string setting that does nothing at the moment
random_string_setting = String(
help="Model used for grading",
default="qwen",
scope=Scope.settings # Change this from Scope.content to Scope.settings
)
editable_fields = ['random_string_setting']
My studio view also has that setting in it:
def studio_view(self, context):
print("********++++++++++**********++++++++++*******")
course = get_course_by_id(self.course_id) # pylint: disable=no-member
api_key = course.other_course_settings.get("openaiApiKey")
if api_key is not None:
model_names = ['qwen','nemo','gpt-4o','gpt-4o-mini']
else:
model_names = ['qwen','nemo']
print(course.other_course_settings.get("openaiApiKey"))
html = self.render_template("static/html/grading_xblock_studio.html",{'self':self,"question":self.question_description,'model_names':model_names,'random_string_setting':self.random_string_setting})
frag = Fragment()
frag.add_content(html)
#frag = Fragment(html.format(self=self,question=self.question_description,random_thing=34))
frag.add_css(self.resource_string("static/css/grading_xblock.css"))
frag.add_javascript(self.resource_string("static/js/src/grading_xblock.js"))
frag.initialize_js('GradingXBlockStudio')
return frag
However, I’m now stuck trying to figure out how to get it to show up anywhere other than my main fragment. I’m wondering if this isn’t so much an xblock thing as a setup for my template?