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

Evan buzzfeed quiz edits #30

Merged
merged 17 commits into from
Dec 10, 2020
Merged

Evan buzzfeed quiz edits #30

merged 17 commits into from
Dec 10, 2020

Conversation

evanzhong
Copy link
Member

Bunch of changes in preparation for project walkthrough with the kids.

Main focuses

  • Encapsulate as much jQuery code as possible into helper functions with appropriate (English readable) function signatures
    • Part of the lesson will focus on the power of modularization and encapsulation as a tool to reduce complexity
  • Descriptive (English readable) variable names
  • Reduce the number of lines in script.js to make reading it less overwhelming for students
  • Refresh / Introduce dictionaries

Minor focuses

  • Whitespace and formatting changes
  • Readiness for codepen

Comment on lines +54 to +55
<!-- Magic things that make the quiz work behind the scenes! -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
Copy link
Member Author

Choose a reason for hiding this comment

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

We need to include this so when students copy our codepen the appropriate jQuery libraries are linked

Comment on lines +5 to +10
'Q1': {'a':1,'b':2,'c':3,'d':4},
'Q2': {'a':2,'b':3,'c':4,'d':1},
'Q3': {'a':2,'b':4,'c':1,'d':3},
'Q4': {'a':3,'b':1,'c':2,'d':4},
'Q5': {'a':1,'b':2,'c':3,'d':4},
'Q6': {'a':1,'b':2,'c':3,'d':4}
Copy link
Member Author

Choose a reason for hiding this comment

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

I opted to change the top level keys here to strings 1 => Q1

It reduces some ambiguity and thus makes describing the different levels in our nested dictionary a little easier.

this.init = function(){
self._bindEvents();
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this function and just placed the code directly in the init function

@@ -41,7 +41,7 @@ body {
margin-right:10px;
}

&.active {
&.chosen {
Copy link
Member Author

Choose a reason for hiding this comment

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

Minor renaming, makes certain lines read more like English such as:

let chosenAnswer = $(question).find('.quiz-answer.chosen').data('quiz-answer')

@chasekap
Copy link
Contributor

Awesome work!

@chasekap chasekap merged commit 1581ca4 into master Dec 10, 2020
@chasekap chasekap deleted the evan-buzzfeed-quiz-edits branch December 10, 2020 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants