-
Notifications
You must be signed in to change notification settings - Fork 14
Integrating Playbook Kits into Nitro Components
If you are looking to create a Runway Ticket to cover Ninja testing in Nitro, look here!
Note: Playbook should only be added to Nitro through NitroTheme. This way we will only have to update the version in one place.
Update playbook to latest stable version in nitro_theme.gemspec
# components/nitro_theme/nitro_theme.gemspec
s.add_dependency "playbook_ui", "2.9.5"
Check to be sure the styles for Playbook kits are imported into NitroTheme application.scss
/* components/nitro_theme/app/assets/stylesheets/nitro_theme/application.scss */
@import "playbook";
Note: This script supports alpha Playbook versions as well by auto-detection!
./upgrade_playbook_ui -v [VERSION_NUMBER_HERE]
Within your Nitro Component, add the following lines to the application_controller.rb
These lines give your component access to use Playbook Helpers such as pb_rails()
which renders the Playbook kit, as well as the ability to find kit partials within the Playbook gem.
# components/YOUR_COMPONENT_NAME/app/controllers/application_controller.rb
helper Playbook::PbKitHelper
In your nitro component, in a view add a test kit to make sure Playbook is integrated correctly.
# components/YOUR_COMPONENT_NAME/app/views/.../index.html
<%= pb_rails("title", props: { text: "HELLO!!!!" }) %>