Commit 6b32866d authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FOREST][DOC] new buttons activated (upload/dowload).

parent d1447204
......@@ -8,22 +8,45 @@ import Data.Array (filter)
import Reactix.DOM.HTML as H
import Effect.Aff (Aff, launchAff, runAff)
------------------------------------------------------------------------
------------------------------------------------------------------------
{-
-- | TODO use Set (needs Ord instance for NodeType)
add :: Array NodeType -> NodeAction
add = Add <<< fromFoldable
-- | TODO
filterWithRights (show action if user can only)
-}
------------------------------------------------------------------------
------------------------------------------------------------------------
data NodeAction = Documentation NodeType
| SearchBox
| Download | Upload | Refresh
| Move | Clone | Delete
| Share
| Add (Array NodeType)
instance eqNodeAction :: Eq NodeAction where
eq (Documentation x) (Documentation y) = true && (x == y)
eq SearchBox SearchBox = true
eq Download Download = true
eq Upload Upload = true
eq Refresh Refresh = true
eq Move Move = true
eq Clone Clone = true
eq Delete Delete = true
eq Share Share = true
eq (Add x) (Add y) = true && (x == y)
eq _ _ = false
------------------------------------------------------------------------
------------------------------------------------------------------------
data SettingsBox =
SettingsBox { show :: Boolean
, edit :: Boolean
, buttons :: Array NodeAction
}
------------------------------------------------------------------------
settingsBox :: NodeType -> SettingsBox
settingsBox NodeUser = SettingsBox { show : true
......@@ -44,6 +67,7 @@ settingsBox FolderPrivate = SettingsBox { show: true
, SearchBox
, Add [ Corpus
, Folder
, Annuaire
]
, Delete]
}
......@@ -52,9 +76,11 @@ settingsBox FolderShared = SettingsBox { show: true
, edit : false
, buttons : [Documentation FolderShared
-- , Add [Folder, Team]
, Delete]
, Delete
]
}
settingsBox FolderPublic = SettingsBox { show: true
, edit : false
, buttons : [Documentation FolderPublic
......@@ -72,6 +98,7 @@ settingsBox Folder = SettingsBox { show : true
, SearchBox
, Add [ Corpus
, Folder
, Annuaire
]
, Delete
]
......@@ -130,25 +157,4 @@ settingsBox _ = SettingsBox { show : false
}
------------------------------------------------------------------------
data NodeAction = Documentation NodeType
| SearchBox
| Download | Upload | Refresh
| Move | Clone | Delete
| Share
| Add (Array NodeType)
instance eqNodeAction :: Eq NodeAction where
eq (Documentation x) (Documentation y) = true && (x == y)
eq SearchBox SearchBox = true
eq Download Download = true
eq Upload Upload = true
eq Refresh Refresh = true
eq Move Move = true
eq Clone Clone = true
eq Delete Delete = true
eq Share Share = true
eq (Add x) (Add y) = true && (x == y)
eq _ _ = false
......@@ -300,26 +300,27 @@ buttonClick ({id,name,nodeType,action} /\ setNodePopup) d SearchBox = H.div {cla
[]
]
--}
{-
buttonClick _ _ Upload = H.div {className: "col-md-1"}
buttonClick ({id,name,nodeType,action} /\ setNodePopup) _ Upload = H.div {className: "col-md-2"}
[ H.a { style: iconAStyle
, className: (glyphicon "upload")
, id: "upload"
, title: "Upload [WIP]"}
, title: "Upload [WIP]"
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const {id, name, nodeType, action : Just Upload}
}
[]
]
buttonClick _ _ Download = H.div {className: "col-md-1"}
buttonClick ({id,name,nodeType,action} /\ setNodePopup) _ Download = H.div {className: "col-md-2"}
[ H.a {style: iconAStyle
, className: (glyphicon "download")
, id: "download"
, title: "Download [WIP]"}
, title: "Download [WIP]"
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const {id, name, nodeType, action : Just Download}
}
[]
]
-}
buttonClick _ _ _ = H.div {} []
......@@ -356,12 +357,16 @@ panelAction d {id,name,nodeType,action, session} p = case action of
(Just (Documentation FolderPublic)) -> R.fragment [H.div {} [H.text $ "Soon, you will be able to build public folders to share your work with the world!"]]
(Just (Documentation FolderShared)) -> R.fragment [H.div {} [H.text $ "Soon, you will be able to build teams folders to share your work"]]
(Just (Documentation x)) -> R.fragment [ H.div {} [H.text $ "More information on" <> show nodeType]]
(Just Upload) -> R.fragment [ H.div {} [H.text $ "Soon, you will be able to upload your file here"]]
(Just Download) -> R.fragment [ H.div {} [H.text $ "Soon, you will be able to dowload your file here"]]
(Just SearchBox) -> R.fragment [ H.div {} [ H.text $ "Search and create a private corpus with the search query as corpus name." ]
, searchBar {session, databases:allDatabases}
]
(Just Delete) -> case nodeType of
NodeUser -> R.fragment [ H.div {} [H.text "Yes, we are RGPD compliant! But you can not delete User Node yet (we are still on development). Thanks for your comprehensin."]]
_ -> R.fragment [ H.div {} [H.text "Are your sure you want to delete, if yes, click again ?"], reallyDelete d]
_ -> R.fragment [ H.div {} (map (\t -> H.p {} [H.text t]) ["Are your sure you want to delete it ?", "If yes, click again below."]), reallyDelete d]
(Just (Add xs)) -> createNodeView d {id, name, nodeType} p xs
_ -> H.div {} []
......
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