Skip to content

Commit

Permalink
Merge pull request #26786 from code-dot-org/dtp_candidate_ef61fb25
Browse files Browse the repository at this point in the history
DTP (Test > Production: ef61fb2)
  • Loading branch information
Madelyn Kasula committed Jan 28, 2019
2 parents 87bca71 + 7c7d99e commit d7d2eb0
Show file tree
Hide file tree
Showing 119 changed files with 3,183 additions and 537 deletions.
2 changes: 1 addition & 1 deletion SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can do Code.org development using OSX, Ubuntu, or Windows (running Ubuntu in
yarn --version # --> 1.6.0
```
1. If using HTTPS: `git clone https://github.com/code-dot-org/code-dot-org.git`, if using SSH: `git@github.com:code-dot-org/code-dot-org.git`
1. `gem install bundler`
1. `gem install bundler -v 1.17`
1. `rbenv rehash`
1. `cd code-dot-org`
1. `bundle install` (Problems running this step? See [tips](#bundle-install-tips) below.)
Expand Down
1 change: 1 addition & 0 deletions apps/i18n/common/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"completedWithoutRecommendedBlock": "Congratulations! You completed Puzzle {puzzleNumber}. (But you could use a different block for stronger code.)",
"completionStatus": "Completion Status",
"concept": "Concept",
"confirmDeleteExplanation": "Deleting this file will remove it everywhere in your project",
"confirming": "Confirming...",
"confirmSchool": "Confirm School",
"congratsCertificateHeading": "You Earned a Certificate of Completion",
Expand Down
5 changes: 5 additions & 0 deletions apps/src/applab/designElements/CopyElementToScreenButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const styles = {
},
screen: {
},
menu: {
maxHeight: '200px',
overflowY: 'auto',
},
};

/**
Expand Down Expand Up @@ -104,6 +108,7 @@ class CopyElementToScreenButton extends React.Component {
targetPoint={targetPoint}
offset={{x: 0, y: 0}}
beforeClose={this.beforeClose}
style={styles.menu}
>
{otherScreens}
</PopUpMenu>
Expand Down
12 changes: 12 additions & 0 deletions apps/src/code-studio/components/AssetRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import {assets as assetsApi, files as filesApi} from '@cdo/apps/clientApi';
import AssetThumbnail from './AssetThumbnail';
import i18n from '@cdo/locale';
import firehoseClient from "@cdo/apps/lib/util/firehose";
import color from "@cdo/apps/util/color";

const styles = {
deleteWarning: {
paddingLeft: '34px',
textAlign: 'left',
color: color.red
}
};

/**
* A single row in the AssetManager, describing one asset.
Expand Down Expand Up @@ -114,6 +123,9 @@ export default class AssetRow extends React.Component {
Delete File
</button>
<button onClick={this.cancelDelete}>Cancel</button>
<div style={styles.deleteWarning}>
{i18n.confirmDeleteExplanation()}
</div>
{this.state.actionText}
</td>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,6 @@ export default class AdminCohortViewTable extends React.Component {
cell: {
format: this.formatBoolean
}
}, {
property: 'teachercon_assigned_at_registration',
header: {
label: 'Teachercon Assigned at Registration',
transforms: [sortable]
}
}, {
property: 'accepted_teachercon',
header: {
label: 'Accepted Teachercon',
transforms: [sortable]
}
}, {
property: 'assigned_fit',
header: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,6 @@ export class CohortViewTable extends React.Component {
}
});

if ([WorkshopTypes["teachercon"], WorkshopTypes["both"]].includes(this.workshopType)) {
columns.push({
property: 'accepted_teachercon',
header: {
label: 'Accepted Teachercon',
transforms: [sortable]
}
});
}

if ([WorkshopTypes["local_summer"], WorkshopTypes["both"]].includes(this.workshopType)) {
columns.push({
property: 'registered_workshop',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export default storybook => {
school_name: 'Hogwarts',
email: 'nurse@hogwarts.edu',
notified: 'Yes',
assigned_workshop: 'TeacherCon Chicago',
accepted_teachercon: 'Yes'
assigned_workshop: 'Chicago Summer Workshop 6/1'
},
{
id: 2,
Expand All @@ -32,8 +31,7 @@ export default storybook => {
school_name: 'Hogwarts',
email: 'short@hogwarts.edu',
notified: 'Yes',
assigned_workshop: 'TeacherCon Chicago',
accepted_teachercon: 'No'
assigned_workshop: 'Chicago Summer Workshop 6/1'
}
]}
viewType="teacher"
Expand All @@ -48,7 +46,7 @@ export default storybook => {
workshop_type: WorkshopTypes.local_summer
},{
id: 2,
workshop_type: WorkshopTypes.teachercon
workshop_type: WorkshopTypes.local_summer
}
]}
/>
Expand Down Expand Up @@ -97,7 +95,7 @@ export default storybook => {
workshop_type: WorkshopTypes.local_summer
},{
id: 2,
workshop_type: WorkshopTypes.teachercon
workshop_type: WorkshopTypes.local_summer
}
]}
/>
Expand Down
86 changes: 13 additions & 73 deletions apps/src/redux/sectionDataRedux.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
import { PropTypes } from 'react';
import $ from 'jquery';

/**
* Reducer for section data in teacher dashboard.
* Tab specific reducers can import actions from this file
* if they need to respond to a section changing.
*/

/**
* Shape for the section
* The section we get directly from angular right now. This gives us a
* different shape than some other places we use sections. For now, I'm just
* going to document the parts of section that we use here
*/
export const sectionDataPropType = PropTypes.shape({
/**
* Shape for the section
* The section we get directly from angular right now. This gives us a
* different shape than some other places we use sections. For now, I'm just
* going to document the parts of section that we use here
*/
export const sectionDataPropType = PropTypes.shape({
id: PropTypes.number.isRequired,
script: PropTypes.object,
students: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.number.isRequired,
script: PropTypes.object,
students: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
})).isRequired
});

/**
* Status for loading section data from server.
*/
export const LoadingStatus = {
IN_PROGRESS: "inProgress",
SUCCESS: "success",
FAIL: "fail",
};
name: PropTypes.string.isRequired,
})).isRequired
});

