-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Implement a quiz-style installation instructions #11399
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8baf2e8
docs: better installation style
dinever 55a0b17
remove ARMv7 deb and rpm installation since the link is not available…
dinever 0b350ae
changed attribute names
dinever 563abdf
fix typo
dinever 28915b0
Upgrade Hugo version in Netlify
dinever cc0d065
auto-select the first option for each row
dinever ed78279
update hugo version to 0.83.1
dinever a7d8a06
reuse getUserOS from tabs.js
dinever d50e861
wrap the installation section into a blue card
dinever 120925e
revert changes in release_build_and_upload.sh
dinever d29d0a8
make sure web page renders acceptable result when JS is disabled
dinever File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<!-- start: minikube override body-end partial --> | ||
<script language="javascript">initTabs();</script> | ||
<script language="javascript">initQuiz();</script> | ||
<!-- end: minikube override body-end partial --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div class="card"><div class="card-body card-body-blue">{{ .Inner }}</div></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<button data-quiz-id="{{ .Parent.Get "base" }}/{{ .Get "option" }}" type="button" class="btn btn-outline-primary option-button">{{ .Get "option" }}</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{ $id := .Get "id" }} | ||
{{ $selected := split $id "/" }} | ||
|
||
{{ $os := index $selected 1 }} | ||
{{ $arch := index $selected 2 }} | ||
{{ $installer := index $selected 3 }} | ||
|
||
<div data-quiz-id="{{ with .Get "id"}}{{.}}{{end}}" class="quiz-instruction"> | ||
<p>To install minikube on <b>{{ $arch }}</b> <b>{{ $os }}</b> using <b>{{ replace $installer "Binary" "binary" }}</b>:</p> | ||
{{ .Inner }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{ $level := .Get "base" | strings.Count "/" }} | ||
|
||
<div data-quiz-id="{{ .Get "base" }}" data-level="{{ $level }}" class="row option-row hide"> | ||
<div class="col-lg-2 my-auto"> | ||
<p>{{ with .Get "name"}}{{.}}{{end}}</p> | ||
</div> | ||
<div class="col-lg-10">{{ .Inner }}</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
function selectQuizOption(selectedId) { | ||
const currentLevel = selectedId.split('/').length - 1; | ||
$('.option-row').each(function (i) { | ||
const rowId = $(this).attr('data-quiz-id'); | ||
// don't hide option rows if it has a lower level | ||
// e.g. when clicking "x86_64" under Linux, we don't want to hide the operating system row | ||
if ($(this).attr('data-level') < currentLevel) { | ||
return; | ||
} | ||
if (rowId === selectedId) { | ||
$(this).removeClass('hide'); | ||
$(this).find('.option-button').removeClass('active'); | ||
return; | ||
} | ||
// hide all other option rows | ||
$(this).addClass('hide'); | ||
}); | ||
// hide other answers | ||
$('.quiz-instruction').addClass('hide'); | ||
// show the selected answer | ||
$('.quiz-instruction[data-quiz-id=\'' + selectedId + '\']').removeClass('hide'); | ||
|
||
const buttons = $('.option-row[data-quiz-id=\'' + selectedId + '\']').find('.option-button'); | ||
// auto-select the first option for the user, to reduce the number of clicks | ||
if (buttons.length > 0) { | ||
const btn = buttons.first(); | ||
btn.addClass('active'); | ||
selectQuizOption(btn.attr('data-quiz-id')); | ||
} | ||
} | ||
|
||
function initQuiz() { | ||
try { | ||
$('.option-button').click(function(e) { | ||
$(this).parent().find('.option-button').removeClass('active'); | ||
$(this).addClass('active'); | ||
const dataContainerId = $(this).attr('data-quiz-id'); | ||
|
||
selectQuizOption(dataContainerId); | ||
}); | ||
let userOS = getUserOS(); | ||
if (userOS === 'Mac') { | ||
// use the name "macOS" to match the button | ||
userOS = 'macOS'; | ||
} | ||
$('.option-row[data-level=0]').removeClass('hide'); | ||
// auto-select the OS for user | ||
const btn = $('.option-button[data-quiz-id=\'/' + userOS + '\']').first(); | ||
btn.addClass('active'); | ||
selectQuizOption(btn.attr('data-quiz-id')); | ||
} catch(e) { | ||
const elements = document.getElementsByClassName("quiz-instruction"); | ||
for (let element of elements) { | ||
element.classList.remove("hide"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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 don't think this
primary
color is actually used anywhere, and it's orange. So I changed it to our theme color which is the k8s blue.