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
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
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 is a thin wrapper of the Simple Form builder. It delegates rendering the resulting form fields to Simple Form | |
# but typically amends the Tailwind classes of the various elements in the field layout. It tightly integrates with the | |
# unstyled wrapper (aka `:plain`) Simple Form configuration (see `simple_form.rb`). The methods support the same syntax | |
# as the original Simple Form methods but enhance it to support replacing defaylt Tailwind claseses. | |
class Builders::TailwindFormBuilder < SimpleForm::FormBuilder | |
# This is the basic method for rendering `<input>` tags and their variants. | |
def input(attribute_name, options = {}, &block) | |
# The default Tailwind classes for the various parts of the Simple Form wrapper layout. | |
input_class = "block w-full sm:text-sm ... #{'text-gray-500 bg-gray-50' if options.dig(:input_html, :disabled)}" |