Commit 88e1d796 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[REFACT][Tree] NodeType Download refactored

parent 74c8c60b
......@@ -583,25 +583,43 @@ reallyDelete d = H.div {className: "panel-footer"}
-- | Action : Download
actionDownload :: NodeType -> ID -> Session -> R.Hooks R.Element
actionDownload NodeList id session = do
let href = url session $ Routes.NodeAPI GT.NodeList (Just id) ""
pure $ R.fragment [
H.span { className: "row" }
actionDownload NodeList id session = downloadButton href label info
where
href = url session $ Routes.NodeAPI GT.NodeList (Just id) ""
label = "Download list"
info = "Info about the JSON format"
actionDownload GT.Graph id session = downloadButton href label info
where
href = url session $ Routes.NodeAPI GT.Graph (Just id) "gexf"
label = "Download GEXF"
info = "Info about the GEXF format"
actionDownload _ _ _ = pure $ fragmentPT $ "Soon, you will be able to dowload your file here "
type Href = String
type Label = String
type Info = String
downloadButton :: Href -> Label -> Info -> R.Hooks R.Element
downloadButton href label info = do
pure $ R.fragment [ H.div { className: "row"}
[ H.div { className: "col-md-2"} []
, H.div { className: "col-md-7 flex-center"}
[ H.p {} [H.text info] ]
]
, H.span { className: "row" }
[ H.div { className: "panel-footer"}
[ H.div { className: "col-md-3"} []
, H.div { className: "col-md-3 flex-center"}
[ H.a { className: "btn btn-default"
, href
, target: "_blank" } [ H.text "Download list" ]
, target: "_blank" }
[ H.text label ]
]
]
actionDownload GT.Graph id session = do
pure $ R.fragment [ H.div { className: "gexf" }
[ H.a { className: "btn btn-default"
, href: url session $ Routes.NodeAPI GT.Graph (Just id) "gexf"
, target: "_blank" } [ H.text "Download GEXF" ]
]
]
actionDownload _ _ _ = do
pure $ fragmentPT $ "Soon, you will be able to dowload your file here "
-- | Action: Show Documentation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment