Skip to content

Commit 4b930a2

Browse files
committed
Add preference fields for decimal, integer, and string types
- Implemented text fields for decimal and integer preferences with appropriate input types and steps. - Implemented text fields for string preferences.
1 parent 086876a commit 4b930a2

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<%= render component("ui/forms/field").text_field(
2+
@form,
3+
@attribute,
4+
type: :number,
5+
step: '0.01',
6+
class: 'fullwidth'
7+
) %>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
class SolidusAdmin::Calculators::PreferenceFields::Decimal::Component < SolidusAdmin::BaseComponent
4+
def initialize(form:, attribute:, label:)
5+
@form = form
6+
@attribute = attribute
7+
@label = label
8+
end
9+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<%= render component("ui/forms/field").text_field(
2+
@form,
3+
@attribute,
4+
type: :number,
5+
step: '1',
6+
class: 'fullwidth'
7+
) %>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
class SolidusAdmin::Calculators::PreferenceFields::Integer::Component < SolidusAdmin::BaseComponent
4+
def initialize(form:, attribute:, label:)
5+
@form = form
6+
@attribute = attribute
7+
@label = label
8+
end
9+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<%= render component("ui/forms/field").text_field(
2+
@form,
3+
@attribute,
4+
class: 'fullwidth'
5+
) %>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
class SolidusAdmin::Calculators::PreferenceFields::String::Component < SolidusAdmin::BaseComponent
4+
def initialize(form:, attribute:, label:)
5+
@form = form
6+
@attribute = attribute
7+
@label = label
8+
end
9+
end

0 commit comments

Comments
 (0)