Commit e85abd8b authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TODO] Add the Tree in wrap function (template of all pages); before refactoring.

parent a56c8af7
......@@ -36,7 +36,7 @@ main :: forall e. Eff (dom:: DOM, console :: CONSOLE, ajax :: AJAX | e) Unit
main = do
case createReactSpec spec tdata of
{ spec, dispatcher } -> void $ do
document <- DOM.window >>= DOM.document
document <- DOM.window >>= DOM.document
container <- unsafePartial (fromJust <$> DOM.querySelector (QuerySelector "#app") (DOM.htmlDocumentToParentNode document))
RDOM.render (R.createFactory (R.createClass spec) {}) container
......@@ -96,8 +96,8 @@ instance decodeResponse :: DecodeJson Response where
type Name = String
type Open = Boolean
type URL = String
type ID = Int
type URL = String
type ID = Int
data NTree a = NLeaf a | NNode ID Open Name (Array (NTree a))
......@@ -111,7 +111,6 @@ toggleNode sid (NNode iid open name ary) =
toggleNode sid a = a
spec :: Spec _ State _ Action
spec = simpleSpec performAction render
where
......@@ -195,7 +194,6 @@ exampleTree =
]
]
------------------------------------------------------------------------
-- TODO
-- alignment to the right
......@@ -405,23 +403,25 @@ greaterthan x y = x > y
newtype TableData a
= TableData
{ rows :: Array {row :: a, delete :: Boolean}
, totalPages :: Int
, currentPage :: Int
, pageSize :: PageSizes
{ rows :: Array { row :: a
, delete :: Boolean
}
, totalPages :: Int
, currentPage :: Int
, pageSize :: PageSizes
, totalRecords :: Int
, title :: String
, tree :: FTree
, title :: String
, tree :: FTree
}
newtype Corpus
= Corpus
{ _id :: Int
, url :: String
, date :: String
, title :: String
{ _id :: Int
, url :: String
, date :: String
, title :: String
, source :: String
, fav :: Boolean
, fav :: Boolean
}
type CorpusTableData = TableData Corpus
......@@ -440,24 +440,24 @@ sdata = data' sampleData
tdata :: CorpusTableData
tdata = TableData
{ rows : sdata
, totalPages : 10
, currentPage : 1
, pageSize : PS10
{ rows : sdata
, totalPages : 10
, currentPage : 1
, pageSize : PS10
, totalRecords : 100
, title : "Documents"
, tree : exampleTree
, title : "Documents"
, tree : exampleTree
}
tdata' :: _ -> CorpusTableData
tdata' d = TableData
{ rows : d
, totalPages : 10
, currentPage : 1
, pageSize : PS10
{ rows : d
, totalPages : 10
, currentPage : 1
, pageSize : PS10
, totalRecords : 100
, title : "Documents"
, tree : exampleTree
, title : "Documents"
, tree : exampleTree
}
......
......@@ -151,4 +151,3 @@ blocksRandomText = div [ className "row" ]
]
......@@ -156,11 +156,14 @@ pagesComponent s =
routingSpec :: forall props eff. Spec (dom :: DOM |eff) AppState props Action
routingSpec = simpleSpec performAction defaultRender
wrap :: forall eff props. Spec (E eff) AppState props Action -> Spec (E eff) AppState props Action
wrap spec =
fold
[ sidebarnavSpec
--, tree
-- TODO Add Tree to the template
--, exampleTree'
, innerContainer $ spec
, footerLegalInfo
]
......@@ -172,6 +175,13 @@ wrap spec =
div [className "container-fluid"] (render d p s c)
]
]
-- TODO Add Tree to the template
-- exampleTree' :: forall props eff. Spec (dom :: DOM |eff) AppState props Action
-- exampleTree' = simpleSpec performAction render
-- where
-- render :: Render AppState props Action
-- render dispatch _ state _ = DV.toHtml dispatch DV.exampleTree
data LiNav = LiNav { title :: String
......@@ -191,7 +201,7 @@ liNav (LiNav { title:tit
, title tit
, href h
]
[ span [ className i ] []
, text $ " " <> txt
]
......@@ -374,6 +384,7 @@ dispatchAction dispatcher _ UserPage = do
footerLegalInfo :: forall props eff. Spec (dom :: DOM |eff) AppState props Action
footerLegalInfo = simpleSpec performAction render
where
......
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