Skip to content

Commit db53b64

Browse files
committed
Upgrades Course Wizard to use newest React
Moves using the 'key' for identification to using 'stepKey' since React likes to do things with the key for other things. closes: CNVS-18163 Test Plan: - Do a full regression on the course wizard. - Nothing should change. Change-Id: I83da2cc7c43697773267868a6a905997c0d0f654 Reviewed-on: https://gerrit.instructure.com/47739 Tested-by: Jenkins Reviewed-by: Dan Minkevitch <dan@instructure.com> QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com> Product-Review: Clay Diffrient <cdiffrient@instructure.com>
1 parent 5e16de4 commit db53b64

6 files changed

Lines changed: 22 additions & 18 deletions

File tree

app/coffeescripts/bundles/course_wizard.coffee

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require [
22
'jquery'
3-
'old_unsupported_dont_use_react'
3+
'react'
44
'compiled/userSettings'
55
'jsx/course_wizard/CourseWizard'
66
], ($, React, userSettings, CourseWizard) ->
@@ -14,8 +14,11 @@ require [
1414

1515
pathname = window.location.pathname
1616

17+
# Need to render a factory with the newest versions of react
18+
courseWizardFactory = React.createFactory(CourseWizard)
19+
1720
$(".wizard_popup_link").click((event) ->
18-
React.renderComponent(CourseWizard({
21+
React.render(courseWizardFactory({
1922
overlayClassName:'CourseWizard__modalOverlay',
2023
showWizard: true
2124
}), $wizard_box[0])

app/jsx/course_wizard/Checklist.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @jsx React.DOM */
22

33
define([
4-
'old_unsupported_dont_use_react',
4+
'react',
55
'./ChecklistItem',
66
'./ListItems'
77
], function(React, ChecklistItem, ListItems) {
@@ -29,6 +29,7 @@ define([
2929
<ChecklistItem complete={item.complete}
3030
id={id}
3131
key={item.key}
32+
stepKey={item.key}
3233
title={item.title}
3334
onClick={this.props.clickHandler}
3435
isSelected={isSelected}

app/jsx/course_wizard/ChecklistItem.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @jsx React.DOM */
22

33
define([
4-
'old_unsupported_dont_use_react',
4+
'react',
55
'i18n!course_wizard'
66
], function(React, I18n) {
77

@@ -24,7 +24,7 @@ define([
2424

2525
handleClick: function (event) {
2626
event.preventDefault();
27-
this.props.onClick(this.props.key)
27+
this.props.onClick(this.props.stepKey)
2828
},
2929

3030
setClassName: function (props) {
@@ -54,4 +54,4 @@ define([
5454

5555
return ChecklistItem;
5656

57-
});
57+
});

app/jsx/course_wizard/CourseWizard.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
define([
44
'jquery',
5-
'old_unsupported_dont_use_react',
5+
'react',
66
'i18n!course_wizard',
7-
'old_unsupported_dont_use_react-modal',
7+
'react-modal',
88
'./InfoFrame',
99
'./Checklist',
1010
'compiled/userSettings',

app/jsx/course_wizard/InfoFrame.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
define([
44
'jquery',
55
'underscore',
6-
'old_unsupported_dont_use_react',
6+
'react',
77
'i18n!course_wizard',
88
'./ListItems'
99
], function($, _, React, I18n, ListItems) {

app/jsx/course_wizard/ListItems.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,70 +6,70 @@ define([
66
*/
77
return [
88
{
9-
key :'content_import',
9+
key:'content_import',
1010
complete: ENV.COURSE_WIZARD.checklist_states.import_step,
1111
title: I18n.t("Import Content"),
1212
text: I18n.t("If you've been using another course management system, you probably have stuff in there that you're going to want moved over to Canvas. We can walk you through the process of easily migrating your content into Canvas."),
1313
url: ENV.COURSE_WIZARD.urls.content_import,
1414
iconClass: 'icon-upload'
1515
},
1616
{
17-
key :'add_assignments',
17+
key:'add_assignments',
1818
complete: ENV.COURSE_WIZARD.checklist_states.assignment_step,
1919
title: I18n.t("Add Course Assignments"),
2020
text: I18n.t("Add your assignments. You can just make a long list, or break them up into groups - and even specify weights for each assignment group."),
2121
url: ENV.COURSE_WIZARD.urls.add_assignments,
2222
iconClass: 'icon-assignment'
2323
},
2424
{
25-
key :'add_students',
25+
key:'add_students',
2626
complete: ENV.COURSE_WIZARD.checklist_states.add_student_step,
2727
title: I18n.t("Add Students to the Course"),
2828
text: I18n.t("You'll definitely want some of these. What's the fun of teaching a course if nobody's even listening?"),
2929
url: ENV.COURSE_WIZARD.urls.add_students,
3030
iconClass: 'icon-group-new'
3131
},
3232
{
33-
key :'add_files',
33+
key:'add_files',
3434
complete: ENV.COURSE_WIZARD.checklist_states.import_step, /* Super odd in the existing wizard this is set to display: none */
3535
title: I18n.t("Add Files to the Course"),
3636
text: I18n.t("The Files tab is the place to share lecture slides, example documents, study helps -- anything your students will want to download. Uploading and organizing your files is easy with Canvas. We'll show you how."),
3737
url: ENV.COURSE_WIZARD.urls.add_files,
3838
iconClass: 'icon-note-light'
3939
},
4040
{
41-
key :'select_navigation',
41+
key:'select_navigation',
4242
complete: ENV.COURSE_WIZARD.checklist_states.navigation_step,
4343
title: I18n.t("Select Navigation Links"),
4444
text: I18n.t("By default all links are enabled for a course. Students won't see links to sections that don't have content. For example, if you haven't created any quizzes, they won't see the quizzes link. You can sort and explicitly disable these links if there are areas of the course you don't want your students accessing."),
4545
url: ENV.COURSE_WIZARD.urls.select_navigation,
4646
iconClass: 'icon-hamburger'
4747
},
4848
{
49-
key :'home_page',
49+
key:'home_page',
5050
complete: ENV.COURSE_WIZARD.checklist_states.home_page_step,
5151
title: I18n.t("Choose a Course Home Page"),
5252
text: I18n.t("When people visit the course, this is the page they'll see. You can set it to show an activity stream, the list of course modules, a syllabus, or a custom page you write yourself. The default is the course activity stream."),
5353
iconClass: 'icon-home'
5454
},
5555
{
56-
key :'course_calendar',
56+
key:'course_calendar',
5757
complete: ENV.COURSE_WIZARD.checklist_states.calendar_event_step,
5858
title: I18n.t("Add Course Calendar Events"),
5959
text: I18n.t("Here's a great chance to get to know the calendar and add any non-assignment events you might have to the course. Don't worry, we'll help you through it."),
6060
url: ENV.COURSE_WIZARD.urls.course_calendar,
6161
iconClass: 'icon-calendar-month'
6262
},
6363
{
64-
key :'add_tas',
64+
key:'add_tas',
6565
complete: ENV.COURSE_WIZARD.checklist_states.add_ta_step,
6666
title: I18n.t("Add TAs to the Course"),
6767
text: I18n.t("You may want to assign some TAs to help you with the course. TAs can grade student submissions, help moderate the discussions and even update due dates and assignment details for you."),
6868
url: ENV.COURSE_WIZARD.urls.add_tas,
6969
iconClass: 'icon-educators'
7070
},
7171
{
72-
key :'publish_course',
72+
key:'publish_course',
7373
complete: ENV.COURSE_WIZARD.checklist_states.publish_step,
7474
title: I18n.t("Publish the Course"),
7575
text: I18n.t("All finished? Time to publish your course! Click the button below to make it official! Publishing will allow the users to begin participating in the course."),

0 commit comments

Comments
 (0)