Skip to content

Commit

Permalink
Merge pull request #41684 from code-dot-org/dtp_candidate_b86a07b7
Browse files Browse the repository at this point in the history
DTP (Test > Production: b86a07b)
  • Loading branch information
davidsbailey committed Jul 21, 2021
2 parents 4434b2a + 515d5b0 commit 1805ca4
Show file tree
Hide file tree
Showing 156 changed files with 5,821 additions and 2,917 deletions.
7 changes: 7 additions & 0 deletions apps/src/blocklyAddons/cdoVariableMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import GoogleBlockly from 'blockly/core';

export default class CdoVariableMap extends GoogleBlockly.VariableMap {
addVariables(variableList) {
variableList.forEach(varName => this.createVariable(varName));
}
}
15 changes: 15 additions & 0 deletions apps/src/blocklyAddons/cdoWorkspaceSvg.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import GoogleBlockly from 'blockly/core';

export default class WorkspaceSvg extends GoogleBlockly.WorkspaceSvg {
registerGlobalVariables(variableList) {
this.globalVariables = variableList;
this.getVariableMap().addVariables(variableList);
}

clear() {
super.clear();

// After clearing the workspace, we need to reinitialize global variables
// if there are any.
if (this.globalVariables) {
this.getVariableMap().addVariables(this.globalVariables);
}
}

/** Add trashcan to flyout instead of block canvas
* @override
*/
Expand Down
7 changes: 5 additions & 2 deletions apps/src/code-studio/components/ShareAllowedDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,17 @@ class ShareAllowedDialog extends React.Component {
// If you change this width and height, make sure to update the
// #visualizationColumn.wireframeShare css
iframeHeight: applabConstants.APP_HEIGHT + 140,
iframeWidth: applabConstants.APP_WIDTH + 32
// Extra 32 pixels added to account for phone frame
// Extra 40 pixels added to account for left and right padding divs (20 px each side)
iframeWidth: applabConstants.APP_WIDTH + 32 + 40
};
} else if (this.props.appType === 'gamelab') {
embedOptions = {
// If you change this width and height, make sure to update the
// #visualizationColumn.wireframeShare css
iframeHeight: p5labConstants.APP_HEIGHT + 357,
iframeWidth: p5labConstants.APP_WIDTH + 32
// Extra 40 pixels added to account for left and right padding divs (20 px each side)
iframeWidth: p5labConstants.APP_WIDTH + 40
};
}
const {canPrint, canPublish, isPublished} = this.props;
Expand Down
6 changes: 6 additions & 0 deletions apps/src/p5lab/P5Lab.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,12 @@ P5Lab.prototype.afterInject_ = function(config) {
Blockly.clearInfiniteLoopTrap();
}

if (this.level.blocklyVariables) {
Blockly.mainBlockSpace.registerGlobalVariables(
this.level.blocklyVariables.split(',').map(varName => varName.trim())
);
}

// Update p5Wrapper's scale and keep it updated with future resizes:
this.p5Wrapper.scale = this.calculateVisualizationScale_();

