Skip to content

Commit

Permalink
Merge pull request #34021 from code-dot-org/manage-students-parent-le…
Browse files Browse the repository at this point in the history
…tter

Parent Letter: single student option in Manage Students table
  • Loading branch information
Erin007 committed Apr 3, 2020
2 parents e9455d0 + 90712c7 commit 60c8e13
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/i18n/common/en_us.json
Expand Up @@ -516,6 +516,7 @@
"downloadCSV": "Download CSV",
"downloadAssessmentCSV": "Download CSV of student responses",
"downloadFeedbackCSV": "Download CSV of Feedback",
"downloadParentLetter": "Download parent letter",
"downloadReplayVideoButtonDownload": "Animation",
"downloadReplayVideoButtonError": "Sorry, we were unable to download your animation. Please try re-running your project and trying again.",
"dragBlocksToMatch": "Drag the blocks to match",
Expand Down
27 changes: 25 additions & 2 deletions apps/src/templates/manageStudents/ManageStudentsActionsCell.jsx
Expand Up @@ -20,6 +20,7 @@ import i18n from '@cdo/locale';
import {navigateToHref} from '@cdo/apps/utils';
import {teacherDashboardUrl} from '@cdo/apps/templates/teacherDashboard/urlHelpers';
import firehoseClient from '@cdo/apps/lib/util/firehose';
import experiments from '@cdo/apps/util/experiments';

const styles = {
xIcon: {
Expand Down Expand Up @@ -192,6 +193,22 @@ class ManageStudentActionsCell extends Component {
navigateToHref(url);
};

onDownloadParentLetter = () => {
const {id, sectionId} = this.props;
firehoseClient.putRecord(
{
study: 'teacher-dashboard',
study_group: 'manage-students-actions',
event: 'single-student-download-parent-letter',
data_json: JSON.stringify({
sectionId: sectionId,
studentId: id
})
},
{includeUserId: true}
);
};

render() {
const {rowType, isEditing, loginType} = this.props;
const canDelete = [
Expand All @@ -200,7 +217,7 @@ class ManageStudentActionsCell extends Component {
SectionLoginType.email
].includes(loginType);

const showLoginCardOption = [
const showWordPictureOptions = [
SectionLoginType.word,
SectionLoginType.picture
].includes(loginType);
Expand All @@ -214,11 +231,17 @@ class ManageStudentActionsCell extends Component {
{i18n.edit()}
</PopUpMenu.Item>
)}
{showLoginCardOption && (
{showWordPictureOptions && (
<PopUpMenu.Item onClick={this.onPrintLoginInfo}>
{i18n.printLoginCard()}
</PopUpMenu.Item>
)}
{showWordPictureOptions &&
experiments.isEnabled(experiments.PARENT_LETTER) && (
<PopUpMenu.Item onClick={this.onDownloadParentLetter}>
{i18n.downloadParentLetter()}
</PopUpMenu.Item>
)}
{this.props.canEdit && canDelete && <MenuBreak />}
{canDelete && (
<PopUpMenu.Item onClick={this.onRequestDelete} color={color.red}>
Expand Down
1 change: 1 addition & 0 deletions apps/src/util/experiments.js
Expand Up @@ -25,6 +25,7 @@ experiments.APPLAB_DATASETS = 'applabDatasets';
experiments.SHOW_UNPUBLISHED_FIREBASE_TABLES = 'showUnpublishedFirebaseTables';
experiments.STUDENT_LIBRARIES = 'student-libraries';
experiments.STANDARDS_REPORT = 'standardsReport';
experiments.PARENT_LETTER = 'parentLetter';
experiments.BETT_DEMO = 'bett-demo';
experiments.TEACHER_DASHBOARD_SECTION_BUTTONS =
'teacher-dashboard-section-buttons';
Expand Down

0 comments on commit 60c8e13

Please sign in to comment.