-
-
Notifications
You must be signed in to change notification settings - Fork 4
Make all IDs more semantic #32
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
base: main
Are you sure you want to change the base?
Conversation
For starter code, the IDs try to be good examples for how to name elements. For example values as block parameters, the IDs try to be relevant to _some_ example, but not necessarily the first example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of modifying the code in blockly-dom.js (which should probably also have better - but more generic - names), we should modify the starter xml in each of the toolboxes in index.html (and the generic starter xml at the end of the file)
@@ -436,7 +436,7 @@ <h2>Buttons and clicks: A button to add apples</h2> | |||
<ol> | |||
<li>Start with an empty unordered html list (<code><ul></code>) and a button to add apples to the list (<code><button></code>) in the static html. | |||
<ol> | |||
<li>for example: <code class="start_code"><ul id="list"></ul><br><button id="button">add an apple</button></code></li> | |||
<li>for example: <code class="start_code"><ul id="fruits"></ul><br><button id="add-apple-button">add an apple</button></code></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are dashed ids a good practice (I know classnames are often dashed)? I would probably underscore them, to avoid teaching identifiers with - in them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a super strong preference - I started dashing somewhat at random, so changed a few _s to -s because I'd done most of them, but happy to change them all to _s if you'd prefer :)
@@ -1290,7 +1290,7 @@ <h2>Project: Don't go higher than 11!</h2> | |||
<p>We are now going to use all the array blocks we have learned about. We're going to create a game where you roll dice and your goal is to not total more than 11. | |||
</p> | |||
<ol> | |||
<li>Start with an empty list (where we will display our rolls), a place to put a total, and a few buttons (<code class="start_code"><p>So far you have rolled:</p><br><ul id="list"></ul><br><button id="button_roll">Roll the dice</button><br><p>Total: <span id="total">0</span>. <span id="info">Keep playing!</span></p><br><button id="button_remove">Remove the last roll</button><br><button id="button_restart">Start again</button></code></li> | |||
<li>Start with an empty list (where we will display our rolls), a place to put a total, and a few buttons (<code class="start_code"><p>So far you have rolled:</p><br><ul id="previous-rolls"></ul><br><button id="roll-button">Roll the dice</button><br><p>Total: <span id="total">0</span>. <span id="info">Keep playing!</span></p><br><button id="remove-roll-button">Remove the last roll</button><br><button id="restart-button">Start again</button></code></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty sure all these ids are referred to later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't see any... Do you see any specifically?
Also woop, you picked up a ticket!!!!! |
huh. I googled and I learnt something about hyphenated ids and why :) |
Things are looking about right in the rendered UI for me... What's the purpose of blockly-dom.js vs the stuff in index.html? |
So blockly-dom is intended as a standalone thing, useful beyond CYF - I think it should have boring generic variable names by default (/be improved to have cleverer variable names), especially as we can write the variables in the custom toolboxes (and even have different default variable names per exercise) For the rest of the change, unfortunately, probably better wait til we've moved to .md files and then port |
For starter code, the IDs try to be good examples for how to name
elements.
For example values as block parameters, the IDs try to be relevant to
some example, but not necessarily the first example.
Fixes #26.