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
169c6cf4
Commit
169c6cf4
authored
Mar 11, 2018
by
Abinaya Sudhir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docview navigation done
parent
988352b0
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
396 additions
and
11 deletions
+396
-11
AddCorpusview.purs
src/AddCorpusview.purs
+22
-11
DocView.purs
src/DocView.purs
+347
-0
Navigation.purs
src/Navigation.purs
+23
-0
PageRouter.purs
src/PageRouter.purs
+4
-0
No files found.
src/AddCorpusview.purs
View file @
169c6cf4
...
...
@@ -15,8 +15,11 @@ import DOM.WebStorage.Storage (getItem, setItem)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, jsonEmptyObject, (.?), (:=), (~>))
import Data.Either (Either(..))
import Data.HTTP.Method (Method(..))
import Data.Lens (Lens', Prism', lens, over)
import Data.List (List, fold, fromFoldable, toUnfoldable)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.MediaType.Common (applicationJSON)
import Data.Tuple (Tuple(..))
import Network.HTTP.Affjax (AJAX, affjax, defaultRequest)
import Network.HTTP.RequestHeader (RequestHeader(..))
import Prelude hiding (div)
...
...
@@ -24,10 +27,11 @@ import React (ReactElement)
import React.DOM (a, button, div, form, h2, h3, h4, i, input, label, li, p, span, text, ul)
import React.DOM.Props (_id, _type, className, href, maxLength, name, onClick, onInput, placeholder, target, value)
import Routing.Hash.Aff (setHash)
import Thermite (PerformAction, Render, Spec,
cotransform, modifyState, simpleSpec
)
import Thermite (PerformAction, Render, Spec,
_render, cotransform, focus, foreach, modifyState, simpleSpec, withState
)
import Unsafe.Coerce (unsafeCoerce)
type State =
{ select_database :: Boolean
, unselect_database :: Boolean -- dummy state
...
...
@@ -54,6 +58,7 @@ data Action
| SelectDatabase Boolean
| UnselectDatabase Boolean
| LoadDatabaseDetails
| ResponseAction
performAction :: forall eff props. PerformAction (console :: CONSOLE, ajax :: AJAX,dom::DOM | eff) State props Action
...
...
@@ -74,6 +79,8 @@ performAction (LoadDatabaseDetails) _ _ = void do
Right resData -> do
cotransform $ \(state) -> state {response = resData}
performAction ResponseAction _ _ = void do
modifyState id
...
...
@@ -96,25 +103,29 @@ addcorpusviewSpec = simpleSpec performAction render
[
h3 [] [text "Corpusview"]
, ul [className "list-group"] $ map fn1 state.response
, button [] [text "GO"]
]
]
]
]
]
where
fn1 (Response o) =
li [className "list-group-item justify-content-between"]
[
span [] [text o.name]
, span [className "badge badge-default badge-pill"] [ text $ show o.count]
]
fn1 :: Response -> ReactElement
fn1 (Response o) =
li [className "list-group-item justify-content-between"]
[
a [ href "#"]
[ span [] [text o.name]
, span [className "badge badge-default badge-pill"] [ text $ show o.count]
]
]
-- fn1 :: Response -> ReactElement
-- fn1 (Response o) =
-- li [className "list-group-item justify-content-between"]
-- [
-- span [] [text o.name]
-- , span [className "badge badge-default badge-pill"] [ text $ show o.count]
-- ]
newtype QueryString = QueryString
...
...
src/DocView.purs
0 → 100644
View file @
169c6cf4
This diff is collapsed.
Click to expand it.
src/Navigation.purs
View file @
169c6cf4
...
...
@@ -19,6 +19,8 @@ import Prelude hiding (div)
import React.DOM (a, div, i, img, li, span, text, ul)
import React.DOM.Props (_data, _id, aria, className, href, role, src, style, tabIndex, target, title)
import Thermite (PerformAction, Render, Spec, _render, defaultRender, focus, modifyState, simpleSpec, withState)
import DocView as DV
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
...
...
@@ -27,6 +29,7 @@ type AppState =
, landingState :: L.State
, loginState :: LN.State
, addCorpusState :: AC.State
, docViewState :: DV.State
}
initAppState :: AppState
...
...
@@ -35,6 +38,7 @@ initAppState =
, landingState : L.initialState
, loginState : LN.initialState
, addCorpusState : AC.initialState
, docViewState : DV.tdata
}
...
...
@@ -44,6 +48,7 @@ data Action
| LoginA LN.Action
| SetRoute Routes
| AddCorpusA AC.Action
| DocViewA DV.Action
performAction :: forall eff props. PerformAction (dom :: DOM |eff) AppState props Action
...
...
@@ -92,6 +97,18 @@ _addCorpusAction = prism AddCorpusA \action ->
_docViewState:: Lens' AppState DV.State
_docViewState = lens (\s -> s.docViewState) (\s ss -> s{docViewState = ss})
_docViewAction :: Prism' Action DV.Action
_docViewAction = prism DocViewA \action ->
case action of
DocViewA caction -> Right caction
_-> Left action
pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action
pagesComponent s =
case s.currentRoute of
...
...
@@ -104,6 +121,7 @@ pagesComponent s =
selectSpec Home = wrap $ focus _landingState _landingAction L.loginSpec
selectSpec Login = focus _loginState _loginAction LN.renderSpec
selectSpec AddCorpus = wrap $ focus _addCorpusState _addCorpusAction AC.addcorpusviewSpec
selectSpec DocView = wrap $ focus _docViewState _docViewAction DV.spec
routingSpec :: forall props eff. Spec (dom :: DOM |eff) AppState props Action
routingSpec = simpleSpec performAction defaultRender
...
...
@@ -240,3 +258,8 @@ dispatchAction dispatcher _ AddCorpus = do
_ <- dispatcher $ SetRoute $ AddCorpus
_ <- dispatcher $ AddCorpusA $ AC.LoadDatabaseDetails
pure unit
dispatchAction dispatcher _ DocView = do
_ <- dispatcher $ SetRoute $ DocView
_ <- dispatcher $ DocViewA $ DV.LoadData
pure unit
src/PageRouter.purs
View file @
169c6cf4
...
...
@@ -18,11 +18,13 @@ data Routes
= Home
| Login
| AddCorpus
| DocView
instance showRoutes :: Show Routes where
show Home = "Home"
show Login = "Login"
show AddCorpus = "AddCorpus"
show DocView = "DocView"
int :: Match Int
int = floor <$> num
...
...
@@ -31,8 +33,10 @@ routing :: Match Routes
routing =
loginRoute
<|> addcorpusRoute
<|> docviewRoute
<|> home
where
docviewRoute = DocView <$ route "docView"
addcorpusRoute = AddCorpus <$ route "addCorpus"
loginRoute = Login <$ route "login"
home = Home <$ lit ""
...
...
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