/**
* Action type constants
*/
export const SET_SECTION = 'sectionData/SET_SECTION';
export const CLEAR_SECTION_DATA = 'sectionData/CLEAR_SECTION_DATA';
export const START_LOADING_SECTION = 'sectionData/START_LOADING_SECTION';
export const LOAD_SECTION_SUCCESS = 'sectionData/LOAD_SECTION_SUCCESS';
export const LOAD_SECTION_FAIL = 'sectionData/LOAD_SECTION_FAIL';

/**
* Action creators
Expand All @@ -61,7 +47,6 @@ export const setSection = (section) => {
*/
const initialState = {
section: {},
loadingStatus: null,
};

/**
Expand All @@ -78,31 +63,6 @@ export default function sectionData(state=initialState, action) {
};
}

if (action.type === CLEAR_SECTION_DATA) {
return initialState;
}

if (action.type === START_LOADING_SECTION) {
return {
...state,
loadingStatus: LoadingStatus.IN_PROGRESS,
};
}

if (action.type === LOAD_SECTION_SUCCESS) {
return {
...state,
loadingStatus: LoadingStatus.SUCCESS,
};
}

if (action.type === LOAD_SECTION_FAIL) {
return {
...state,
loadingStatus: LoadingStatus.FAIL,
};
}

return state;
}

Expand All @@ -116,23 +76,3 @@ export const getTotalStudentCount = (state) => {
export const getStudentList = (state) => {
return state.sectionData.section.students;
};

/**
* Helper functions
*/
export const asyncSetSection = (sectionId) => (dispatch) => {
// Clear any existing section data and begin loading.
dispatch({ type: CLEAR_SECTION_DATA });
dispatch({ type: START_LOADING_SECTION });

$.ajax({
url: `/api/v1/sections/${sectionId}`,
method: 'GET',
dataType: 'json'
}).done(section => {
dispatch(setSection(section));
dispatch({ type: LOAD_SECTION_SUCCESS });
}).fail((jqXhr, status) => {
dispatch({ type: LOAD_SECTION_FAIL });
});
};
45 changes: 36 additions & 9 deletions apps/src/sites/studio/pages/teacher_dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,58 @@ import ReactDOM from 'react-dom';
import {BrowserRouter as Router, Route} from 'react-router-dom';
import {Provider} from 'react-redux';
import {getStore, registerReducers} from '@cdo/apps/redux';
import sectionData, {asyncSetSection} from '@cdo/apps/redux/sectionDataRedux';
import manageStudents, {
setLoginType,
setStudents,
convertStudentServerData,
toggleSharingColumn,
} from '@cdo/apps/templates/manageStudents/manageStudentsRedux';
import teacherSections, {setSections, selectSection} from '@cdo/apps/templates/teacherDashboard/teacherSectionsRedux';
import sectionData, {setSection} from '@cdo/apps/redux/sectionDataRedux';
import stats, {asyncSetCompletedLevelCount} from '@cdo/apps/templates/teacherDashboard/statsRedux';
import TeacherDashboard from '@cdo/apps/templates/teacherDashboard/TeacherDashboard';

