Commit 4db568a9 authored by Neil Fraser's avatar Neil Fraser

Add help URLs to Block Factory.

parent 984d3559
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -61,7 +61,9 @@ Blockly.Blocks['factory_base'] = { ...@@ -61,7 +61,9 @@ Blockly.Blocks['factory_base'] = {
.appendField('help url'); .appendField('help url');
*/ */
this.setTooltip('Build a custom block by plugging\n' + this.setTooltip('Build a custom block by plugging\n' +
'fields, inputs and other blocks here.'); 'fields, inputs and other blocks here.');
this.setHelpUrl(
'https://developers.google.com/blockly/custom-blocks/block-factory');
}, },
mutationToDom: function() { mutationToDom: function() {
var container = document.createElement('mutation'); var container = document.createElement('mutation');
...@@ -130,6 +132,7 @@ Blockly.Blocks['input_value'] = { ...@@ -130,6 +132,7 @@ Blockly.Blocks['input_value'] = {
this.setPreviousStatement(true, 'Input'); this.setPreviousStatement(true, 'Input');
this.setNextStatement(true, 'Input'); this.setNextStatement(true, 'Input');
this.setTooltip('A value socket for horizontal connections.'); this.setTooltip('A value socket for horizontal connections.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=71');
}, },
onchange: function() { onchange: function() {
if (!this.workspace) { if (!this.workspace) {
...@@ -158,6 +161,7 @@ Blockly.Blocks['input_statement'] = { ...@@ -158,6 +161,7 @@ Blockly.Blocks['input_statement'] = {
this.setPreviousStatement(true, 'Input'); this.setPreviousStatement(true, 'Input');
this.setNextStatement(true, 'Input'); this.setNextStatement(true, 'Input');
this.setTooltip('A statement socket for enclosed vertical stacks.'); this.setTooltip('A statement socket for enclosed vertical stacks.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=246');
}, },
onchange: function() { onchange: function() {
if (!this.workspace) { if (!this.workspace) {
...@@ -180,10 +184,10 @@ Blockly.Blocks['input_dummy'] = { ...@@ -180,10 +184,10 @@ Blockly.Blocks['input_dummy'] = {
.appendField(new Blockly.FieldDropdown(ALIGNMENT_OPTIONS), 'ALIGN'); .appendField(new Blockly.FieldDropdown(ALIGNMENT_OPTIONS), 'ALIGN');
this.setPreviousStatement(true, 'Input'); this.setPreviousStatement(true, 'Input');
this.setNextStatement(true, 'Input'); this.setNextStatement(true, 'Input');
this.setTooltip('For adding fields on a separate\n' + this.setTooltip('For adding fields on a separate row with no ' +
'row with no connections.\n' + 'connections. Alignment options (left, right, centre) ' +
'Alignment options (left, right, centre)\n' +
'apply only to multi-line fields.'); 'apply only to multi-line fields.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=293');
} }
}; };
...@@ -197,6 +201,7 @@ Blockly.Blocks['field_static'] = { ...@@ -197,6 +201,7 @@ Blockly.Blocks['field_static'] = {
this.setPreviousStatement(true, 'Field'); this.setPreviousStatement(true, 'Field');
this.setNextStatement(true, 'Field'); this.setNextStatement(true, 'Field');
this.setTooltip('Static text that serves as a label.'); this.setTooltip('Static text that serves as a label.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=88');
} }
}; };
...@@ -212,6 +217,7 @@ Blockly.Blocks['field_input'] = { ...@@ -212,6 +217,7 @@ Blockly.Blocks['field_input'] = {
this.setPreviousStatement(true, 'Field'); this.setPreviousStatement(true, 'Field');
this.setNextStatement(true, 'Field'); this.setNextStatement(true, 'Field');
this.setTooltip('An input field for the user to enter text.'); this.setTooltip('An input field for the user to enter text.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=319');
}, },
onchange: function() { onchange: function() {
if (!this.workspace) { if (!this.workspace) {
...@@ -234,6 +240,7 @@ Blockly.Blocks['field_angle'] = { ...@@ -234,6 +240,7 @@ Blockly.Blocks['field_angle'] = {
this.setPreviousStatement(true, 'Field'); this.setPreviousStatement(true, 'Field');
this.setNextStatement(true, 'Field'); this.setNextStatement(true, 'Field');
this.setTooltip('An input field for the user to enter an angle.'); this.setTooltip('An input field for the user to enter an angle.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=372');
}, },
onchange: function() { onchange: function() {
if (!this.workspace) { if (!this.workspace) {
...@@ -267,6 +274,7 @@ Blockly.Blocks['field_dropdown'] = { ...@@ -267,6 +274,7 @@ Blockly.Blocks['field_dropdown'] = {
this.setNextStatement(true, 'Field'); this.setNextStatement(true, 'Field');
this.setMutator(new Blockly.Mutator(['field_dropdown_option'])); this.setMutator(new Blockly.Mutator(['field_dropdown_option']));
this.setTooltip('Dropdown menu with a list of options.'); this.setTooltip('Dropdown menu with a list of options.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386');
this.optionCount_ = 3; this.optionCount_ = 3;
}, },
mutationToDom: function(workspace) { mutationToDom: function(workspace) {
...@@ -354,6 +362,7 @@ Blockly.Blocks['field_dropdown_container'] = { ...@@ -354,6 +362,7 @@ Blockly.Blocks['field_dropdown_container'] = {
this.appendStatementInput('STACK'); this.appendStatementInput('STACK');
this.setTooltip('Add, remove, or reorder options\n' + this.setTooltip('Add, remove, or reorder options\n' +
'to reconfigure this dropdown menu.'); 'to reconfigure this dropdown menu.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386');
this.contextMenu = false; this.contextMenu = false;
} }
}; };
...@@ -367,6 +376,7 @@ Blockly.Blocks['field_dropdown_option'] = { ...@@ -367,6 +376,7 @@ Blockly.Blocks['field_dropdown_option'] = {
this.setPreviousStatement(true); this.setPreviousStatement(true);
this.setNextStatement(true); this.setNextStatement(true);
this.setTooltip('Add a new option to the dropdown menu.'); this.setTooltip('Add a new option to the dropdown menu.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=386');
this.contextMenu = false; this.contextMenu = false;
} }
}; };
...@@ -383,6 +393,7 @@ Blockly.Blocks['field_checkbox'] = { ...@@ -383,6 +393,7 @@ Blockly.Blocks['field_checkbox'] = {
this.setPreviousStatement(true, 'Field'); this.setPreviousStatement(true, 'Field');
this.setNextStatement(true, 'Field'); this.setNextStatement(true, 'Field');
this.setTooltip('Checkbox field.'); this.setTooltip('Checkbox field.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=485');
}, },
onchange: function() { onchange: function() {
if (!this.workspace) { if (!this.workspace) {
...@@ -405,6 +416,7 @@ Blockly.Blocks['field_colour'] = { ...@@ -405,6 +416,7 @@ Blockly.Blocks['field_colour'] = {
this.setPreviousStatement(true, 'Field'); this.setPreviousStatement(true, 'Field');
this.setNextStatement(true, 'Field'); this.setNextStatement(true, 'Field');
this.setTooltip('Colour input field.'); this.setTooltip('Colour input field.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=495');
}, },
onchange: function() { onchange: function() {
if (!this.workspace) { if (!this.workspace) {
...@@ -427,6 +439,7 @@ Blockly.Blocks['field_variable'] = { ...@@ -427,6 +439,7 @@ Blockly.Blocks['field_variable'] = {
this.setPreviousStatement(true, 'Field'); this.setPreviousStatement(true, 'Field');
this.setNextStatement(true, 'Field'); this.setNextStatement(true, 'Field');
this.setTooltip('Dropdown menu for variable names.'); this.setTooltip('Dropdown menu for variable names.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=510');
}, },
onchange: function() { onchange: function() {
if (!this.workspace) { if (!this.workspace) {
...@@ -459,6 +472,7 @@ Blockly.Blocks['field_image'] = { ...@@ -459,6 +472,7 @@ Blockly.Blocks['field_image'] = {
this.setTooltip('Static image (JPEG, PNG, GIF, SVG, BMP).\n' + this.setTooltip('Static image (JPEG, PNG, GIF, SVG, BMP).\n' +
'Retains aspect ratio regardless of height and width.\n' + 'Retains aspect ratio regardless of height and width.\n' +
'Alt text is for when collapsed.'); 'Alt text is for when collapsed.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=567');
} }
}; };
...@@ -474,6 +488,7 @@ Blockly.Blocks['type_group'] = { ...@@ -474,6 +488,7 @@ Blockly.Blocks['type_group'] = {
this.setOutput(true, 'Type'); this.setOutput(true, 'Type');
this.setMutator(new Blockly.Mutator(['type_group_item'])); this.setMutator(new Blockly.Mutator(['type_group_item']));
this.setTooltip('Allows more than one type to be accepted.'); this.setTooltip('Allows more than one type to be accepted.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=677');
this.typeCount_ = 2; this.typeCount_ = 2;
}, },
mutationToDom: function(workspace) { mutationToDom: function(workspace) {
...@@ -552,6 +567,7 @@ Blockly.Blocks['type_group_container'] = { ...@@ -552,6 +567,7 @@ Blockly.Blocks['type_group_container'] = {
.appendField('add types'); .appendField('add types');
this.appendStatementInput('STACK'); this.appendStatementInput('STACK');
this.setTooltip('Add, or remove allowed type.'); this.setTooltip('Add, or remove allowed type.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=677');
this.contextMenu = false; this.contextMenu = false;
} }
}; };
...@@ -565,6 +581,7 @@ Blockly.Blocks['type_group_item'] = { ...@@ -565,6 +581,7 @@ Blockly.Blocks['type_group_item'] = {
this.setPreviousStatement(true); this.setPreviousStatement(true);
this.setNextStatement(true); this.setNextStatement(true);
this.setTooltip('Add a new allowed type.'); this.setTooltip('Add a new allowed type.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=677');
this.contextMenu = false; this.contextMenu = false;
} }
}; };
...@@ -578,6 +595,7 @@ Blockly.Blocks['type_null'] = { ...@@ -578,6 +595,7 @@ Blockly.Blocks['type_null'] = {
.appendField('any'); .appendField('any');
this.setOutput(true, 'Type'); this.setOutput(true, 'Type');
this.setTooltip('Any type is allowed.'); this.setTooltip('Any type is allowed.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602');
} }
}; };
...@@ -590,6 +608,7 @@ Blockly.Blocks['type_boolean'] = { ...@@ -590,6 +608,7 @@ Blockly.Blocks['type_boolean'] = {
.appendField('boolean'); .appendField('boolean');
this.setOutput(true, 'Type'); this.setOutput(true, 'Type');
this.setTooltip('Booleans (true/false) are allowed.'); this.setTooltip('Booleans (true/false) are allowed.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602');
} }
}; };
...@@ -602,6 +621,7 @@ Blockly.Blocks['type_number'] = { ...@@ -602,6 +621,7 @@ Blockly.Blocks['type_number'] = {
.appendField('number'); .appendField('number');
this.setOutput(true, 'Type'); this.setOutput(true, 'Type');
this.setTooltip('Numbers (int/float) are allowed.'); this.setTooltip('Numbers (int/float) are allowed.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602');
} }
}; };
...@@ -614,6 +634,7 @@ Blockly.Blocks['type_string'] = { ...@@ -614,6 +634,7 @@ Blockly.Blocks['type_string'] = {
.appendField('string'); .appendField('string');
this.setOutput(true, 'Type'); this.setOutput(true, 'Type');
this.setTooltip('Strings (text) are allowed.'); this.setTooltip('Strings (text) are allowed.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602');
} }
}; };
...@@ -626,6 +647,7 @@ Blockly.Blocks['type_list'] = { ...@@ -626,6 +647,7 @@ Blockly.Blocks['type_list'] = {
.appendField('list'); .appendField('list');
this.setOutput(true, 'Type'); this.setOutput(true, 'Type');
this.setTooltip('Arrays (lists) are allowed.'); this.setTooltip('Arrays (lists) are allowed.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=602');
} }
}; };
...@@ -638,6 +660,7 @@ Blockly.Blocks['type_other'] = { ...@@ -638,6 +660,7 @@ Blockly.Blocks['type_other'] = {
.appendField(new Blockly.FieldTextInput(''), 'TYPE'); .appendField(new Blockly.FieldTextInput(''), 'TYPE');
this.setOutput(true, 'Type'); this.setOutput(true, 'Type');
this.setTooltip('Custom type to allow.'); this.setTooltip('Custom type to allow.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=702');
} }
}; };
...@@ -649,6 +672,7 @@ Blockly.Blocks['colour_hue'] = { ...@@ -649,6 +672,7 @@ Blockly.Blocks['colour_hue'] = {
.appendField(new Blockly.FieldAngle('0', this.validator), 'HUE'); .appendField(new Blockly.FieldAngle('0', this.validator), 'HUE');
this.setOutput(true, 'Colour'); this.setOutput(true, 'Colour');
this.setTooltip('Paint the block with this colour.'); this.setTooltip('Paint the block with this colour.');
this.setHelpUrl('https://www.youtube.com/watch?v=s2_xaEvcVI0#t=55');
}, },
validator: function(text) { validator: function(text) {
// Update the current block's colour to match. // Update the current block's colour to match.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment