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

pass isEnglish to TeacherHomepage #19967

Merged
merged 1 commit into from
Jan 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions apps/src/sites/studio/pages/home/_homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function showHomepage() {
const script = document.querySelector('script[data-homepage]');
const homepageData = JSON.parse(script.dataset.homepage);
const isTeacher = homepageData.isTeacher;
const isEnglish = homepageData.isEnglish;
const announcementOverride = homepageData.announcement;
const showUiTips = homepageData.showuitips;
const userId = homepageData.userid;
Expand Down Expand Up @@ -149,6 +150,7 @@ function showHomepage() {
topCourse={homepageData.topCourse}
queryStringOpen={query['open']}
canViewAdvancedTools={homepageData.canViewAdvancedTools}
isEnglish={isEnglish}
ncesSchoolId={homepageData.ncesSchoolId}
censusQuestion={homepageData.censusQuestion}
showCensusBanner={homepageData.showCensusBanner}
Expand Down
1 change: 1 addition & 0 deletions apps/src/templates/studioHomepages/TeacherHomepage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class TeacherHomepage extends Component {
announcements: PropTypes.array.isRequired,
queryStringOpen: PropTypes.string,
canViewAdvancedTools: PropTypes.bool,
isEnglish: PropTypes.bool.isRequired,
showCensusBanner: PropTypes.bool.isRequired,
ncesSchoolId: PropTypes.string,
censusQuestion: PropTypes.oneOf(['how_many_10_hours', 'how_many_20_hours']),
Expand Down
5 changes: 5 additions & 0 deletions apps/src/templates/studioHomepages/TeacherHomepage.story.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default storybook => {
announcements={[announcement]}
courses={[]}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
</Provider>
Expand All @@ -63,6 +64,7 @@ export default storybook => {
topCourse={topCourse}
courses={courses}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
</Provider>
Expand All @@ -82,6 +84,7 @@ export default storybook => {
announcements={[announcement]}
courses={[]}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
</Provider>
Expand All @@ -102,6 +105,7 @@ export default storybook => {
courses={courses}
topCourse={topCourse}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
</Provider>
Expand All @@ -122,6 +126,7 @@ export default storybook => {
courses={courses}
topCourse={topCourse}
joinedSections={joinedSections}
isEnglish={true}
showCensusBanner={false}
/>
</Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('TeacherHomepage', () => {
courses={[]}
topCourse={topCourse}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
);
Expand All @@ -46,6 +47,7 @@ describe('TeacherHomepage', () => {
courses={[]}
topCourse={topCourse}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
);
Expand All @@ -59,6 +61,7 @@ describe('TeacherHomepage', () => {
courses={[]}
topCourse={topCourse}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
);
Expand All @@ -82,6 +85,7 @@ describe('TeacherHomepage', () => {
courses={[]}
topCourse={topCourse}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
);
Expand All @@ -97,6 +101,7 @@ describe('TeacherHomepage', () => {
courses={[]}
topCourse={topCourse}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
);
Expand All @@ -110,6 +115,7 @@ describe('TeacherHomepage', () => {
topCourse={topCourse}
courses={courses}
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
);
Expand All @@ -130,6 +136,7 @@ describe('TeacherHomepage', () => {
topCourse={topCourse}
codeOrgUrlPrefix="http://localhost:3000/"
joinedSections={[]}
isEnglish={true}
showCensusBanner={false}
/>
);
Expand Down
1 change: 1 addition & 0 deletions dashboard/app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def teacher_announcements
private

def init_homepage
@is_english = request.language == 'en'
if current_user
@gallery_activities =
current_user.gallery_activities.order(id: :desc).page(params[:page]).per(GALLERY_PER_PAGE)
Expand Down
2 changes: 1 addition & 1 deletion dashboard/app/views/home/_homepage.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- homepage_data[:userid] = current_user.id
- homepage_data[:valid_grades] = Section.valid_grades
- homepage_data[:topCourse] = @top_course
- homepage_data[:isenglish] = @is_english
- homepage_data[:isEnglish] = @is_english
Copy link
Member

Choose a reason for hiding this comment

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

it would be good to settle on a casing for these parameters but this one seems consistent with at least one of the above :)


- if current_user
- provider = current_user.provider
Expand Down