Commit 195e2cc3 authored by James Laver's avatar James Laver

Make Docs Table generate correct document links

parent b42e73e8
......@@ -29,12 +29,13 @@ import React as React
import React (ReactClass, ReactElement, Children)
------------------------------------------------------------------------
import Gargantext.Prelude
import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..), TabType, toUrl)
import Gargantext.Config (End(..), NodeType(..), OrderBy(..), Path(..), TabType, toUrl, toLink)
import Gargantext.Config.REST (get, put, post, deleteWithBody)
import Gargantext.Components.Loader as Loader
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Table as T
import Gargantext.Utils.DecodeMaybe ((.|))
import Gargantext.Router as R
import React.DOM (a, br', button, div, i, input, p, text)
import React.DOM.Props (_type, className, href, onClick, placeholder, style, checked, target)
import Thermite (PerformAction, Render, Spec, defaultPerformAction, modifyState_, simpleSpec, hideState)
......@@ -307,7 +308,7 @@ renderPage loaderDispatch { totalRecords, dispatch, listId
else
div [ ][text (show r.date)]
, if (toDelete $ DocumentsView r) then
a [ href (toUrl Front Url_Document (Just r._id))
a [ href (toLink $ R.Document listId r._id)
, style {textDecoration : "line-through"}
, target "_blank"
] [ text r.title ]
......
......@@ -18,6 +18,7 @@ import Data.Map (Map)
import Data.Map as DM
import Data.Maybe (Maybe(..), maybe)
import Data.Tuple (Tuple(..))
import Gargantext.Router as R
import Gargantext.Types
......@@ -192,6 +193,25 @@ pathUrl c (Chart {chartType, tabType}) i =
------------------------------------------------------------
routesPath R.Home = ""
routesPath R.Login = "login"
routesPath R.SearchView = "search"
routesPath (R.Folder i) = "folder/" <> show i
routesPath (R.Corpus i) = "corpus/" <> show i
routesPath R.AddCorpus = "addCorpus"
routesPath (R.Document l i) = "list/" <> show l <> "/document/" <> show i
routesPath (R.PGraphExplorer i) = "#/"
routesPath R.Dashboard = "dashboard"
routesPath (R.Annuaire i) = "annuaire/" <> show i
routesPath (R.UserPage i) = "user/" <> show i
routesPath (R.ContactPage i) = "contact/" <> show i
class Linkable a where
toLink :: a -> String
instance linkableRoutes :: Linkable R.Routes where
toLink l = endConfig.front.baseUrl <> endConfig.front.prePath <> routesPath l
class ToUrl a where
toUrl :: End -> a -> Maybe Id -> Url
......
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