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

DTP (Test > Production: b2fc53be) #23471

Merged
merged 109 commits into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
cb1d328
Reload page after successful submission
maddiedierker Jun 27, 2018
4d589b4
levelbuilder content changes (-robo-commit)
deploy-code-org Jun 27, 2018
288d940
Merge pull request #23384 from code-dot-org/dtl_candidate_0d44816a
deploy-code-org Jun 27, 2018
9cbcba0
No longer depend on `cohort` to authorize teachers
joshlory Jun 28, 2018
29f99e9
Log query and results to AWS Firehose, if Gatekeeper flag permits it.
sureshc Jun 28, 2018
96ebb2b
levelbuilder content changes (-robo-commit)
deploy-code-org Jun 28, 2018
36c441a
Add comments about future improvements to how various attributes are …
sureshc Jun 28, 2018
9acd260
levelbuilder content changes (-robo-commit)
deploy-code-org Jun 28, 2018
c3374bd
Merge pull request #23410 from code-dot-org/dtl_candidate_ab4e8800
deploy-code-org Jun 28, 2018
2573873
Don't show extra scroll height in instructions when an image is present
joshlory Jun 29, 2018
79fe022
Remove now-unused `hasInlineImages` prop
joshlory Jun 29, 2018
ce02940
Add connect_provider tests for facebook, windowslive, clever, and pow…
maddiedierker Jun 29, 2018
654ee64
Merge branch 'staging' into add-password-reload
maddiedierker Jun 29, 2018
dfe1ce0
Move set_email tests to integration test
islemaster Jun 29, 2018
8d5a734
First test uses migrated user to be consistent
islemaster Jun 29, 2018
550c8df
Move set_email tests to set_email_test.rb
islemaster Jun 29, 2018
15b60bc
Rename tests
islemaster Jun 29, 2018
f3c4012
Move migration tests to own files
islemaster Jun 29, 2018
42432a9
Deprecation notice in registrations_controller_test.rb
islemaster Jun 29, 2018
e27e5e2
Inline 'private' for helper methods [ui skip]
islemaster Jun 29, 2018
4efbe46
Download empty CSV with headers for assessments
caleybrock Jun 29, 2018
79c0e94
Use a base case selector to export empty data
caleybrock Jun 29, 2018
3b761b4
Single-auth test: Cannot set email to one already taken
islemaster Jun 29, 2018
26e5f9b
Failing multi-auth test: Cannot set email to one already taken
islemaster Jun 29, 2018
2db7cc6
Add a link for downloading surveys
caleybrock Jun 29, 2018
90843b7
Failing tests for update_primary_contact_info
islemaster Jun 29, 2018
7f450a7
Survey download shows stage, and question info
caleybrock Jun 29, 2018
c5f2c28
Make update_primary_contact_info tests pass
islemaster Jun 29, 2018
416b6d4
levelbuilder content changes (-robo-commit)
deploy-code-org Jun 29, 2018
1a7653b
staging content changes (-robo-commit)
deploy-code-org Jun 29, 2018
0d6ea91
All tests passing (useful validation errors)
islemaster Jun 29, 2018
b74cc5e
Merge pull request #23429 from code-dot-org/levelbuilder
deploy-code-org Jun 29, 2018
21065e4
Working export for surveys
caleybrock Jun 29, 2018
d995e31
Fix spelling error
islemaster Jun 29, 2018
35b8d56
Merge pull request #23433 from code-dot-org/staging
deploy-code-org Jun 29, 2018
3e3bdba
Merge pull request #23425 from code-dot-org/cleanup-registration-cont…
islemaster Jun 29, 2018
a047068
Remove "showUnusedBlocks" Gatekeeper flag
joshlory Jun 29, 2018
fe9f5d3
Download assessment responses
caleybrock Jun 29, 2018
b98c0bd
Refactor into two seperate functions
caleybrock Jun 29, 2018
39d552e
Remove unneeded translation
caleybrock Jun 29, 2018
2196e81
Update strings based on feedback
caleybrock Jun 29, 2018
5ac0821
Update unit tests
joshlory Jun 29, 2018
75c2d1a
Merge pull request #23430 from code-dot-org/safe-change-email
islemaster Jun 29, 2018
6d1362c
Surveys test for redux selector
caleybrock Jun 29, 2018
0b99dfc
levelbuilder content changes (-robo-commit)
deploy-code-org Jun 29, 2018
0f7d985
Merge pull request #23438 from code-dot-org/dtl_candidate_10b398b4
deploy-code-org Jun 29, 2018
2e40bfb
Merge pull request #23398 from code-dot-org/remove-cohort-from-user
joshlory Jun 29, 2018
7a0b5ac
Test assessments exporting
caleybrock Jun 29, 2018
ec9a985
Move assert_authentication_option helper into test_helper
maddiedierker Jun 29, 2018
b823ad3
Add comments for helper function selectors
caleybrock Jun 29, 2018
44a6ca1
Use assert_authentication_option helper, rename assert_auth_option he…
maddiedierker Jun 29, 2018
7fd2c7a
Remove unnecessarily setting omniauth.params for connect_provider tests
maddiedierker Jun 29, 2018
f499c18
Update string to be more clear
caleybrock Jun 29, 2018
71b5924
Stub utils.reload() in unit tests
islemaster Jun 30, 2018
ff32a57
Refactor generate_auth_user_hash helper to use everywhere
maddiedierker Jun 30, 2018
ae91b99
Update moment.js to 2.19.3
islemaster Jun 30, 2018
6cacb47
Merge branch 'connect-oauth-test' into move-connect-endpoint
maddiedierker Jun 30, 2018
daaa731
Upgrade react-idle-timer to v1.5.2
islemaster Jun 30, 2018
2834c27
remove spaces from file name because it is causing a test to fail
Jun 30, 2018
708d730
Upgrade react-datepicker to v1.5.0
islemaster Jun 30, 2018
c2eed67
Move /users/auth/:provider/connect to AuthenticationOptionsController
maddiedierker Jun 30, 2018
0fd3477
Upgrade omniauth gem to 1.3.2
islemaster Jun 30, 2018
84f971b
Remove unused `Ops` controllers
joshlory Jun 29, 2018
eb36b4d
Convert BaseDialog to ES6 class
islemaster Jun 30, 2018
db3eb4b
Convert Dialog to ES6 class
islemaster Jun 30, 2018
f8ec0d9
Convert ProtectedStatefulDiv to ES6 class
islemaster Jun 30, 2018
d5d0e22
Convert ProtectedVisualizationDiv to ES6 class
islemaster Jun 30, 2018
ca94a2f
Merge pull request #23439 from code-dot-org/fix-string-assessments
caleybrock Jun 30, 2018
48d4e94
Merge pull request #23436 from code-dot-org/export-assessments
caleybrock Jun 30, 2018
8e0adcd
Merge pull request #23443 from code-dot-org/upgrade-moment
islemaster Jun 30, 2018
dfec055
Remove primary_authentication_option aliases
islemaster Jun 29, 2018
f8a6c0b
Remove addStoriesGroup from storybook config
islemaster Jul 1, 2018
4b1d4ce
Remove package dependency
islemaster Jul 1, 2018
64c94ad
Merge pull request #23449 from code-dot-org/remove-add-stories-group
islemaster Jul 2, 2018
3894772
Remove connect-livereload
islemaster Jul 2, 2018
394993a
Remove unneeded grunt tasks
islemaster Jul 2, 2018
e4988bd
Remove codecov npm package [test all]
islemaster Jul 2, 2018
202827f
levelbuilder content with missing CSP template levels (-dave)
deploy-code-org Jul 2, 2018
1367fd2
Merge pull request #23454 from code-dot-org/staging
davidsbailey Jul 2, 2018
3a0eea6
Merge branch 'staging' into lb-staging-merge
davidsbailey Jul 2, 2018
788babe
Merge pull request #23455 from code-dot-org/lb-staging-merge
davidsbailey Jul 2, 2018
deb0837
Merge pull request #23445 from code-dot-org/remove-ops-module
joshlory Jul 2, 2018
71c311a
Merge pull request #23418 from code-dot-org/remove-extra-300-px-paddi…
joshlory Jul 2, 2018
a672b42
Merge pull request #23456 from code-dot-org/staging
deploy-code-org Jul 2, 2018
a9ed36e
levelbuilder content with CSD template fixes (-dave)
deploy-code-org Jul 2, 2018
56798e2
Merge pull request #23457 from code-dot-org/levelbuilder
davidsbailey Jul 2, 2018
473dafd
Merge pull request #23458 from code-dot-org/staging
deploy-code-org Jul 2, 2018
b38680e
Merge pull request #23401 from code-dot-org/log-school-searches
sureshc Jul 2, 2018
003640a
Merge pull request #23424 from code-dot-org/connect-oauth-test
Jul 2, 2018
1e44e0c
Merge branch 'staging' into move-connect-endpoint
maddiedierker Jul 2, 2018
58fc834
Merge pull request #23451 from code-dot-org/remove-connect-livereload
islemaster Jul 2, 2018
6a363f5
Merge pull request #23460 from code-dot-org/staging
deploy-code-org Jul 2, 2018
8aa728e
Merge pull request #23435 from code-dot-org/remove-unused-blocks-gate…
joshlory Jul 2, 2018
38f78b9
disallow spaces in staging content filenames
davidsbailey Jul 2, 2018
28ad626
Merge pull request #23373 from code-dot-org/add-password-reload
Jul 2, 2018
c4d0024
Merge pull request #23450 from code-dot-org/remove-codecov
islemaster Jul 2, 2018
a037046
Merge pull request #23419 from code-dot-org/primary-contact-info-fini…
islemaster Jul 2, 2018
87f3424
Merge pull request #23446 from code-dot-org/createclass
islemaster Jul 2, 2018
aa95d61
also detect when files are renamed
davidsbailey Jul 2, 2018
316207a
Merge pull request #23442 from code-dot-org/move-connect-endpoint
Jul 2, 2018
8c41a92
Merge pull request #23447 from code-dot-org/protected-divs
islemaster Jul 2, 2018
e9d2084
Merge pull request #23452 from code-dot-org/remove-unneeded-grunt-tasks
islemaster Jul 2, 2018
3945bca
levelbuilder content changes (-robo-commit)
deploy-code-org Jul 2, 2018
c073ca4
staging content changes (-robo-commit)
deploy-code-org Jul 2, 2018
3af28db
Merge branch 'staging' of github.com:code-dot-org/code-dot-org into s…
deploy-code-org Jul 2, 2018
412b089
Merge pull request #23467 from code-dot-org/levelbuilder
deploy-code-org Jul 2, 2018
6a6871e
Merge pull request #23464 from code-dot-org/disallow-content-spaces
davidsbailey Jul 2, 2018
a532bf9
Merge pull request #23444 from code-dot-org/upgrade-omniauth
islemaster Jul 2, 2018
b2fc53b
Merge pull request #23468 from code-dot-org/staging
deploy-code-org Jul 2, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ GEM
sysexits (~> 1.1)
hashdiff (0.3.7)
hashery (2.1.2)
hashie (3.4.4)
hashie (3.4.6)
highline (1.6.21)
honeybadger (3.3.0)
html2haml (2.2.0)
Expand Down Expand Up @@ -498,7 +498,7 @@ GEM
oily_png (1.2.0)
chunky_png (~> 1.3.1)
oj (3.3.10)
omniauth (1.3.1)
omniauth (1.3.2)
hashie (>= 1.2, < 4)
rack (>= 1.0, < 3)
omniauth-facebook (4.0.0)
Expand Down Expand Up @@ -551,7 +551,7 @@ GEM
multi_json (~> 1.0)
pusher-signature (~> 0.1.8)
pusher-signature (0.1.8)
rack (2.0.4)
rack (2.0.5)
rack-cache (1.6.1)
rack (>= 0.4)
rack-mini-profiler (0.10.1)
Expand Down
2 changes: 0 additions & 2 deletions apps/.storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { setOptions } from '@storybook/addon-options';
import Node from '@storybook/addon-info/dist/components/Node';
import Props from '@storybook/addon-info/dist/components/Props';
import {Pre} from '@storybook/addon-info/dist/components/markdown/code';
import addStoriesGroup from 'react-storybook-addon-add-stories-group';
import experiments from '@cdo/apps/util/experiments';
import withReduxStore from '../test/util/withReduxStore';

