Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
b3b820f8
Commit
b3b820f8
authored
Mar 20, 2018
by
Abinaya Sudhir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document view added with navigation
parent
33c237fc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
1 deletion
+62
-1
DocumentView.purs
src/DocumentView.purs
+36
-0
Navigation.purs
src/Navigation.purs
+22
-1
PageRouter.purs
src/PageRouter.purs
+4
-0
No files found.
src/DocumentView.purs
0 → 100644
View file @
b3b820f8
module DocumentView where
import Prelude hiding (div)
import React.DOM (div, h4, text)
import React.DOM.Props (className)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
type State = String
initialState :: State
initialState = ""
data Action = NoOp
performAction :: PerformAction _ State _ Action
performAction NoOp _ _ = pure unit
docview :: Spec _ State _ Action
docview = simpleSpec performAction render
where
render :: Render State _ Action
render dispatch _ state _ =
[ div [className "container"]
[ div [className "row"]
[ div [className "col-md-4"] []
, div [className "col-md-8"]
[ h4 [] [text "Ultrasonic sensors in urban traffic driving-aid systems"]
]
]
]
]
src/Navigation.purs
View file @
b3b820f8
...
@@ -17,10 +17,11 @@ import Prelude (class Applicative, class Bind, Unit, bind, id, map, negate, pure
...
@@ -17,10 +17,11 @@ import Prelude (class Applicative, class Bind, Unit, bind, id, map, negate, pure
import React (ReactElement)
import React (ReactElement)
import React.DOM (a, div, img, li, span, text, ul, input, button, footer, p, hr, form)
import React.DOM (a, div, img, li, span, text, ul, input, button, footer, p, hr, form)
import React.DOM.Props (_data, _id, _type, aria, className, href, name, placeholder, role, src, style, tabIndex, target, title)
import React.DOM.Props (_data, _id, _type, aria, className, href, name, placeholder, role, src, style, tabIndex, target, title)
import React.DOM.Props as RP
import SearchForm as S
import SearchForm as S
import Thermite (PerformAction, Render, Spec, _render, defaultRender, focus, modifyState, simpleSpec, withState)
import Thermite (PerformAction, Render, Spec, _render, defaultRender, focus, modifyState, simpleSpec, withState)
import UserPage as UP
import UserPage as UP
import
React.DOM.Props as RP
import
DocumentView as D
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
...
@@ -32,6 +33,7 @@ type AppState =
...
@@ -32,6 +33,7 @@ type AppState =
, docViewState :: DV.State
, docViewState :: DV.State
, searchState :: S.State
, searchState :: S.State
, userPage :: UP.State
, userPage :: UP.State
, documentView :: D.State
}
}
initAppState :: AppState
initAppState :: AppState
...
@@ -43,6 +45,7 @@ initAppState =
...
@@ -43,6 +45,7 @@ initAppState =
, docViewState : DV.tdata
, docViewState : DV.tdata
, searchState : S.initialState
, searchState : S.initialState
, userPage : UP.initialState
, userPage : UP.initialState
, documentView : D.initialState
}
}
data Action
data Action
...
@@ -54,6 +57,7 @@ data Action
...
@@ -54,6 +57,7 @@ data Action
| DocViewA DV.Action
| DocViewA DV.Action
| SearchA S.Action
| SearchA S.Action
| UserPageA UP.Action
| UserPageA UP.Action
| DocumentViewA D.Action
performAction :: forall eff props. PerformAction ( dom :: DOM
performAction :: forall eff props. PerformAction ( dom :: DOM
...
@@ -133,6 +137,17 @@ _userPageAction = prism UserPageA \action ->
...
@@ -133,6 +137,17 @@ _userPageAction = prism UserPageA \action ->
_-> Left action
_-> Left action
_documentviewState :: Lens' AppState D.State
_documentviewState = lens (\s -> s.documentView) (\s ss -> s{documentView = ss})
_documentviewAction :: Prism' Action D.Action
_documentviewAction = prism DocumentViewA \action ->
case action of
DocumentViewA caction -> Right caction
_-> Left action
pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action
pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action
pagesComponent s =
pagesComponent s =
...
@@ -152,6 +167,7 @@ pagesComponent s =
...
@@ -152,6 +167,7 @@ pagesComponent s =
selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus
selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus
selectSpec DocView = layout0 $ focus _docViewState _docViewAction DV.layoutDocview
selectSpec DocView = layout0 $ focus _docViewState _docViewAction DV.layoutDocview
selectSpec UserPage = layout0 $ focus _userPageState _userPageAction UP.layoutUser
selectSpec UserPage = layout0 $ focus _userPageState _userPageAction UP.layoutUser
selectSpec (DocumentView i) = layout0 $ focus _documentviewState _documentviewAction D.docview
-- To be removed
-- To be removed
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
...
@@ -407,3 +423,8 @@ dispatchAction dispatcher _ UserPage = do
...
@@ -407,3 +423,8 @@ dispatchAction dispatcher _ UserPage = do
_ <- dispatcher $ SetRoute $ UserPage
_ <- dispatcher $ SetRoute $ UserPage
_ <- dispatcher $ UserPageA $ UP.NoOp
_ <- dispatcher $ UserPageA $ UP.NoOp
pure unit
pure unit
dispatchAction dispatcher _ (DocumentView i) = do
_ <- dispatcher $ SetRoute $ DocumentView i
_ <- dispatcher $ UserPageA $ UP.NoOp
pure unit
src/PageRouter.purs
View file @
b3b820f8
...
@@ -22,6 +22,7 @@ data Routes
...
@@ -22,6 +22,7 @@ data Routes
| DocView
| DocView
| SearchView
| SearchView
| UserPage
| UserPage
| DocumentView Int
instance showRoutes :: Show Routes where
instance showRoutes :: Show Routes where
...
@@ -31,6 +32,7 @@ instance showRoutes :: Show Routes where
...
@@ -31,6 +32,7 @@ instance showRoutes :: Show Routes where
show DocView = "DocView"
show DocView = "DocView"
show SearchView = "SearchView"
show SearchView = "SearchView"
show UserPage = "UserPage"
show UserPage = "UserPage"
show (DocumentView i) = "DocumentView"
int :: Match Int
int :: Match Int
int = floor <$> num
int = floor <$> num
...
@@ -39,12 +41,14 @@ int = floor <$> num
...
@@ -39,12 +41,14 @@ int = floor <$> num
routing :: Match Routes
routing :: Match Routes
routing =
routing =
loginRoute
loginRoute
<|> documentView
<|> userPageRoute
<|> userPageRoute
<|> searchRoute
<|> searchRoute
<|> docviewRoute
<|> docviewRoute
<|> addcorpusRoute
<|> addcorpusRoute
<|> home
<|> home
where
where
documentView = DocumentView <$> (route "documentView" *> int)
userPageRoute = UserPage <$ route "userPage"
userPageRoute = UserPage <$ route "userPage"
searchRoute = SearchView <$ route "search"
searchRoute = SearchView <$ route "search"
docviewRoute = DocView <$ route "docView"
docviewRoute = DocView <$ route "docView"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment