@@ -248,63 +248,15 @@ creditCardForm state model =
248248 , on " input" targetValue ( \ month -> Signal . message events. address ( ExpirationMonthChange month))
249249 , value state. cardExpirationMonth
250250 ]
251- [ option []
252- []
253- , option [ selected <| state. cardExpirationMonth == " Jan" ]
254- [ text " Jan" ]
255- , option [ selected <| state. cardExpirationMonth == " Feb" ]
256- [ text " Feb" ]
257- , option [ selected <| state. cardExpirationMonth == " Mar" ]
258- [ text " Mar" ]
259- , option [ selected <| state. cardExpirationMonth == " Apr" ]
260- [ text " Apr" ]
261- , option [ selected <| state. cardExpirationMonth == " May" ]
262- [ text " May" ]
263- , option [ selected <| state. cardExpirationMonth == " Jun" ]
264- [ text " Jun" ]
265- , option [ selected <| state. cardExpirationMonth == " Jul" ]
266- [ text " Jul" ]
267- , option [ selected <| state. cardExpirationMonth == " Ago" ]
268- [ text " Ago" ]
269- , option [ selected <| state. cardExpirationMonth == " Sep" ]
270- [ text " Sep" ]
271- , option [ selected <| state. cardExpirationMonth == " Oct" ]
272- [ text " Oct" ]
273- , option [ selected <| state. cardExpirationMonth == " Nov" ]
274- [ text " Nov" ]
275- , option [ selected <| state. cardExpirationMonth == " Dec" ]
276- [ text " Dec" ]
277- ]
251+ ( [ option [] [] ] ++ ( opts [ " Jan" , " Feb" , " Mar" , " Apr" , " May" , " Jun" , " Jul" , " Aug" , " Sep" , " Oct" , " Nov" , " Dec" ] state. cardExpirationMonth))
278252 ]
279253 , div [ class " select" ]
280254 [ select [ id " card-expiration-year"
281255 , required True
282256 , on " input" targetValue ( \ year -> Signal . message events. address ( ExpirationYearChange year))
283257 , value state. cardExpirationYear
284258 ]
285- [ option []
286- []
287- , option [ selected <| state. cardExpirationYear == " 2016" ]
288- [ text " 2016" ]
289- , option [ selected <| state. cardExpirationYear == " 2017" ]
290- [ text " 2017" ]
291- , option [ selected <| state. cardExpirationYear == " 2018" ]
292- [ text " 2018" ]
293- , option [ selected <| state. cardExpirationYear == " 2019" ]
294- [ text " 2019" ]
295- , option [ selected <| state. cardExpirationYear == " 2020" ]
296- [ text " 2020" ]
297- , option [ selected <| state. cardExpirationYear == " 2021" ]
298- [ text " 2021" ]
299- , option [ selected <| state. cardExpirationYear == " 2022" ]
300- [ text " 2022" ]
301- , option [ selected <| state. cardExpirationYear == " 2023" ]
302- [ text " 2023" ]
303- , option [ selected <| state. cardExpirationYear == " 2024" ]
304- [ text " 2024" ]
305- , option [ selected <| state. cardExpirationYear == " 2025" ]
306- [ text " 2025" ]
307- ]
259+ ( [ option [] [] ] ++ ( opts ( List . map ( (++) " 20" ) [ " 16" , " 17" , " 18" , " 19" , " 20" , " 21" , " 22" , " 23" , " 24" , " 25" ] ) state. cardExpirationYear))
308260 ]
309261 ]
310262 , fieldset [ class " fieldset-ccv"
@@ -333,6 +285,16 @@ creditCardForm state model =
333285 ]
334286
335287
288+ opts : List String -> String -> List Html
289+ opts values currentValue =
290+ List . map ( opt currentValue) values
291+
292+
293+ opt : String -> String -> Html
294+ opt currentValue expectedValue =
295+ option [ selected ( currentValue == expectedValue) ] [ text expectedValue ]
296+
297+
336298successView : ViewState -> Model -> Html
337299successView state model =
338300 div [ class " checkout modalbox success center animate" ]
0 commit comments