Expand Down Expand Up @@ -178,7 +177,6 @@ storybook.setAddon({
}
});

storybook.setAddon(addStoriesGroup);
storybook.addDecorator(story => {
var rendered = story();
return (
Expand Down
11 changes: 0 additions & 11 deletions apps/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,16 +714,6 @@ describe('entry tests', () => {
}
},

config.strip_code = {
options: {
start_comment: 'start-test-block',
end_comment: 'end-test-block'
},
all: {
src: ['build/js/*.js']
}
};

config.notify = {
'js-build': {options: {message: 'JS build completed.'}},
sass: {options: {message: 'SASS build completed.'}},
Expand Down Expand Up @@ -771,7 +761,6 @@ describe('entry tests', () => {
'newer:copy:src',
'newer:copy:lib',
'locales',
'newer:strip_code',
'ejs'
]);

Expand Down
6 changes: 5 additions & 1 deletion apps/i18n/common/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
"copyright": "Copyright",
"correct": "Correct",
"correctAnswer": "That is the correct answer.",
"count": "Count",
"country": "Country",
"course": "Course",
"courseBlocksCsfExpressHeading": "Computer Science Fundamentals Express Courses",
Expand Down Expand Up @@ -354,6 +355,7 @@
"done": "Done",
"dontForget": "Don't forget",
"downloadCSV": "Download CSV",
"downloadAssessmentCSV": "Download CSV of student responses",
"dragBlocksToMatch": "Drag the blocks to match",
"dropletBlock_addOperator_description": "Add two numbers",
"dropletBlock_addOperator_signatureOverride": "Add operator",
Expand Down Expand Up @@ -728,7 +730,7 @@
"moveStudents": "Move students",
"moveStudentsConfirm": "No, I want to move student(s) to be in the new section only.",
"moveToSection": "Move to section",
"multipleChoiceQuestionsOverview": "Multiple choice questions overview ({numSubmissions} submissions / {numStudents} students)",
"multipleChoiceQuestionsOverview": "Multiple choice questions overview ({numSubmissions} / {numStudents} students)",
"multipleChoiceStudentOverview": "Multiple choice questions overview ({studentName})",
"myCourses": "My Courses",
"myProjects": "My Projects",
Expand Down Expand Up @@ -930,6 +932,7 @@
"puzzleRatingQuestion": "Did you like this puzzle?",
"puzzleTitle": "Puzzle {puzzle_number} of {stage_total}",
"question": "Question",
"questionText": "Question text",
"quickActions": "Quick actions",
"rateButtonsLabel": "Rate:",
"readonlyWorkspaceHeader": "View only: ",
Expand Down Expand Up @@ -1143,6 +1146,7 @@
"thankyou": "Thank you",
"thankyouForAnswer": "Thank you for submitting an answer.",
"thumbnailWarning": "Note: You must finish running your app to create a thumbnail, before you can publish your app.",
"timestamp": "Time stamp",
"toggleBlocksErrorMsg": "You need to correct an error in your program before it can be shown as blocks.",
"tooFewBody": "Please select two answers before submitting.",
"tooFewTitle": "Too few answers.",
Expand Down
13 changes: 3 additions & 10 deletions apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@
"chalk": "^1.1.3",
"chrome-serialport": "bcjordan/chrome-serialport#2",
"classnames": "^2.2.5",
"codecov": "^1.0.1",
"codemirror": "5.5",
"codemirror-spell-checker": "^1.1.2",
"connect-livereload": "0.5.3",
"copy-webpack-plugin": "^3.0.0",
"css-loader": "^0.23.1",
"csv-parse": "^1.1.7",
Expand Down Expand Up @@ -117,10 +115,7 @@
"grunt-karma": "^2.0.0",
"grunt-newer": "1.1.1",
"grunt-notify": "0.4.5",
"grunt-open": "^0.2.3",
"grunt-parallel": "^0.5.1",
"grunt-sass": "1.1.0",
"grunt-strip-code": "0.1.2",
"grunt-webpack": "^2.0.1",
"hammerjs": "^2.0.8",
"history": "^2.0.1",
Expand Down Expand Up @@ -150,7 +145,7 @@
"messageformat": "0.2.2",
"mocha": "^3.1.2",
"mock-firmata": "0.2.0",
"moment": "2.14.1",
"moment": "^2.19.3",
"newrelic": "^1.27.2",
"node-js-marker-clusterer": "^1.0.0",
"node-sass": "^4.0.0",
Expand All @@ -166,10 +161,10 @@
"react-addons-test-utils": "~15.4.0",
"react-bootstrap": "0.30.1",
"react-color": "^2.11.7",
"react-datepicker": "0.37.0",
"react-datepicker": "1.5.0",
"react-dom": "~15.4.0",
"react-google-charts": "^1.5.5",
"react-idle-timer": "1.3.3",
"react-idle-timer": "1.5.2",
"react-lazy-load": "3.0.10",
"react-motion": "0.4.5",
"react-onclickoutside": "^5.7.1",
Expand All @@ -179,7 +174,6 @@
"react-router": "2.6.0",
"react-select": "^1.2.1",
"react-sticky": "5.0.5",
"react-storybook-addon-add-stories-group": "0.1.0",
"react-tether": "^0.5.2",
"react-tooltip": "^3.2.7",
"react-virtualized": "^9.18.5",
Expand Down Expand Up @@ -225,7 +219,6 @@
"filesaver.js": "0.2.0",
"jshint": "^2.9.5",
"jszip": "3.0.0",
"moment": "^2.14.1",
"object-fit-images": "^3.2.3",
"qrcode.react": "^0.8.0",
"query-string": "4.1.0",
Expand Down
6 changes: 2 additions & 4 deletions apps/src/calc/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1203,11 +1203,9 @@ function onReportComplete(response) {
displayFeedback();
}

/* start-test-block */
// export private function(s) to expose to unit testing
Calc.__testonly__ = {
Calc.__testonly__ = IN_UNIT_TEST ? {
displayGoal: displayGoal,
displayComplexUserExpressions: displayComplexUserExpressions,
appState: appState
};
/* end-test-block */
} : {};
6 changes: 2 additions & 4 deletions apps/src/code-studio/progressRedux.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,10 @@ export const progressionsFromLevels = levels => {
return progressions;
};

/* start-test-block */
// export private function(s) to expose to unit testing
export const __testonly__ = {
export const __testonly__ = IN_UNIT_TEST ? {
bestResultLevelId,
peerReviewLesson,
peerReviewLevels,
PEER_REVIEW_ID
};
/* end-test-block */
} : {};
1 change: 1 addition & 0 deletions apps/src/jigsaw/jigsaw.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Jigsaw.init = function (config) {

config.enableShowCode = false;
config.enableShowBlockCount = false;
config.showUnusedBlocks = false;

var onMount = function () {
studioApp().init(config);
Expand Down
2 changes: 2 additions & 0 deletions apps/src/lib/ui/accounts/AddPasswordForm.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, {PropTypes} from 'react';
import i18n from '@cdo/locale';
import * as utils from '../../../utils';
import color from '@cdo/apps/util/color';
import {Field} from '../SystemDialog/SystemDialog';
import BootstrapButton from './BootstrapButton';
Expand Down Expand Up @@ -116,6 +117,7 @@ export default class AddPasswordForm extends React.Component {
message: SUCCESS_STATE
}
});
utils.reload();
};

onFailure = (error) => {
Expand Down
7 changes: 1 addition & 6 deletions apps/src/redux/instructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const LOCALSTORAGE_OVERLAY_SEEN_FLAG = 'instructionsOverlaySeenOnce';
*/
const instructionsInitialState = {
noInstructionsWhenCollapsed: false,
hasInlineImages: false,
shortInstructions: undefined,
shortInstructions2: undefined,
longInstructions: undefined,
Expand Down Expand Up @@ -64,7 +63,6 @@ export default function reducer(state = {...instructionsInitialState}, action) {
}
const {
noInstructionsWhenCollapsed,
hasInlineImages,
shortInstructions,
shortInstructions2,
longInstructions,
Expand All @@ -82,7 +80,6 @@ export default function reducer(state = {...instructionsInitialState}, action) {
}
return Object.assign({}, state, {
noInstructionsWhenCollapsed,
hasInlineImages,
shortInstructions,
shortInstructions2,
longInstructions,
Expand Down Expand Up @@ -148,11 +145,10 @@ export default function reducer(state = {...instructionsInitialState}, action) {

export const setInstructionsConstants = ({noInstructionsWhenCollapsed,
shortInstructions, shortInstructions2, longInstructions,
hasContainedLevels, hasInlineImages, overlayVisible, teacherMarkdown, levelVideos,
hasContainedLevels, overlayVisible, teacherMarkdown, levelVideos,
mapReference, referenceLinks}) => ({
type: SET_CONSTANTS,
noInstructionsWhenCollapsed,
hasInlineImages,
shortInstructions,
shortInstructions2,
longInstructions,
Expand Down Expand Up @@ -343,7 +339,6 @@ export const determineInstructionsConstants = config => {

return {
noInstructionsWhenCollapsed: !!noInstructionsWhenCollapsed,
hasInlineImages: !!config.skin.instructions2ImageSubstitutions,
overlayVisible: !!shouldShowOverlay,
shortInstructions,
shortInstructions2,
Expand Down
1 change: 0 additions & 1 deletion apps/src/redux/pageConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var ALLOWED_KEYS = new Set([
'isSubmittable',
'isSubmitted',
'noInstructionsWhenCollapsed',
'hasInlineImages',
'puzzleNumber',
'stageTotal',
'showDebugButtons',
Expand Down
33 changes: 16 additions & 17 deletions apps/src/templates/BaseDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import React, {PropTypes} from 'react';
* semi-transparent backdrop. Can be closed by clicking the x, clicking the
* backdrop, or pressing esc.
*/
var BaseDialog = React.createClass({
propTypes: {
export default class BaseDialog extends React.Component {
static propTypes = {
isOpen: PropTypes.bool,
handleClose: PropTypes.func,
uncloseable: PropTypes.bool,
Expand All @@ -22,45 +22,45 @@ var BaseDialog = React.createClass({
fixedWidth: PropTypes.number,
fixedHeight: PropTypes.number,
style: PropTypes.object,
},
};

componentDidMount: function () {
componentDidMount() {
this.focusDialog();
},
}

componentDidUpdate: function () {
componentDidUpdate() {
this.focusDialog();
},
}

handleKeyDown: function (event) {
handleKeyDown = (event) => {
if (event.key === 'Escape') {
this.closeDialog();
}
this.props.handleKeyDown && this.props.handleKeyDown(event);
},
};

closeDialog: function () {
closeDialog = () => {
if (!this.props.uncloseable && this.props.handleClose) {
this.props.handleClose();
}
},
};

/** @returns {Array.<Element>} */
getTabbableElements() {
return [].slice.call(this.refs.dialog.querySelectorAll('a,button,input'));
},
}

focusDialog: function () {
focusDialog() {
// Don't steal focus if the active element is already a descendant of the
// dialog - prevents focus loss on updates of open BaseDialog components.
const descendantIsActive = document.activeElement && this.refs.dialog &&
this.refs.dialog.contains(document.activeElement);
if (this.props.isOpen && !descendantIsActive) {
this.refs.dialog.focus();
}
},
}

render: function () {
render() {
if (!this.props.isOpen && !this.props.hideBackdrop) {
return <div></div>;
}
Expand Down Expand Up @@ -147,5 +147,4 @@ var BaseDialog = React.createClass({
</div>
);
}
});
module.exports = BaseDialog;
}
16 changes: 7 additions & 9 deletions apps/src/templates/Dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ Icon.propTypes = {
src: PropTypes.string.isRequired,
};

const Dialog = React.createClass({
propTypes: Object.assign({}, BaseDialog.propTypes, {
export default class Dialog extends React.Component {
static propTypes = {
...BaseDialog.propTypes,
children: childrenOfType(
Icon,
Title,
Expand All @@ -143,9 +144,9 @@ const Dialog = React.createClass({
confirmText: whenNoChildOfTypes(Buttons),
onConfirm: whenNoChildOfTypes(Buttons),
confirmType: whenNoChildOfTypes(Buttons),
}),
};

handleKeyDown(event) {
handleKeyDown = (event) => {
// Focus the next button, input or link when tab is pressed, to prevent the
// user from selecting elements outside of the dialog.
if (event.key === 'Tab') {
Expand All @@ -158,7 +159,7 @@ const Dialog = React.createClass({
}
event.preventDefault();
}
},
};

render() {
var children = [];
Expand Down Expand Up @@ -204,7 +205,4 @@ const Dialog = React.createClass({
</BaseDialog>
);
}
});


export default Dialog;
}