Skip to content

Commit 36ce6a2

Browse files
committed
feat: new editor design
1 parent 17830a1 commit 36ce6a2

4 files changed

Lines changed: 1461 additions & 173 deletions

File tree

lti_consumer/lti_xblock.py

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
268268
default=_("LTI Consumer"),
269269
)
270270
description = String(
271-
display_name=_("LTI Application Information"),
271+
display_name=_("Data Sharing Notice"),
272272
help=_(
273273
"Enter a description of the third party application. "
274274
"If requesting username and/or email, use this text box to inform users "
@@ -384,7 +384,7 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
384384
)
385385

386386
lti_1p3_enable_nrps = Boolean(
387-
display_name=_("Enable LTI NRPS"),
387+
display_name=_("Names & Roles (NRPS)"),
388388
help=_("Enable LTI Names and Role Provisioning Services."),
389389
default=False,
390390
scope=Scope.settings
@@ -407,11 +407,11 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
407407
),
408408
)
409409
lti_advantage_ags_mode = String(
410-
display_name=_("LTI Assignment and Grades Service"),
410+
display_name=_("Assignment and Grades"),
411411
values=[
412+
{"display_name": _("Declarative"), "value": "declarative"},
413+
{"display_name": _("Programmatic"), "value": "programmatic"},
412414
{"display_name": _("Disabled"), "value": "disabled"},
413-
{"display_name": _("Allow tools to submit grades only (declarative)"), "value": "declarative"},
414-
{"display_name": _("Allow tools to manage and submit grade (programmatic)"), "value": "programmatic"},
415415
],
416416
default='declarative',
417417
scope=Scope.settings,
@@ -465,7 +465,7 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
465465
scope=Scope.settings
466466
)
467467
launch_target = String(
468-
display_name=_("LTI Launch Target"),
468+
display_name=_("Open tool in"),
469469
help=_(
470470
"Select Inline if you want the LTI content to open in an IFrame in the current page. "
471471
"Select Modal if you want the LTI content to open in a modal window in the current page. "
@@ -481,7 +481,7 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
481481
],
482482
)
483483
button_text = String(
484-
display_name=_("Button Text"),
484+
display_name=_("Launch Button Text"),
485485
help=_(
486486
"Enter the text on the button used to launch the third party application. "
487487
"This setting is only used when Hide External Tool is set to False and "
@@ -491,7 +491,7 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
491491
scope=Scope.settings
492492
)
493493
inline_height = Integer(
494-
display_name=_("Inline Height"),
494+
display_name=_("Inline Height (px)"),
495495
help=_(
496496
"Enter the desired pixel height of the iframe which will contain the LTI tool. "
497497
"This setting is only used when Hide External Tool is set to False and "
@@ -501,7 +501,7 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
501501
scope=Scope.settings
502502
)
503503
modal_height = Integer(
504-
display_name=_("Modal Height"),
504+
display_name=_("Modal Height (px)"),
505505
help=_(
506506
"Enter the desired viewport percentage height of the modal overlay which will contain the LTI tool. "
507507
"This setting is only used when Hide External Tool is set to False and "
@@ -511,7 +511,7 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
511511
scope=Scope.settings
512512
)
513513
modal_width = Integer(
514-
display_name=_("Modal Width"),
514+
display_name=_("Modal Width (px)"),
515515
help=_(
516516
"Enter the desired viewport percentage width of the modal overlay which will contain the LTI tool. "
517517
"This setting is only used when Hide External Tool is set to False and "
@@ -521,13 +521,13 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
521521
scope=Scope.settings
522522
)
523523
has_score = Boolean(
524-
display_name=_("Scored"),
524+
display_name=_("This activity is graded"),
525525
help=_("Select True if this component will receive a numerical score from the external LTI system."),
526526
default=False,
527527
scope=Scope.settings
528528
)
529529
weight = Float(
530-
display_name="Weight",
530+
display_name=_("Grade Weight"),
531531
help=_(
532532
"Enter the number of points possible for this component. "
533533
"The default value is 1.0. "
@@ -558,7 +558,7 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
558558
scope=Scope.settings
559559
)
560560
accept_grades_past_due = Boolean(
561-
display_name=_("Accept grades past deadline"),
561+
display_name=_("Accept grades after due date"),
562562
help=_("Select True to allow third party systems to post grades past the deadline."),
563563
default=True,
564564
scope=Scope.settings
@@ -567,21 +567,21 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
567567
# party application. When "Open in New Page" is not selected, the tool automatically appears without any
568568
# user action.
569569
ask_to_send_username = Boolean(
570-
display_name=_("Request user's username"),
570+
display_name=_("Share Username"),
571571
# Translators: This is used to request the user's username for a third party service.
572572
help=_("Select True to request the user's username."),
573573
default=False,
574574
scope=Scope.settings
575575
)
576576
ask_to_send_full_name = Boolean(
577-
display_name=_("Request user's full name"),
577+
display_name=_("Share Full name"),
578578
# Translators: This is used to request the user's full name for a third party service.
579579
help=_("Select True to request the user's full name."),
580580
default=False,
581581
scope=Scope.settings
582582
)
583583
ask_to_send_email = Boolean(
584-
display_name=_("Request user's email"),
584+
display_name=_("Share Email"),
585585
# Translators: This is used to request the user's email for a third party service.
586586
help=_("Select True to request the user's email address."),
587587
default=False,
@@ -759,6 +759,7 @@ def get_pii_sharing_enabled(self):
759759
# because the service is not defined in those contexts.
760760
return True
761761

762+
# FIXME: Check this docstring
762763
@property
763764
def editable_fields(self):
764765
"""
@@ -1182,14 +1183,43 @@ def studio_view(self, context):
11821183
Get Studio View fragment
11831184
"""
11841185
loader = ResourceLoader(__name__)
1185-
fragment = super().studio_view(context)
11861186

1187-
fragment.add_javascript(loader.load_unicode("static/js/xblock_studio_view.js"))
1187+
context = {
1188+
'fields': {},
1189+
'pii_sharing_enabled': self.get_pii_sharing_enabled(),
1190+
}
1191+
1192+
# Add editable fields to context
1193+
for field_name in self.editable_fields:
1194+
field = self.fields[field_name]
1195+
field_info = self._make_field_info(field_name, field)
1196+
if field_info is not None:
1197+
context["fields"][field_name] = field_info
1198+
1199+
fragment = Fragment()
1200+
fragment.add_content(loader.render_django_template(
1201+
'/templates/html/lti_studio_edit.html',
1202+
context=context,
1203+
i18n_service=self.runtime.service(self, 'i18n')
1204+
))
1205+
1206+
fragment.add_css(loader.load_unicode('static/css/xblock_studio_view.css'))
1207+
1208+
fragment.add_javascript(loader.load_unicode('static/js/xblock_studio_view.js'))
1209+
1210+
fragment.add_javascript(loader.load_unicode('static/js/xblock_studio_view.js'))
1211+
11881212
js_context = {
11891213
"EXTERNAL_MULTIPLE_LAUNCH_URLS_ENABLED": external_multiple_launch_urls_enabled(
11901214
self.scope_ids.usage_id.course_key
1191-
)
1215+
),
1216+
"editableFields": self.editable_fields,
11921217
}
1218+
1219+
statici18n_js_url = self._get_statici18n_js_url()
1220+
if statici18n_js_url:
1221+
fragment.add_javascript_url(statici18n_js_url)
1222+
11931223
fragment.initialize_js('LtiConsumerXBlockInitStudio', js_context)
11941224

11951225
return fragment

0 commit comments

Comments
 (0)