@@ -19,58 +19,70 @@ assetsViewer st = do
19
19
20
20
assetViewer :: Model -> Int -> [View Action ]
21
21
assetViewer st idx =
22
- [ fieldset_ mempty
23
- $ ( legend_
24
- mempty
25
- [ text title,
26
- text " " ,
27
- button_
28
- [ onClick
29
- . PushUpdate
30
- . PureUpdate
31
- $ cloneTraversal modalOptic
32
- .~ Opened
33
- ]
34
- [ icon Icon. IconEdit ,
35
- text " Edit"
36
- ]
37
- ]
22
+ [ keyed uid
23
+ . fieldset_ mempty
24
+ $ ( ( legend_
25
+ mempty
26
+ [ text title,
27
+ text " " ,
28
+ button_
29
+ [ onClick
30
+ . PushUpdate
31
+ . PureUpdate
32
+ $ cloneTraversal modalOptic
33
+ .~ Opened
34
+ ]
35
+ [ icon Icon. IconEdit ,
36
+ text " Edit"
37
+ ]
38
+ ]
39
+ )
40
+ : FieldPairs. fieldPairsViewer fieldPairsOpts args
38
41
)
39
- : FieldPairs. fieldPairsViewer fieldPairsOpts args
42
+ <> ( Dialog. dialog
43
+ Dialog. defOpts
44
+ { Dialog. optsTitle = Just title,
45
+ Dialog. optsExtraOnClose = saveUpdate,
46
+ Dialog. optsHeaderRight =
47
+ const
48
+ [ button_
49
+ [type_ " reset" , onClick removeAction]
50
+ [icon Icon. IconDelete ],
51
+ button_
52
+ [type_ " submit" , onClick saveAction]
53
+ [icon Icon. IconSave ]
54
+ ],
55
+ Dialog. optsFooterRight =
56
+ const
57
+ [ button_
58
+ [type_ " reset" , onClick removeAction]
59
+ [icon Icon. IconDelete , text " Remove" ],
60
+ button_
61
+ [type_ " submit" , onClick saveAction]
62
+ [icon Icon. IconSave , text " Save" ]
63
+ ]
64
+ }
65
+ Dialog. Args
66
+ { Dialog. argsModel = st,
67
+ Dialog. argsOptic = modalOptic,
68
+ Dialog. argsAction = PushUpdate ,
69
+ Dialog. argsContent =
70
+ failures False
71
+ <> FieldPairs. fieldPairsEditor args fieldPairsOpts
72
+ }
73
+ )
40
74
]
41
- <> ( Dialog. dialog
42
- Dialog. defOpts
43
- { Dialog. optsTitle = Just title,
44
- Dialog. optsExtraOnClose = saveUpdate,
45
- Dialog. optsHeaderRight =
46
- const
47
- [ button_
48
- [type_ " reset" , onClick removeAction]
49
- [icon Icon. IconDelete ],
50
- button_
51
- [type_ " submit" , onClick saveAction]
52
- [icon Icon. IconSave ]
53
- ],
54
- Dialog. optsFooterRight =
55
- const
56
- [ button_
57
- [type_ " reset" , onClick removeAction]
58
- [icon Icon. IconDelete , text " Remove" ],
59
- button_
60
- [type_ " submit" , onClick saveAction]
61
- [icon Icon. IconSave , text " Save" ]
62
- ]
63
- }
64
- Dialog. Args
65
- { Dialog. argsModel = st,
66
- Dialog. argsOptic = modalOptic,
67
- Dialog. argsAction = PushUpdate ,
68
- Dialog. argsContent =
69
- failures False
70
- <> FieldPairs. fieldPairsEditor args fieldPairsOpts
71
- }
72
- )
73
75
where
76
+ uid =
77
+ decodeUtf8
78
+ . unTagged
79
+ . htmlUid
80
+ . fromMaybe nilUid
81
+ $ st
82
+ ^? # modelState
83
+ . # stAssets
84
+ . ix idx
85
+ . # assetUid
74
86
args =
75
87
FieldPairs. Args
76
88
{ FieldPairs. argsModel = st,
0 commit comments