@@ -130,7 +130,7 @@ defmodule Kaffy.ResourceForm do
130
130
text_input ( form , field , opts )
131
131
132
132
:richtext ->
133
- opts = Keyword . put ( opts , :class , "kaffy-editor" )
133
+ opts = add_class ( opts , "kaffy-editor" )
134
134
textarea ( form , field , opts )
135
135
136
136
:textarea ->
@@ -146,8 +146,8 @@ defmodule Kaffy.ResourceForm do
146
146
text_input ( form , field , opts )
147
147
148
148
t when t in [ :boolean , :boolean_checkbox ] ->
149
- checkbox_opts = Keyword . put ( opts , :class , "custom-control-input" )
150
- label_opts = Keyword . put ( opts , :class , "custom-control-label" )
149
+ checkbox_opts = add_class ( opts , "custom-control-input" )
150
+ label_opts = add_class ( opts , "custom-control-label" )
151
151
152
152
[
153
153
{ :safe , ~s( <div class="custom-control custom-checkbox">) } ,
@@ -157,8 +157,8 @@ defmodule Kaffy.ResourceForm do
157
157
]
158
158
159
159
:boolean_switch ->
160
- checkbox_opts = Keyword . put ( opts , :class , "custom-control-input" )
161
- label_opts = Keyword . put ( opts , :class , "custom-control-label" )
160
+ checkbox_opts = add_class ( opts , "custom-control-input" )
161
+ label_opts = add_class ( opts , "custom-control-label" )
162
162
163
163
[
164
164
{ :safe , ~s( <div class="custom-control custom-switch">) } ,
@@ -294,8 +294,8 @@ defmodule Kaffy.ResourceForm do
294
294
end
295
295
296
296
defp flatpickr_generic ( form , field , opts , placeholder , fp_class , icon \\ "📅" ) do
297
- opts = Keyword . put ( opts , :class , "flatpickr-input" )
298
- opts = Keyword . put ( opts , :class , "form-control" )
297
+ opts = add_class ( opts , "flatpickr-input" )
298
+ opts = add_class ( opts , "form-control" )
299
299
opts = Keyword . put ( opts , :id , "inlineFormInputGroup" )
300
300
opts = Keyword . put ( opts , :placeholder , placeholder )
301
301
opts = Keyword . put ( opts , :"data-input" , "" )
@@ -471,4 +471,8 @@ defmodule Kaffy.ResourceForm do
471
471
end
472
472
end
473
473
end
474
+
475
+ defp add_class ( opts , class ) do
476
+ Keyword . update ( opts , :class , class , & "#{ & 1 } #{ class } " )
477
+ end
474
478
end
0 commit comments