File tree Expand file tree Collapse file tree
modules/webapp/src/main/elm Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import Html.Attributes exposing (..)
2424import Html.Events exposing (onClick , onInput )
2525import Messages.Comp.CustomFieldInput exposing (Texts )
2626import Styles as S
27+ import Util.CustomField
2728import Util.Maybe
2829
2930
@@ -267,18 +268,11 @@ update1 forSearch msg model =
267268
268269 ( ToggleBool , BoolField b ) ->
269270 let
270- notb =
271- not b
272-
273271 model_ =
274- { model | fieldModel = BoolField notb }
272+ { model | fieldModel = BoolField ( not b ) }
275273
276274 value =
277- if notb then
278- " true"
279-
280- else
281- " false"
275+ Util . CustomField . boolValue ( not b)
282276 in
283277 UpdateResult model_ Cmd . none ( Value value)
284278
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import Api.Model.ItemFieldValue exposing (ItemFieldValue)
2222import Comp.CustomFieldInput
2323import Comp.FixedDropdown
2424import Data.CustomFieldChange exposing (CustomFieldChange (..) )
25+ import Data.CustomFieldType
2526import Data.DropdownStyle as DS
2627import Data.Flags exposing (Flags )
2728import Dict exposing (Dict )
@@ -217,8 +218,16 @@ update1 forSearch flags msg model =
217218
218219 cmd_ =
219220 Cmd . map ( CustomFieldInputMsg f) fc
221+
222+ change =
223+ case Data . CustomFieldType . fromString f. ftype of
224+ Just Data . CustomFieldType . Boolean ->
225+ FieldValueChange f ( Util . CustomField . boolValue False )
226+
227+ _ ->
228+ NoFieldChange
220229 in
221- UpdateResult model_ cmd_ NoFieldChange
230+ UpdateResult model_ cmd_ change
222231
223232 RemoveField f ->
224233 let
Original file line number Diff line number Diff line change 11module Util.CustomField exposing
2- ( nameOrLabel
2+ ( boolValue
3+ , nameOrLabel
34 , renderValue
45 , renderValue2
56 )
@@ -12,6 +13,17 @@ import Html.Attributes exposing (..)
1213import Html.Events exposing (onClick )
1314
1415
16+ {- | This is how the server wants the value to a bool custom field
17+ -}
18+ boolValue : Bool -> String
19+ boolValue b =
20+ if b then
21+ " true"
22+
23+ else
24+ " false"
25+
26+
1527nameOrLabel : { r | name : String , label : Maybe String } -> String
1628nameOrLabel fv =
1729 Maybe . withDefault fv. name fv. label
You can’t perform that action at this time.
0 commit comments