Skip to content

Commit 32c2509

Browse files
committed
Put checkbox label and hint definition in builder
1 parent b53cf5b commit 32c2509

File tree

14 files changed

+36
-50
lines changed

14 files changed

+36
-50
lines changed

admin/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
<div class="flex flex-col gap-6 pb-4">
55
<%= f.text_field(:name, class: "required") %>
66
<%= f.text_field(:code, class: "required") %>
7-
<%= f.checkbox(:active) do |checkbox| %>
8-
<%= checkbox.with_label(text: Spree::AdjustmentReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
9-
<%= checkbox.with_hint(text: t(".hints.active")) %>
10-
<% end %>
7+
<%= f.checkbox(:active, hint: t(".hints.active")) %>
118
</div>
129
<% modal.with_actions do %>
1310
<form method="dialog">

admin/app/components/solidus_admin/adjustment_reasons/new/component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
<div class="flex flex-col gap-6 pb-4">
55
<%= f.text_field(:name, class: "required") %>
66
<%= f.text_field(:code, class: "required") %>
7-
<%= f.checkbox(:active) do |checkbox| %>
8-
<%= checkbox.with_label(text: Spree::AdjustmentReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
9-
<%= checkbox.with_hint(text: t(".hints.active")) %>
10-
<% end %>
7+
<%= f.checkbox(:active, hint: t(".hints.active")) %>
118
</div>
129
<% modal.with_actions do %>
1310
<form method="dialog">

admin/app/components/solidus_admin/orders/show/address/component.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
</div>
3434

3535
<%= form.checkbox(use_attribute,
36-
checked: @address == (@type == 'ship' ? @order.bill_address : @order.ship_address)
37-
) do |checkbox| %>
38-
<%= checkbox.with_label(text: t(".use_this_address.#{@type}"), size: :xs) %>
39-
<% end %>
36+
checked: @address == (@type == 'ship' ? @order.bill_address : @order.ship_address),
37+
label: t(".use_this_address.#{@type}"),
38+
label_options: { size: :xs })
39+
%>
4040
</div>
4141
<% end %>
4242

admin/app/components/solidus_admin/products/show/component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@
102102
type: :date,
103103
value: f.object.discontinue_on&.to_date
104104
) %>
105-
<%= f.checkbox(:promotionable) do |checkbox| %>
106-
<%= checkbox.with_label(text: Spree::Product.human_attribute_name(:promotionable), size: :xs) %>
107-
<%= checkbox.with_hint(text: t(".hints.promotionable_html")) %>
108-
<% end %>
105+
<%= f.checkbox(:promotionable, hint: t(".hints.promotionable_html")) %>
109106
<% end %>
110107

111108
<%= render component("ui/panel").new(title: t(".product_organization")) do %>

admin/app/components/solidus_admin/refund_reasons/edit/component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
<div class="flex flex-col gap-6 pb-4">
55
<%= f.text_field(:name, class: "required") %>
66
<%= f.text_field(:code, class: "required") %>
7-
<%= f.checkbox(:active) do |checkbox| %>
8-
<%= checkbox.with_label(text: Spree::RefundReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
9-
<%= checkbox.with_hint(text: t(".hints.active")) %>
10-
<% end %>
7+
<%= f.checkbox(:active, hint: t(".hints.active")) %>
118
</div>
129
<% modal.with_actions do %>
1310
<form method="dialog">

admin/app/components/solidus_admin/refund_reasons/new/component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
<div class="flex flex-col gap-6 pb-4">
55
<%= f.text_field(:name, class: "required") %>
66
<%= f.text_field(:code, class: "required") %>
7-
<%= f.checkbox(:active) do |checkbox| %>
8-
<%= checkbox.with_label(text: Spree::RefundReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
9-
<%= checkbox.with_hint(text: t(".hints.active")) %>
10-
<% end %>
7+
<%= f.checkbox(:active, hint: t(".hints.active")) %>
118
</div>
129
<% modal.with_actions do %>
1310
<form method="dialog">

admin/app/components/solidus_admin/return_reasons/edit/component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
<%= solidus_form_for @return_reason, url: form_url, html: { id: form_id } do |f| %>
44
<div class="flex flex-col gap-6 pb-4">
55
<%= f.text_field(:name, class: "required") %>
6-
<%= f.checkbox(:active) do |checkbox| %>
7-
<%= checkbox.with_label(text: Spree::ReturnReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
8-
<%= checkbox.with_hint(text: t(".hints.active")) %>
9-
<% end %>
6+
<%= f.checkbox(:active, hint: t(".hints.active")) %>
107
</div>
118
<% modal.with_actions do %>
129
<form method="dialog">

admin/app/components/solidus_admin/return_reasons/new/component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
<%= solidus_form_for @return_reason, url: form_url, html: { id: form_id } do |f| %>
44
<div class="flex flex-col gap-6 pb-4">
55
<%= f.text_field(:name, class: "required") %>
6-
<%= f.checkbox(:active) do |checkbox| %>
7-
<%= checkbox.with_label(text: Spree::ReturnReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
8-
<%= checkbox.with_hint(text: t(".hints.active")) %>
9-
<% end %>
6+
<%= f.checkbox(:active, hint: t(".hints.active")) %>
107
</div>
118
<% modal.with_actions do %>
129
<form method="dialog">

admin/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
<%= solidus_form_for @store_credit_reason, url: form_url, html: { id: form_id } do |f| %>
44
<div class="flex flex-col gap-6 pb-4">
55
<%= f.text_field(:name, class: "required") %>
6-
<%= f.checkbox(:active) do |checkbox| %>
7-
<%= checkbox.with_label(text: Spree::StoreCreditReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
8-
<%= checkbox.with_hint(text: t(".hints.active")) %>
9-
<% end %>
6+
<%= f.checkbox(:active, hint: t(".hints.active")) %>
107
</div>
118
<% modal.with_actions do %>
129
<form method="dialog">

admin/app/components/solidus_admin/store_credit_reasons/new/component.html.erb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
<%= solidus_form_for @store_credit_reason, url: form_url, html: { id: form_id } do |f| %>
44
<div class="flex flex-col gap-6 pb-4">
55
<%= f.text_field(:name, class: "required") %>
6-
<%= f.checkbox(:active) do |checkbox| %>
7-
<%= checkbox.with_label(text: Spree::StoreCreditReason.human_attribute_name(:active), weight: :semibold, size: :xs, classes: 'ml-2') %>
8-
<%= checkbox.with_hint(text: t(".hints.active")) %>
9-
<% end %>
6+
<%= f.checkbox(:active, hint: t(".hints.active")) %>
107
</div>
118
<% modal.with_actions do %>
129
<form method="dialog">

0 commit comments

Comments
 (0)