From 90712c7a9c2380f9bac65f6ae602522e58111019 Mon Sep 17 00:00:00 2001 From: Erin Bond Date: Fri, 3 Apr 2020 10:19:40 -0700 Subject: [PATCH] show download parent letter option in manage students action cell if parentLetter experiment is on --- apps/i18n/common/en_us.json | 1 + .../ManageStudentsActionsCell.jsx | 27 +++++++++++++++++-- apps/src/util/experiments.js | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/apps/i18n/common/en_us.json b/apps/i18n/common/en_us.json index 661295bc2a2b4..650a55f4002ac 100644 --- a/apps/i18n/common/en_us.json +++ b/apps/i18n/common/en_us.json @@ -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", diff --git a/apps/src/templates/manageStudents/ManageStudentsActionsCell.jsx b/apps/src/templates/manageStudents/ManageStudentsActionsCell.jsx index 2d2790864c718..6ffa15118f17d 100644 --- a/apps/src/templates/manageStudents/ManageStudentsActionsCell.jsx +++ b/apps/src/templates/manageStudents/ManageStudentsActionsCell.jsx @@ -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: { @@ -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 = [ @@ -200,7 +217,7 @@ class ManageStudentActionsCell extends Component { SectionLoginType.email ].includes(loginType); - const showLoginCardOption = [ + const showWordPictureOptions = [ SectionLoginType.word, SectionLoginType.picture ].includes(loginType); @@ -214,11 +231,17 @@ class ManageStudentActionsCell extends Component { {i18n.edit()} )} - {showLoginCardOption && ( + {showWordPictureOptions && ( {i18n.printLoginCard()} )} + {showWordPictureOptions && + experiments.isEnabled(experiments.PARENT_LETTER) && ( + + {i18n.downloadParentLetter()} + + )} {this.props.canEdit && canDelete && } {canDelete && ( diff --git a/apps/src/util/experiments.js b/apps/src/util/experiments.js index be392e4f265a7..b7574d09ba892 100644 --- a/apps/src/util/experiments.js +++ b/apps/src/util/experiments.js @@ -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';