-
Notifications
You must be signed in to change notification settings - Fork 7
Lesson 1: small changes #23
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7b5284a
Update setup script
stefannibrasil 42af5d0
Remove social media links
stefannibrasil 04fe6c3
Docs updates
stefannibrasil 5fd20bb
Use a newer version of checkout
stefannibrasil 088b39f
Mount good_jobs UI
stefannibrasil 001b659
Bump actions/upload-artifact version
stefannibrasil b3ed538
Skip vips check on CI
stefannibrasil a26ba07
Lesson 1: small updates
stefannibrasil 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,5 +1,6 @@ | ||
| #!/usr/bin/env ruby | ||
| require "fileutils" | ||
| require 'mkmf' | ||
|
|
||
| # path to your application root. | ||
| APP_ROOT = File.expand_path("..", __dir__) | ||
|
|
@@ -13,24 +14,23 @@ FileUtils.chdir APP_ROOT do | |
| # This script is idempotent, so that you can run it at any time and get an expectable outcome. | ||
| # Add necessary setup steps to this file. | ||
|
|
||
| vips = MakeMakefile.find_executable('vips') | ||
| if !vips && !ENV["CI"] | ||
| puts "VIPS is not installed.\n" | ||
| printf "See https://www.libvips.org/install.html for install instructions.\n" | ||
| exit 1 | ||
| end | ||
|
|
||
| puts "== Installing dependencies ==" | ||
| system! "gem install bundler --conservative" | ||
| system("bundle check") || system!("bundle install") | ||
|
|
||
| # puts "\n== Copying sample files ==" | ||
| # unless File.exist?("config/database.yml") | ||
| # FileUtils.cp "config/database.yml.sample", "config/database.yml" | ||
| # end | ||
|
|
||
| puts "\n== Installing Tutorial Assistant ==" | ||
| FileUtils.remove_dir("ta", force: true) if Dir.exist?("ta") | ||
| system! "git clone [email protected]:thoughtbot/tutorial-assistant.git ta/ > /dev/null 2>&1 || true" | ||
| system("bundle check") || system!("bundle install") | ||
|
|
||
| puts "\n== Preparing database ==" | ||
| system! "bin/rails db:prepare" | ||
|
|
||
| unless ENV["CI"] | ||
| puts "\n== Seeding database ==" | ||
| puts "\n== Seeding database. It might take a few minutes... ==" | ||
| system! "bin/rails db:seed" | ||
| end | ||
|
|
||
|
|
@@ -43,3 +43,8 @@ FileUtils.chdir APP_ROOT do | |
| puts "\n== Restarting application server ==" | ||
| system! "bin/rails restart" | ||
| end | ||
|
|
||
| at_exit do | ||
| File.delete('mkmf.log') if File.exist?('mkmf.log') | ||
| puts "\nFinished setting up" | ||
| end | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -56,10 +56,10 @@ Now we can build the controller. | |
|
|
||
| ```js | ||
| // app/javascript/controllers/hotkey_controller.js | ||
| import ApplicationController from "controllers/application_controller" | ||
| import { Controller } from '@hotwired/stimulus' | ||
| import { install, uninstall } from "@github/hotkey" | ||
|
|
||
| export default class extends ApplicationController { | ||
| export default class extends Controller { | ||
| static targets = ["shortcut"] | ||
|
|
||
| shortcutTargetConnected(target) { | ||
|
|
@@ -83,7 +83,7 @@ Anytime an element with a `data-hotkey-target="shortcut"` data attribute appears | |
| on the page, this controller will enable that element to be accessed via the | ||
| hotkey. Additionally, we add a `aria-keyshortcuts` attribute to the element and | ||
| set the value to whatever the `hotkey` attribute is. In this case, that's | ||
| "Meta+k". We do this in an effort to exposes the existence of the shortcut to | ||
| "Meta+k". We do this in an effort to expose the existence of the shortcut to | ||
| assistive technologies so the presence of the shortcut can be communicated to | ||
| its users. | ||
|
|
||
|
|
@@ -133,6 +133,16 @@ anchor link. The [@github/hotkey][] library works by triggering a focus event on | |
| form fields, or a click event on other elements. In this case, hitting `Meta+k` | ||
| will automatically click the link to the search page. | ||
|
|
||
| ### Check in | ||
|
|
||
| To complete this lesson: | ||
|
|
||
| - run `./bin/rails test` to verify the tests pass | ||
| - press ⌘ k anywhere in the episodes list page to verify the search shortcut works as expected | ||
| note: using `Control` instead of ⌘ should work as well for non-Mac users | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this based on github/hotkey#66 However, I have not tested in a non-Mac machine. I guess we can leave this and ask someone later to try it? |
||
|
|
||
| When you're ready, move on to the next lesson by running `./ta/start-lesson 2`. | ||
|
|
||
| [javascript_importmap_tags]: https://github.com/rails/importmap-rails#preloading-pinned-modules | ||
| [importmap]: https://github.com/WICG/import-maps | ||
| [@github/hotkey]: https://github.com/github/hotkey | ||
|
|
||
This file contains hidden or 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 still don't know why this was needed. In lesson 2, this controllers inherits from ApplicationController and it works 🤔
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.
Were you following the existing guidance in the lesson plan by running
./ta/start-lesson 1and then attempting to get tests to pass? Did you create an emptyapp/javascript/controllers/application_controller.jsfile?I think the short answer is that since we plan on moving away from Tutorial Assistant for this initial release, this shouldn't matter.
Instead, I think we need to work on our messaging and setup instructions to demonstrate how the app is built up from a Turbo-less Rails app.
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 did follow the lesson plan but did not create an empty controller file. I've added the message about the turbo-less state in the first PR 👍🏼
A follow up question: without the teaching assistant, are you planning on removing the solutions from
main?