diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_about_field_partials.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_about_field_partials.erb new file mode 100644 index 000000000..f97d93e30 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_about_field_partials.erb @@ -0,0 +1,23 @@ +<% showcase.description do %> + When you're building forms, use Bullet Train's Field Partials for your form fields. They DRY-up all the presentation logic without needing a third-party dependency like Formtastic. +
+
+ Read much more about them in the extensive developer documentation. +<% end %> + +<% form_with model: Scaffolding::CompletelyConcrete::TangibleThing.new, url: "#" do |form| %> + <% yield form %> +<% end %> + +<%# To display further options use `showcase.options.x` as options with a block will clear the old options. See `_options.html.erb` for an example. %> +<% showcase.options do |o| %> + <% o.required :form, "Reference to the form object", type: "ActionView::Helpers::FormBuilder" %> + <% o.required :method, "Attribute of the model" %> + <% o.optional :options, "Options passed directly to the underlying Rails form field helper.", default: {} %> + <% o.optional :other_options, "Additional options for things like hiding labels, displaying specific error messages, etc.", default: {} %> + <% o.optional "other_options[:icon]", "Display an icon." %> + <% o.optional "other_options[:label]", "Display a specific field label." %> + <% o.optional "other_options[:hide_label]", "Hide the field label.", default: false %> + <% o.optional "other_options[:help]", "Display a specific help string." %> + <% o.optional "other_options[:error]", "Display a specific error string." %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_buttons.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_buttons.html.erb new file mode 100644 index 000000000..8c17058b0 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_buttons.html.erb @@ -0,0 +1,13 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Single Basic Button" do %> + <%= render "shared/fields/buttons", form: form, method: :button_value %> + <% end %> + + <% showcase.sample "Multiple Buttons" do %> + <%= render "shared/fields/buttons", form: form, method: :multiple_button_values, multiple: true %> + <% end %> + + <% showcase.sample "Boolean Button" do %> + <%= render "shared/fields/buttons", form: form, method: :boolean_button_value %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_cloudinary_image.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_cloudinary_image.html.erb new file mode 100644 index 000000000..919b6cc98 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_cloudinary_image.html.erb @@ -0,0 +1,6 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic", description: "Requires an `ENV['CLOUDINARY_URL']` is set to render anything." do %> + <%= "ENV['CLOUDINARY_URL'] hasn't been set." unless cloudinary_enabled? %> + <%= render 'shared/fields/cloudinary_image', form: form, method: :cloudinary_image_value %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_color_picker.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_color_picker.html.erb new file mode 100644 index 000000000..8933a1600 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_color_picker.html.erb @@ -0,0 +1,7 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/color_picker', form: form, + method: :color_picker_value, + options: {color_picker_options: t('scaffolding/completely_concrete/tangible_things.fields.color_picker_value.options')} %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_date_and_time_field.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_date_and_time_field.html.erb new file mode 100644 index 000000000..233c0dcb4 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_date_and_time_field.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/date_and_time_field', form: form, method: :created_at %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_date_field.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_date_field.html.erb new file mode 100644 index 000000000..de95d6618 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_date_field.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/date_field', form: form, method: :created_at %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_email_field.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_email_field.html.erb new file mode 100644 index 000000000..6de9b5a85 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_email_field.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/email_field', form: form, method: :email_field_value %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_emoji_field.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_emoji_field.html.erb new file mode 100644 index 000000000..0626274e9 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_emoji_field.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/emoji_field', form: form, method: :text_field_value %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_file_field.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_file_field.html.erb new file mode 100644 index 000000000..005ae1b76 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_file_field.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/file_field', form: form, method: :file_field_value %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_number_field.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_number_field.html.erb new file mode 100644 index 000000000..bf6a61f39 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_number_field.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/number_field', form: form, method: :number_field_value %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_options.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_options.html.erb new file mode 100644 index 000000000..92bf0b76a --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_options.html.erb @@ -0,0 +1,13 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Single Option" do %> + <%= render 'shared/fields/options', form: form, method: :option_value %> + <% end %> + + <% showcase.sample "Multiple Option" do %> + <%= render 'shared/fields/options', form: form, method: :multiple_option_values, multiple: true, show_select_all_top: true %> + <% end %> +<% end %> + +<% showcase.options.optional :multiple, "Whether to select single or multiple values", default: false %> +<% showcase.options.optional :show_select_all_top, "Whether to put the select all toggle before the options", default: false %> +<% showcase.options.optional :show_select_all_bottom, "Whether to put the select all toggle after the options", default: false %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_password_field.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_password_field.html.erb new file mode 100644 index 000000000..5cf42fc29 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_password_field.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/password_field', form: form, method: :password_field_value %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_phone_field.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_phone_field.html.erb new file mode 100644 index 000000000..eb7a724d5 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_phone_field.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/phone_field', form: form, method: :phone_field_value %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_super_select.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_super_select.html.erb new file mode 100644 index 000000000..572b5b1a1 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_super_select.html.erb @@ -0,0 +1,9 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Single Select" do %> + <%= render 'shared/fields/super_select', form: form, method: :super_select_value, other_options: {search: true} %> + <% end %> + + <% showcase.sample "Multiple Select" do %> + <%= render 'shared/fields/super_select', form: form, method: :multiple_super_select_values, other_options: {search: true}, html_options: {multiple: true} %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_text_area.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_text_area.html.erb new file mode 100644 index 000000000..1be41a130 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_text_area.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/text_area', form: form, method: :text_area_value %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_text_field.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_text_field.html.erb new file mode 100644 index 000000000..e82acf39d --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_text_field.html.erb @@ -0,0 +1,10 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/text_field', form: form, method: :text_field_value %> + <% end %> + + <% showcase.sample "With Icon" do %> + <%= render 'shared/fields/text_field', form: form, icon: 'Test', method: :text_field_value, + other_options: { label: 'New Label', hide_label: true, help: 'I am help text', error: "Error Text", icon: 'fal fa-sign-out ti ti-close' } %> + <% end %> +<% end %> diff --git a/bullet_train-themes-light/app/views/showcase/previews/field_partials/_trix_editor.html.erb b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_trix_editor.html.erb new file mode 100644 index 000000000..eca993701 --- /dev/null +++ b/bullet_train-themes-light/app/views/showcase/previews/field_partials/_trix_editor.html.erb @@ -0,0 +1,5 @@ +<%= render "showcase/previews/field_partials/about_field_partials", showcase: showcase do |form| %> + <% showcase.sample "Basic" do %> + <%= render 'shared/fields/trix_editor', form: form, method: :trix_editor_value %> + <% end %> +<% end %>