Update wording
"label" is more suitable here than "caption"
This commit is contained in:
parent
1d980ac956
commit
c64ed78a53
@ -5,7 +5,7 @@
|
||||
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
||||
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :active, checked: f.object.active) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::AdjustmentReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::AdjustmentReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.active")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
||||
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :active, checked: f.object.active) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::AdjustmentReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::AdjustmentReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.active")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -37,7 +37,7 @@
|
||||
method: use_attribute,
|
||||
checked: @address == (@type == 'ship' ? @order.bill_address : @order.ship_address)
|
||||
) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: t(".use_this_address.#{@type}"), size: :xs) %>
|
||||
<%= checkbox.with_label(text: t(".use_this_address.#{@type}"), size: :xs) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -118,7 +118,7 @@
|
||||
value: f.object.discontinue_on&.to_date
|
||||
) %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :promotionable, checked: f.object.promotionable) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::Product.human_attribute_name(:promotionable), size: :xs) %>
|
||||
<%= checkbox.with_label(text: Spree::Product.human_attribute_name(:promotionable), size: :xs) %>
|
||||
<%= checkbox.with_hint(text: t(".hints.promotionable_html")) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
||||
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :active, checked: f.object.active) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::RefundReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::RefundReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.active")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
||||
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :active, checked: f.object.active) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::RefundReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::RefundReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.active")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="flex flex-col gap-6 pb-4">
|
||||
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :active, checked: f.object.active) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::ReturnReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::ReturnReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.active")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="flex flex-col gap-6 pb-4">
|
||||
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :active, checked: f.object.active) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::ReturnReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::ReturnReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.active")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="flex flex-col gap-6 pb-4">
|
||||
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :active, checked: f.object.active) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::StoreCreditReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::StoreCreditReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.active")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="flex flex-col gap-6 pb-4">
|
||||
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :active, checked: f.object.active) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::StoreCreditReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::StoreCreditReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.active")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<%= render component("ui/forms/field").text_field(f, :tax_code) %>
|
||||
<%= render component("ui/forms/field").text_field(f, :description) %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :is_default, checked: f.object.is_default) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::TaxCategory.human_attribute_name(:is_default), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::TaxCategory.human_attribute_name(:is_default), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.is_default")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<%= render component("ui/forms/field").text_field(f, :tax_code) %>
|
||||
<%= render component("ui/forms/field").text_field(f, :description) %>
|
||||
<%= render component("ui/forms/checkbox").new(object_name: f.object_name, method: :is_default, checked: f.object.is_default) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: Spree::TaxCategory.human_attribute_name(:is_default), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_label(text: Spree::TaxCategory.human_attribute_name(:is_default), weight: :semibold, size: :xs, classes: 'ml-2') %>
|
||||
<%= checkbox.with_hint(text: t(".hints.is_default")) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -7,7 +7,7 @@
|
||||
checked: @checked,
|
||||
**@attributes
|
||||
) %>
|
||||
<%= caption %>
|
||||
<%= label %>
|
||||
</label>
|
||||
|
||||
<%= hint if hint? %>
|
||||
|
@ -11,7 +11,7 @@ class SolidusAdmin::UI::Forms::Checkbox::Component < SolidusAdmin::BaseComponent
|
||||
s: 'text-sm',
|
||||
}.freeze
|
||||
|
||||
renders_one :caption, ->(text:, weight: :normal, size: :s, **options) do
|
||||
renders_one :label, ->(text:, weight: :normal, size: :s, **options) do
|
||||
tag.span(
|
||||
text,
|
||||
class: "
|
||||
|
@ -7,7 +7,7 @@ class SolidusAdmin::UI::Forms::Checkbox::ComponentPreview < ViewComponent::Previ
|
||||
# Forms checkbox component utilises regular checkbox component and encapsulates some functionality
|
||||
# that is shared between admin forms checkboxes:
|
||||
# - adds `hidden_field_tag` to function properly
|
||||
# - provides a way to customise label caption (font size/weight, custom styles)
|
||||
# - provides a way to customise label (font size/weight, custom styles)
|
||||
# - optionally include a toggletip hint
|
||||
#
|
||||
# Requires `object_name` and `method` parameters that will form a name of the hidden input and checkbox input fields.
|
||||
@ -18,7 +18,7 @@ class SolidusAdmin::UI::Forms::Checkbox::ComponentPreview < ViewComponent::Previ
|
||||
#
|
||||
# ```erb
|
||||
# <%= render component('ui/forms/checkbox').new(object_name: 'stock_location', method: :default, checked: true) do |checkbox| %>
|
||||
# <%= checkbox.with_caption(text: "Default") %>
|
||||
# <%= checkbox.with_label(text: "Default") %>
|
||||
# <%= checkbox.with_hint(text: "Will be used by default") %>
|
||||
# <% end %>
|
||||
# ```
|
||||
@ -35,7 +35,7 @@ class SolidusAdmin::UI::Forms::Checkbox::ComponentPreview < ViewComponent::Previ
|
||||
# @param hint_position select { choices: [above, below] }
|
||||
def playground(caption_size: :s, caption_weight: :normal, caption_classes: '', hint: true, hint_text: "This will be helpful", hint_position: :above)
|
||||
render current_component.new(object_name: "store", method: :active, checked: true) do |component|
|
||||
component.with_caption(text: "Active", size: caption_size, weight: caption_weight, classes: caption_classes)
|
||||
component.with_label(text: "Active", size: caption_size, weight: caption_weight, classes: caption_classes)
|
||||
component.with_hint(text: hint_text, position: hint_position) if hint
|
||||
end
|
||||
end
|
||||
|
@ -2,53 +2,53 @@
|
||||
<div class="flex flex-col">
|
||||
<div class="mb-8">
|
||||
<h6 class="text-gray-500 mb-3 mt-0">
|
||||
Regular caption
|
||||
Regular label
|
||||
</h6>
|
||||
<%= render current_component.new(object_name: 'store', method: :active, checked: true) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: 'Active') %>
|
||||
<%= checkbox.with_label(text: 'Active') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="mb-8">
|
||||
<h6 class="text-gray-500 mb-3 mt-0">
|
||||
Smaller caption
|
||||
Smaller label
|
||||
</h6>
|
||||
<%= render current_component.new(object_name: 'store', method: :active, checked: true) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: 'Active', size: :xs) %>
|
||||
<%= checkbox.with_label(text: 'Active', size: :xs) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="mb-8">
|
||||
<h6 class="text-gray-500 mb-3 mt-0">
|
||||
Semibold caption
|
||||
Semibold label
|
||||
</h6>
|
||||
<%= render current_component.new(object_name: 'store', method: :active, checked: true) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: 'Active', weight: :semibold) %>
|
||||
<%= checkbox.with_label(text: 'Active', weight: :semibold) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<div class="mb-8">
|
||||
<h6 class="text-gray-500 mb-3 mt-0">
|
||||
Caption with custom styles applied
|
||||
Label with custom styles applied
|
||||
</h6>
|
||||
<%= render current_component.new(object_name: 'store', method: :active, checked: true) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: 'Active', classes: 'text-gray-500') %>
|
||||
<%= checkbox.with_label(text: 'Active', classes: 'text-gray-500') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="mb-8">
|
||||
<h6 class="text-gray-500 mb-3 mt-0">
|
||||
With caption and hint above
|
||||
With label and hint above
|
||||
</h6>
|
||||
<%= render current_component.new(object_name: 'store', method: :active, checked: true) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: 'Active') %>
|
||||
<%= checkbox.with_label(text: 'Active') %>
|
||||
<%= checkbox.with_hint(text: 'This means something') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="mb-8">
|
||||
<h6 class="text-gray-500 mb-3 mt-0">
|
||||
With caption and hint below
|
||||
With label and hint below
|
||||
</h6>
|
||||
<%= render current_component.new(object_name: 'store', method: :active, checked: true) do |checkbox| %>
|
||||
<%= checkbox.with_caption(text: 'Active') %>
|
||||
<%= checkbox.with_label(text: 'Active') %>
|
||||
<%= checkbox.with_hint(text: 'This means something', position: :below) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user