Skip to content

Commit e779080

Browse files
committed
provide CODE_ORG_URL globally to JS via window.dashboard.CODE_ORG_URL
1 parent 1f23eaf commit e779080

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

apps/src/code-studio/components/progress/StageLockDialog.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ const StageLockDialog = React.createClass({
111111
},
112112

113113
viewSection() {
114-
/// TODO - build a way to get code_org_url from dashboard
115-
window.open(`http://localhost.code.org:3000/teacher-dashboard#/sections/${this.props.selectedSection}/assessments`, '_blank');
114+
window.open(`${window.dashboard.CODE_ORG_URL}/teacher-dashboard#/sections/${this.props.selectedSection}/assessments`, '_blank');
116115
},
117116

118117
handleRadioChange(event) {

apps/src/code-studio/pd/workshop_dashboard/workshop.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global TEACHER_DASHBOARD_URL */
2-
31
/**
42
* Workshop view / edit. Displays and optionally edits details for a workshop.
53
* Routes:
@@ -228,7 +226,7 @@ const Workshop = React.createClass({
228226
},
229227

230228
getSectionUrl() {
231-
return `${window.dashboard.workshop.TEACHER_DASHBOARD_URL}#/sections/${this.state.workshop.section_id}/manage`;
229+
return `${window.dashboard.CODE_ORG_URL}/teacher-dashboard#/sections/${this.state.workshop.section_id}/manage`;
232230
},
233231

234232
renderSignupPanel() {

dashboard/app/assets/javascripts/application.js.erb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,10 @@
3030
//= require details-polyfill/jquery.details
3131
//= require details-polyfill/details-polyfill
3232

33-
//= require selectize
33+
//= require selectize
34+
35+
// window.dashboard is used to communicate between dashboard/apps in a variety
36+
// of places. In this case we want to make availale to our JS the url of the
37+
// pegasus portion of our site (i.e. http://code.org vs. http://studio.code.org)
38+
window.dashboard = window.dashboard || {};
39+
window.dashboard.CODE_ORG_URL = "<%= CDO.code_org_url %>";

dashboard/app/views/pd/workshop_dashboard/index.html.haml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
:javascript
88
window.dashboard.workshop = {
9-
TEACHER_DASHBOARD_URL: "#{CDO.code_org_url '/teacher-dashboard'}",
109
TYPES: #{Pd::Workshop::TYPES},
1110
COURSES: #{Pd::Workshop::COURSES},
1211
SUBJECTS: #{Pd::Workshop::SUBJECTS.to_json},

0 commit comments

Comments
 (0)