Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/try_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ def update_screen(item)
step = item.step.to_s
$document.at_css("#tryruby-index").value = step

# Disable the buttons that have no step to go to
$document.at_css('#btn_back').disabled = !@items.has_key?(item.step - 1)
$document.at_css('#btn_next').disabled = !@items.has_key?(item.step + 1)

# Set session cookie to store progress
set_cookie('tryruby_step', step)

Expand Down
10 changes: 7 additions & 3 deletions source/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,13 @@ h3 {
.btn-primary {
border-radius: 1rem;
font-family: sans-serif;
color: var(--button-primary-text-color);
background-color: var(--button-primary-color);
border-color: var(--button-primary-color);

&,
&:disabled {
color: var(--button-primary-text-color);
background-color: var(--button-primary-color);
border-color: var(--button-primary-color);
}

&:focus,
&:focus:not(:focus-visible),
Expand Down
2 changes: 2 additions & 0 deletions spec/tutorial_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
special = steps[step] || {}

find(:css, "h1").text.should be == data["title"]
page.should have_button("Back", disabled: step == 1)
page.should have_button("Next", disabled: step == 56)

unless special[:pass]
case special[:code]
Expand Down
Loading