const script = document.querySelector('script[data-dashboard]');
const scriptData = JSON.parse(script.dataset.dashboard);
const sectionId = scriptData.section_id;
const baseUrl = `/teacher_dashboard/sections/${sectionId}`;
const section = scriptData.section;
const baseUrl = `/teacher_dashboard/sections/${section.id}`;

$(document).ready(function () {
registerReducers({sectionData, stats});
registerReducers({teacherSections, sectionData, manageStudents, stats});
const store = getStore();
store.dispatch(asyncSetSection(sectionId));
store.dispatch(asyncSetCompletedLevelCount(sectionId));
// TODO: (madelynkasula) remove duplication in sectionData.setSection and teacherSections.setSections
store.dispatch(setSection(section));
store.dispatch(setSections([section]));

store.dispatch(selectSection(section.id));
store.dispatch(setLoginType(section.login_type));
store.dispatch(asyncSetCompletedLevelCount(section.id));

// Show share column by default for CSD and CSP courses,
// or any script in either course.
const courseFamiliesToShowShareColumn = ["csd", "csp"];
if (courseFamiliesToShowShareColumn.includes(section.script.course_family_name)) {
store.dispatch(toggleSharingColumn());
}

$.ajax({
method: 'GET',
url: `/dashboardapi/sections/${section.id}/students`,
dataType: 'json'
}).done(studentData => {
const convertedStudentData = convertStudentServerData(studentData, section.login_type, section.id);
store.dispatch(setStudents(convertedStudentData));
});

ReactDOM.render(
<Provider store={store}>
<Router basename={baseUrl}>
<Route
path="/"
component={props => <TeacherDashboard {...props} sectionId={sectionId} studioUrlPrefix=""/>}
component={props => <TeacherDashboard {...props} sectionId={section.id} section={section} studioUrlPrefix=""/>}
/>
</Router>
</Provider>
,
</Provider>,
document.getElementById('teacher-dashboard')
);
});
10 changes: 10 additions & 0 deletions apps/src/templates/RegionalPartnerSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ class RegionalPartnerSearch extends Component {
<div style={styles.noPartner}>
<p>We do not have a Regional Partner in your area. However, we have a number of partners in nearby states or regions who may have space available in their program. If you are willing to travel, please fill out the application. We'll let you know if we can find you a nearby spot in the program!</p>
<p>If we find a spot, we'll let you know the workshop dates and program fees (if applicable) so you can decide at that point if it is something you or your school can cover.</p>
<p>
<span style={styles.bold}>Arkansas Teachers: </span>
Code.org does not have a Regional Partner in Arkansas, and we are unable to offer you a space in this program this year. There are many great opportunities for
{' '}
<span style={styles.bold}>state-provided professional development </span>
for computer science in Arkansas in
{' '}
<a href="https://docs.google.com/document/d/1OeLNx97wiLon69e8lp45M6ox0BuYLCOSZedzrtMB8_k/edit" target="_blank">this document</a>
.
</p>
<p>
All of our curriculum, tools, and courses are also available for your school at no cost.
Or,
Expand Down
1 change: 1 addition & 0 deletions apps/src/templates/projects/ProjectAppTypeArea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class ProjectAppTypeArea extends React.Component {
<ProjectCardRow
projects={filteredList}
galleryType={this.props.galleryType}
isDetailView ={this.props.isDetailView}
/>
);
}
Expand Down
5 changes: 3 additions & 2 deletions apps/src/templates/projects/ProjectCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default class ProjectCard extends React.Component {
projectData: PropTypes.object.isRequired,
currentGallery: PropTypes.oneOf(['personal', 'public']).isRequired,
showFullThumbnail: PropTypes.bool,
isDetailView: PropTypes.bool,
};

getLastModifiedTimestamp(timestamp) {
Expand All @@ -93,7 +94,7 @@ export default class ProjectCard extends React.Component {
}

render() {
const { projectData, currentGallery } = this.props;
const { projectData, currentGallery, isDetailView } = this.props;
const { type, channel } = this.props.projectData;
const isPersonalGallery = currentGallery === 'personal';
const isPublicGallery = currentGallery === 'public';
Expand Down Expand Up @@ -145,7 +146,7 @@ export default class ProjectCard extends React.Component {
</span>
)}
</span>
{isPublicGallery && projectData.publishedAt && (
{isPublicGallery && isDetailView && projectData.publishedAt && (
<div style={styles.lastEdit}>
{i18n.published()}:&nbsp;
<time
Expand Down

0 comments on commit d7d2eb0

Please sign in to comment.