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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
4925b93f
Commit
4925b93f
authored
Apr 16, 2018
by
Abinaya Sudhir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tree is hide based on login condition
parent
1523b6dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
5 deletions
+46
-5
Login.purs
src/Login.purs
+40
-2
Navigation.purs
src/Navigation.purs
+6
-3
No files found.
src/Login.purs
View file @
4925b93f
...
...
@@ -34,6 +34,7 @@ newtype State = State
, password :: String
, response :: LoginRes
, errorMessage :: String
, loginC :: Boolean
}
...
...
@@ -43,6 +44,7 @@ initialState = State
, password : ""
, response : LoginRes {token : ""}
, errorMessage : ""
, loginC : false
}
data Action
...
...
@@ -54,7 +56,7 @@ data Action
performAction :: forall eff props. PerformAction ( console :: CONSOLE
, ajax :: AJAX
, dom :: DOM
, dom :: DOM
| eff
) State props Action
performAction NoOp _ _ = void do
...
...
@@ -71,7 +73,7 @@ performAction (SetPassword pwd) _ _ = void do
performAction Login _ (State state) = void do
lift $ setHash "/search"
modifyState
id
modifyState
\(State state) -> State $ state {loginC = true}
-- res <- lift $ loginReq $ LoginReq { username : state.username, password : state.password }
-- case res of
-- Left e -> do
...
...
@@ -148,6 +150,42 @@ renderSpec = simpleSpec performAction render
]
-- div [ className "modal fade myModal"
-- , role "dialog"
-- , _data {show : true}
-- ][ div [ className "modal-dialog"
-- , role "document"
-- ] [ div [ className "modal-content"]
-- [ div [ className "modal-header"]
-- [ h5 [ className "modal-title"
-- ]
-- [ text "CorpusView"
-- ]
-- , button [ _type "button"
-- , className "close"
-- , _data { dismiss : "modal"}
-- ] [ span [ aria {hidden : true}]
-- [ text "X"]
-- ]
-- ]
-- , div [ className "modal-body"]
-- [ ul [ className "list-group"] ( map fn1 state.response ) ]
-- , div [className "modal-footer"]
-- [ button [ _type "button"
-- , className "btn btn-secondary"
-- , _data {dismiss : "modal"}
-- ] [ text "GO"]
-- ]
-- ]
-- ]
-- ]
-- ]
unsafeEventValue :: forall event. event -> String
unsafeEventValue e = (unsafeCoerce e).target.value
...
...
src/Navigation.purs
View file @
4925b93f
...
...
@@ -2,7 +2,6 @@ module Navigation where
import DOM
import Gargantext.Data.Lang
import Prelude hiding (div)
import AddCorpusview as AC
import AnnotationDocumentView as D
...
...
@@ -22,6 +21,7 @@ import Login as LN
import NTree as NT
import Network.HTTP.Affjax (AJAX)
import PageRouter (Routes(..))
import Prelude hiding (div)
import React (ReactElement)
import React.DOM (a, button, div, footer, form, hr, i, img, input, li, p, span, text, ul)
import React.DOM.Props (Props, _data, _id, _type, aria, className, href, name, onChange, onClick, placeholder, role, src, style, tabIndex, target, title)
...
...
@@ -29,7 +29,7 @@ import React.DOM.Props as RP
import Routing.Hash.Aff (setHash)
import SearchForm as S
import Tabview as TV
import Thermite (PerformAction, Render, Spec, _render, cotransform, defaultRender, focus, modifyState, simpleSpec, withState)
import Thermite (PerformAction, Render, Spec, _render, cotransform, default
PerformAction, default
Render, focus, modifyState, simpleSpec, withState)
import Unsafe.Coerce (unsafeCoerce)
import UserPage as UP
...
...
@@ -255,10 +255,13 @@ layout0 layout =
, layoutFooter
]
where
outerLayout1 = simpleSpec defaultPerformAction defaultRender
outerLayout :: Spec (E eff) AppState props Action
outerLayout =
cont $ fold
[ ls as
[ withState \st ->
if ((\(LN.State s) -> s.loginC) st.loginState == true) then ls as
else outerLayout1
, rs bs ]
ls = over _render \render d p s c ->
[div [className "col-md-3"] (render d p s c)]
...
...
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