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

Rename teacher app sections #31039

Merged
merged 12 commits into from Oct 7, 2019
Expand Up @@ -30,20 +30,20 @@ const CS_TEACHERS_URL = 'https://code.org/educate/community';
const INTERNATIONAL = 'Other country';
const US = 'United States';

export default class Section1AboutYou extends LabeledFormComponent {
export default class AboutYou extends LabeledFormComponent {
static propTypes = {
...LabeledFormComponent.propTypes,
accountEmail: PropTypes.string.isRequired
};

static labels = PageLabels.section1AboutYou;
static labels = PageLabels.aboutYou;

static associatedFields = [
// Gender Identity and Race are things we want rendered in Section 1 in the detail view
// but we want to ask in section 5. So they need to be removed here.
// Also remove a whole mess of fields (from school to principal to role) which we have
// moved to Section 3, and therefore don't want to validate here in Section 1.
..._.difference(Object.keys(PageLabels.section1AboutYou), [
..._.difference(Object.keys(PageLabels.aboutYou), [
'genderIdentity',
'race',
'school',
Expand Down Expand Up @@ -178,7 +178,7 @@ export default class Section1AboutYou extends LabeledFormComponent {
.
</p>

<h3>Section 1: {SectionHeaders.section1AboutYou}</h3>
<h3>Section 1: {SectionHeaders.aboutYou}</h3>

{this.radioButtonsFor('country')}

Expand Down
Expand Up @@ -9,11 +9,11 @@ import {FormGroup} from 'react-bootstrap';
import PrivacyDialog from '../PrivacyDialog';
import {PrivacyDialogMode} from '../../constants';

export default class Section5AdditionalDemographicInformation extends LabeledFormComponent {
static labels = PageLabels.section5AdditionalDemographicInformation;
export default class AdditionalDemographicInformation extends LabeledFormComponent {
static labels = PageLabels.additionalDemographicInformation;

static associatedFields = [
...Object.keys(PageLabels.section5AdditionalDemographicInformation)
...Object.keys(PageLabels.additionalDemographicInformation)
];

state = {
Expand All @@ -34,9 +34,7 @@ export default class Section5AdditionalDemographicInformation extends LabeledFor
render() {
return (
<FormGroup>
<h3>
Section 5: {SectionHeaders.section5AdditionalDemographicInformation}
</h3>
<h3>Section 5: {SectionHeaders.additionalDemographicInformation}</h3>
{this.radioButtonsFor('genderIdentity')}
{this.checkBoxesFor('race')}
{this.checkBoxesWithAdditionalTextFieldsFor(
Expand Down
Expand Up @@ -8,12 +8,10 @@ import {
import {FormGroup, Row, Col} from 'react-bootstrap';
import {PROGRAM_CSD, PROGRAM_CSP} from './TeacherApplicationConstants';

export default class Section2ChooseYourProgram extends LabeledFormComponent {
static labels = PageLabels.section2ChooseYourProgram;
export default class ChooseYourProgram extends LabeledFormComponent {
static labels = PageLabels.chooseYourProgram;

static associatedFields = [
...Object.keys(PageLabels.section2ChooseYourProgram)
];
static associatedFields = [...Object.keys(PageLabels.chooseYourProgram)];

getNameForSelectedProgram() {
if (this.props.data.program === PROGRAM_CSD) {
Expand Down Expand Up @@ -62,7 +60,7 @@ export default class Section2ChooseYourProgram extends LabeledFormComponent {

return (
<FormGroup>
<h3>Section 3: {SectionHeaders.section2ChooseYourProgram}</h3>
<h3>Section 3: {SectionHeaders.chooseYourProgram}</h3>
{this.radioButtonsFor('program')}
{this.props.data.program === PROGRAM_CSD &&
this.checkBoxesFor('csdWhichGrades')}
Expand Down Expand Up @@ -93,7 +91,7 @@ export default class Section2ChooseYourProgram extends LabeledFormComponent {
style: {
width: '100px'
},
label: PageLabels.section2ChooseYourProgram.csHowManyMinutes.replace(
label: PageLabels.chooseYourProgram.csHowManyMinutes.replace(
'program',
this.getNameForSelectedProgram()
),
Expand All @@ -105,7 +103,7 @@ export default class Section2ChooseYourProgram extends LabeledFormComponent {
style: {
width: '100px'
},
label: PageLabels.section2ChooseYourProgram.csHowManyDaysPerWeek.replace(
label: PageLabels.chooseYourProgram.csHowManyDaysPerWeek.replace(
'program',
this.getNameForSelectedProgram()
),
Expand All @@ -117,7 +115,7 @@ export default class Section2ChooseYourProgram extends LabeledFormComponent {
style: {
width: '100px'
},
label: PageLabels.section2ChooseYourProgram.csHowManyWeeksPerYear.replace(
label: PageLabels.chooseYourProgram.csHowManyWeeksPerYear.replace(
'program',
this.getNameForSelectedProgram()
),
Expand Down
Expand Up @@ -25,11 +25,11 @@ const styles = {
}
};

export default class Section4SummerWorkshop extends LabeledFormComponent {
static labels = PageLabels.section4ProfessionalLearningProgramRequirements;
export default class SummerWorkshop extends LabeledFormComponent {
static labels = PageLabels.professionalLearningProgramRequirements;

static associatedFields = [
...Object.keys(PageLabels.section4ProfessionalLearningProgramRequirements),
...Object.keys(PageLabels.professionalLearningProgramRequirements),
'regionalPartnerId',
'regionalPartnerGroup',
'regionalPartnerWorkshopIds'
Expand Down Expand Up @@ -342,8 +342,7 @@ export default class Section4SummerWorkshop extends LabeledFormComponent {
return (
<FormGroup>
<h3>
Section 4:{' '}
{SectionHeaders.section4ProfessionalLearningProgramRequirements}
Section 4: {SectionHeaders.professionalLearningProgramRequirements}
</h3>

<p>
Expand Down
@@ -1,11 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import FormController from '../../form_components/FormController';
import Section1AboutYou from './Section1AboutYou';
import Section2ChooseYourProgram from './Section2ChooseYourProgram';
import Section3TeachingBackground from './Section3TeachingBackground';
import Section4ProfessionalLearningProgramRequirements from './Section4ProfessionalLearningProgramRequirements';
import Section5AdditionalDemographicInformation from './Section5AdditionalDemographicInformation';
import AboutYou from './AboutYou';
import TeachingBackground from './TeachingBackground';
import ChooseYourProgram from './ChooseYourProgram';
import ProfessionalLearningProgramRequirements from './ProfessionalLearningProgramRequirements';
import AdditionalDemographicInformation from './AdditionalDemographicInformation';
import firehoseClient from '@cdo/apps/lib/util/firehose';
import queryString from 'query-string';
/* global ga */
Expand Down Expand Up @@ -62,11 +62,11 @@ export default class Teacher2021Application extends FormController {
*/
getPageComponents() {
return [
Section1AboutYou,
Section3TeachingBackground,
Section2ChooseYourProgram,
Section4ProfessionalLearningProgramRequirements,
Section5AdditionalDemographicInformation
AboutYou,
TeachingBackground,
ChooseYourProgram,
ProfessionalLearningProgramRequirements,
AdditionalDemographicInformation
];
}

Expand Down
Expand Up @@ -11,14 +11,14 @@ import SchoolAutocompleteDropdown from '@cdo/apps/templates/SchoolAutocompleteDr
import {isEmail} from '@cdo/apps/util/formatValidation';
import {styles} from './TeacherApplicationConstants';

export default class Section3TeachingBackground extends LabeledFormComponent {
export default class TeachingBackground extends LabeledFormComponent {
static labels = {
...PageLabels.section3TeachingBackground,
...PageLabels.section1AboutYou
...PageLabels.teachingBackground,
...PageLabels.aboutYou
};

static associatedFields = [
...Object.keys(PageLabels.section3TeachingBackground),
...Object.keys(PageLabels.teachingBackground),
'school',
'schoolName',
'schoolDistrictName',
Expand Down Expand Up @@ -47,7 +47,7 @@ export default class Section3TeachingBackground extends LabeledFormComponent {
render() {
return (
<FormGroup>
<h3>Section 2: {SectionHeaders.section3TeachingBackground}</h3>
<h3>Section 2: {SectionHeaders.teachingBackground}</h3>

<p>Please provide your school and principal information below:</p>

Expand Down
22 changes: 11 additions & 11 deletions lib/cdo/shared_constants/pd/teacher1920_application_constants.rb
Expand Up @@ -9,8 +9,8 @@ def self.clean_multiline(string)

SECTION_HEADERS = {
section_1_about_you: 'About You',
section_2_choose_your_program: 'Choose Your Program',
section_3_teaching_background: 'Teaching Background',
section_2_teaching_background: 'Teaching Background',
section_3_choose_your_program: 'Choose Your Program',
section_4_professional_learning_program_requirements: 'Professional Learning Program Requirements',
section_5_additional_demographic_information: 'Additional Demographic Information and submission',
school_stats_and_principal_approval_section: 'Principal Approval and School Information'
Expand Down Expand Up @@ -49,7 +49,15 @@ def self.clean_multiline(string)
how_heard: 'How did you hear about this program?'
}
),
section_2_choose_your_program: {
section_2_teaching_background:
{subjects_teaching: BASE_PAGE_LABELS[:section_2_your_school][:subjects_teaching].gsub('17-18', '18-19')}.merge(
BASE_PAGE_LABELS[:section_2_your_school].slice(
:taught_in_past,
:cs_opportunities_at_school,
:previous_yearlong_cdo_pd
)
),
section_3_choose_your_program: {
program: clean_multiline(
'Which professional learning program would you like to join for the 2019-20
school year? Note: this application is only for Computer Science Discoveries and
Expand Down Expand Up @@ -84,14 +92,6 @@ def self.clean_multiline(string)
replace_existing: 'Will this course replace an existing computer science course in the master schedule? If yes, please list the course(s) that will be replaced.',
replace_which_course: 'If yes, please describe the course it will be replacing and why:'
},
section_3_teaching_background:
{subjects_teaching: BASE_PAGE_LABELS[:section_2_your_school][:subjects_teaching].gsub('17-18', '18-19')}.merge(
BASE_PAGE_LABELS[:section_2_your_school].slice(
:taught_in_past,
:cs_opportunities_at_school,
:previous_yearlong_cdo_pd
)
),
section_4_professional_learning_program_requirements:
{
committed: BASE_PAGE_LABELS[:section_4_summer_workshop][:committed],
Expand Down
42 changes: 21 additions & 21 deletions lib/cdo/shared_constants/pd/teacher2021_application_constants.rb
Expand Up @@ -8,16 +8,16 @@ def self.clean_multiline(string)
end

SECTION_HEADERS = {
section_1_about_you: 'About You',
section_2_choose_your_program: 'Choose Your Program',
section_3_teaching_background: 'Teaching Background',
section_4_professional_learning_program_requirements: 'Professional Learning Program Requirements',
section_5_additional_demographic_information: 'Additional Demographic Information and submission',
about_you: 'About You',
teaching_background: 'Teaching Background',
choose_your_program: 'Choose Your Program',
professional_learning_program_requirements: 'Professional Learning Program Requirements',
additional_demographic_information: 'Additional Demographic Information and submission',
Comment on lines +11 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels good.. the ordering feels less hardcoded now, and more flexible to change order if we discover that we should!

school_stats_and_principal_approval_section: 'Principal Approval and School Information'
}

PAGE_LABELS = {
section_1_about_you: BASE_PAGE_LABELS[:section_1_about_you].slice(
about_you: BASE_PAGE_LABELS[:section_1_about_you].slice(
:country,
:first_name,
:last_name,
Expand Down Expand Up @@ -49,7 +49,11 @@ def self.clean_multiline(string)
how_heard: 'How did you hear about this program?'
}
),
section_2_choose_your_program: {
teaching_background:
BASE_PAGE_LABELS[:section_2_your_school].slice(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so we have some mentions of section_X further upstream? It's fine to keep this change constrained but also interested to ponder how far we can take the numberless principle :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree! I'm going to fix that as part of an upcoming change to simplify how our constants files are structured.

:previous_yearlong_cdo_pd
),
choose_your_program: {
program: clean_multiline(
'Which professional learning program would you like to join for the 2020-21
school year? Note: this application is only for Computer Science Discoveries and
Expand Down Expand Up @@ -85,11 +89,7 @@ def self.clean_multiline(string)
replace_existing: 'Will this course replace an existing computer science course in the master schedule? If yes, please list the course(s) that will be replaced.',
replace_which_course: 'Which existing course or curriculum will it replace? Mark all that apply.'
},
section_3_teaching_background:
BASE_PAGE_LABELS[:section_2_your_school].slice(
:previous_yearlong_cdo_pd
),
section_4_professional_learning_program_requirements:
professional_learning_program_requirements:
{
committed: BASE_PAGE_LABELS[:section_4_summer_workshop][:committed],
able_to_attend_multiple: 'Your Regional Partner is hosting local summer workshop(s) at the following dates and locations. Please indicate which workshops you are able to attend. Select all that apply.',
Expand All @@ -100,7 +100,7 @@ def self.clean_multiline(string)
understand_fee: "By checking this box, you indicate that you understand there may be a fee for the professional learning program you attend.",
scholarship_reasons: "Please provide any additional information you'd like to share about why your application should be considered for a scholarship."
},
section_5_additional_demographic_information:
additional_demographic_information:
{
gender_identity: 'Gender identity:',
race: 'Race or ethnicity:',
Expand Down Expand Up @@ -150,7 +150,7 @@ def self.clean_multiline(string)
notes_5: "Notes 5",
alternate_email: "Alternate email",
school_type: "School type",
district_name: PAGE_LABELS[:section_1_about_you][:school_district_name],
district_name: PAGE_LABELS[:about_you][:school_district_name],
school_city: "School city",
school_state: "School state",
school_zip_code: "School zip code",
Expand All @@ -164,18 +164,18 @@ def self.clean_multiline(string)
previous_yearlong_cdo_pd: "Have you participated in previous yearlong Code.org Professional Learning Programs?",
able_to_attend_multiple: "Please indicate which workshops you are able to attend.",
willing_to_travel: "How far would you be willing to travel to academic year workshops?",
how_heard: PAGE_LABELS[:section_5_additional_demographic_information][:how_heard] + " (Teacher's response)",
how_heard: PAGE_LABELS[:additional_demographic_information][:how_heard] + " (Teacher's response)",
gender_identity: "Teacher's gender identity",
race: "Teacher's race",
principal_approval_url: "Principal Approval Form URL"
},
principal: {
title: PAGE_LABELS[:section_1_about_you][:principal_title] + " (provided by principal)",
first_name: PAGE_LABELS[:section_1_about_you][:principal_first_name] + " (provided by principal)",
last_name: PAGE_LABELS[:section_1_about_you][:principal_last_name] + " (provided by principal)",
email: PAGE_LABELS[:section_1_about_you][:principal_email] + " (provided by principal)",
school_name: PAGE_LABELS[:section_1_about_you][:school_name] + " (provided by principal)",
district_name: PAGE_LABELS[:section_1_about_you][:school_district_name] + " (provided by principal)",
title: PAGE_LABELS[:about_you][:principal_title] + " (provided by principal)",
first_name: PAGE_LABELS[:about_you][:principal_first_name] + " (provided by principal)",
last_name: PAGE_LABELS[:about_you][:principal_last_name] + " (provided by principal)",
email: PAGE_LABELS[:about_you][:principal_email] + " (provided by principal)",
school_name: PAGE_LABELS[:about_you][:school_name] + " (provided by principal)",
district_name: PAGE_LABELS[:about_you][:school_district_name] + " (provided by principal)",
do_you_approve: "Do you approve of this teacher participating in Code.org's 2020-21 Professional Learning Program?",
plan_to_teach: "Is this teacher planning to teach this course in the 2020-21 school year?",
total_student_enrollment: "Total student enrollment",
Expand Down