Expand Down
2 changes: 2 additions & 0 deletions apps/src/sites/studio/pages/cdoBlocklyWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ function initializeBlocklyWrapper(blocklyInstance) {
blocklyWrapper.wrapSettableProperty('typeHints');
blocklyWrapper.wrapSettableProperty('valueTypeTabShapeMap');

blocklyWrapper.BlockSpace.prototype.registerGlobalVariables = function() {}; // Not implemented.

blocklyWrapper.getGenerator = function() {
return blocklyWrapper.Generator.get('JavaScript');
};
Expand Down
3 changes: 3 additions & 0 deletions apps/src/sites/studio/pages/googleBlocklyWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import CdoTheme from '@cdo/apps/blocklyAddons/cdoTheme';
import initializeTouch from '@cdo/apps/blocklyAddons/cdoTouch';
import CdoTrashcan from '@cdo/apps/blocklyAddons/cdoTrashcan';
import initializeVariables from '@cdo/apps/blocklyAddons/cdoVariables';
import CdoVariableMap from '@cdo/apps/blocklyAddons/cdoVariableMap';
import CdoWorkspaceSvg from '@cdo/apps/blocklyAddons/cdoWorkspaceSvg';
import initializeBlocklyXml from '@cdo/apps/blocklyAddons/cdoXml';

Expand Down Expand Up @@ -136,6 +137,7 @@ function initializeBlocklyWrapper(blocklyInstance) {
blocklyWrapper.wrapReadOnlyProperty('Touch');
blocklyWrapper.wrapReadOnlyProperty('Trashcan');
blocklyWrapper.wrapReadOnlyProperty('Variables');
blocklyWrapper.wrapReadOnlyProperty('VariableMap');
blocklyWrapper.wrapReadOnlyProperty('weblab_locale');
blocklyWrapper.wrapReadOnlyProperty('WidgetDiv');
blocklyWrapper.wrapReadOnlyProperty('Workspace');
Expand All @@ -151,6 +153,7 @@ function initializeBlocklyWrapper(blocklyInstance) {
blocklyWrapper.blockly_.MetricsManager = CdoMetricsManager;
blocklyWrapper.geras.PathObject = CdoPathObject;
blocklyWrapper.blockly_.Trashcan = CdoTrashcan;
blocklyWrapper.blockly_.VariableMap = CdoVariableMap;
blocklyWrapper.blockly_.WorkspaceSvg = CdoWorkspaceSvg;

blocklyWrapper.blockly_.registry.register(
Expand Down
5 changes: 5 additions & 0 deletions dashboard/app/controllers/code_review_comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def project_comments
storage_app_id: @storage_app_id
).order(:created_at)

# Keep teacher comments private between project owner and teacher.
unless @project_owner.student_of?(current_user) || @project_owner == current_user
@project_comments = @project_comments.reject {|comment| comment.commenter.teacher?}
end

serialized_comments = @project_comments.map {|comment| serialize(comment)}

render json: serialized_comments
Expand Down
16 changes: 16 additions & 0 deletions dashboard/app/models/backpack.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# == Schema Information
#
# Table name: backpacks
#
# id :bigint not null, primary key
# user_id :integer not null
# storage_app_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_backpacks_on_user_id (user_id)
#
class Backpack < ApplicationRecord
end
3 changes: 1 addition & 2 deletions dashboard/app/models/code_review_comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class CodeReviewComment < ApplicationRecord
validates :comment, presence: true
validates :project_owner_id, presence: true

# Note: this should be moved to the reviewable_projects model once it exists
# Something like reviewable_project.user_can_review?(potential_reviewer)
# To do: move to ReviewableProject model
def self.user_can_review_project?(project_owner, potential_reviewer)
project_owner == potential_reviewer ||
project_owner.student_of?(potential_reviewer) ||
Expand Down
1 change: 1 addition & 0 deletions dashboard/app/models/levels/gamelab_jr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class GamelabJr < Gamelab
block_pools
mini_toolbox
hide_pause_button
blockly_variables
)

def shared_blocks
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%h1.control-legend{data: {toggle: "collapse", target: "#variables"}}
Blockly Variables

#variables.in.collapse
= f.label :blockly_variables,'Pre-initialized Blockly Variables'
%p Enter a comma-separated list of variables that will be pre-populated in the variable dropdown blocks.
%p{style: 'color: red; font-size: larger' } NOTE: Only works with Google Blockly.
= f.text_area :blockly_variables, value: @level.blockly_variables
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
= render partial: 'levels/editors/fields/droplet', locals: {f: f} if @level.uses_droplet?
= render partial: 'levels/editors/fields/blockly', locals: {f: f} if !(@level.uses_droplet?) && @level.is_a?(Blockly)
= render partial: 'levels/editors/fields/weblab_code_area', locals: {f: f} if @level.is_a?(Weblab)
= render partial: 'levels/editors/fields/blockly_variables', locals: {f: f} if @level.is_a?(GamelabJr)
= render partial: 'levels/editors/fields/block_pools', locals: {f: f} if @level.is_a?(GamelabJr) || @level.is_a?(Dancelab)
= render partial: 'levels/editors/fields/helper_libraries', locals: {f: f} if @level.is_a?(GamelabJr) || @level.is_a?(Dancelab)
= render partial: 'levels/editors/fields/validation_code', locals: {f: f}
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
{
"pages": [
{
"name": "survey",
"elements": [
{
"type": "html",
"name": "title_and_header",
"html": "<h2>Code.org Self-paced Online Professional Learning</h2>\n<h3>Post-module Survey</h3>"
},
{
"type": "radiogroup",
"name": "section_setup_instructions",
"title": "Where is the best place to go if you are looking for written instructions for how to set up a class section on the Code.org website?",
"correctAnswer": "help_support",
"isRequired": true,
"choices": [
{
"value": "help_support",
"text": "Help and support "
},
{
"value": "report_a_problem",
"text": "Report a problem "
},
{
"value": "teacher_forum",
"text": "Teacher forum "
}
]
},
{
"type": "radiogroup",
"name": "where_to_find_lesson_plans",
"useDisplayValuesInTitle": false,
"title": "Where is the best place to go to find a link to individual lesson plans? ",
"correctAnswer": "teacher_forum",
"isRequired": true,
"choices": [
{
"value": "teacher_dashboard",
"text": "The teacher dashboard"
},
{
"value": "course_overview",
"text": "The course overview page"
},
{
"value": "unit_overview",
"text": "The unit overview page"
},
{
"value": "curriculum_dot_codeorg",
"text": "Curriculum.code.org "
}
]
},
{
"type": "checkbox",
"name": "question2",
"title": "I have done or know how to do the following (select all that apply):",
"choices": [
{
"value": "verified_teacher",
"text": "Become a verified teacher"
},
{
"value": "setup_sections",
"text": "Set up classroom sections"
},
{
"value": "add_students_to_section",
"text": "Add students to a class section"
},
{
"value": "assign_course",
"text": "Assign course content to students in a class section"
},
{
"value": "nav_teacher_dashboard",
"text": "Navigate to the teacher dashboard"
},
{
"value": "track_progress",
"text": "Track student progress using the teacher dashboard"
},
{
"value": "provide_feedback",
"text": "Provide feedback on student work"
},
{
"value": "access_lesson_plans",
"text": "Access course lesson plans"
},
{
"value": "access_resources",
"text": "Access teacher resources"
},
{
"value": "access_support",
"text": "Access additional support"
}
]
},
{
"type": "radiogroup",
"name": "comfort_nav_website",
"title": "After completing this module, I feel more comfortable navigating and using the Code.org website than I did before starting this professional learning course. ",
"choices": [
{
"value": "1",
"text": "Strongly disagree"
},
{
"value": "2",
"text": "Disagree"
},
{
"value": "3",
"text": "Neutral"
},
{
"value": "4",
"text": "Agree"
},
{
"value": "5",
"text": "Strongly agree"
}
]
},
{
"type": "radiogroup",
"name": "comfort_ability_to_teach_csd",
"title": "After completing this module, I feel more comfortable in my ability to teach CS Discoveries than I did before starting this professional learning course. ",
"choices": [
{
"value": "1",
"text": "Strongly disagree"
},
{
"value": "2",
"text": "Disagree"
},
{
"value": "3",
"text": "Neutral"
},
{
"value": "4",
"text": "Agree"
},
{
"value": "5",
"text": "Strongly agree"
}
]
},
{
"type": "matrix",
"name": "supported_learning",
"title": "Which of the following supported your learning the most? Rank the options from most helpful (5) to least helpful (1). ",
"description": "Please apply each rank (1-5) exactly once; don't give the same ranking to two different items.",
"columns": [
{
"value": "1",
"text": "1"
},
{
"value": "2",
"text": "2"
},
{
"value": "3",
"text": "3"
},
{
"value": "4",
"text": "4"
},
{
"value": "5",
"text": "5 "
}
],
"rows": [
{
"value": "videos",
"text": "Watching videos about the Code.org website."
},
{
"value": "reading",
"text": "Reading a page that contained text and images about a topic."
},
{
"value": "trying_a_task",
"text": "Trying a task with step by step instructions."
},
{
"value": "making_a_plan",
"text": "Making a plan related to preparing to teach CS Discoveries."
},
{
"value": "check_for_understanding",
"text": "Completing a check for understanding question."
}
]
},
{
"type": "comment",
"name": "other_feedback",
"title": "Do you have any feedback about this module that you would like to share with the Code.org team? "
}
]
},
{
"name": "results_page",
"elements": [
{
"type": "html",
"name": "results_reveal",
"html": "<h2>Your Responses</h2>\n<table>\n<tr>\n<th>question</th>\n<th>correct answer</th>\n<th>Your answer</th>\n</tr>\n<tr>\n<td> Where is the best place to go if you are looking for written instructions for how to set up a class section on the Code.org website?</td>\n<td>Help and support</td>\n<td>{section_setup_instructions}</td>\n</tr>\n<tr>\n<td> Where is the best place to go to find a link to individual lesson plans? </td>\n<td>The unit overview page</td>\n<td> {where_to_find_lesson_plans}</td>\n</tr>\n</table>"
}
]
}
],
"published": true
}

0 comments on commit 1805ca4

Please sign in to comment.