In HTML pages with AP support, display link to pretty formatted JSON
This commit is contained in:
parent
708f626294
commit
04a2e9a817
1 changed files with 12 additions and 1 deletions
|
@ -26,6 +26,7 @@ import Prelude
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
import Control.Monad.Logger.CallStack
|
import Control.Monad.Logger.CallStack
|
||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
|
import Data.Foldable
|
||||||
import Data.List.NonEmpty (NonEmpty)
|
import Data.List.NonEmpty (NonEmpty)
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import Network.HTTP.Client
|
import Network.HTTP.Client
|
||||||
|
@ -131,4 +132,14 @@ provideHtmlAndAP object widget = do
|
||||||
[whamlet|
|
[whamlet|
|
||||||
<div><pre>#{encodePrettyToLazyText doc}
|
<div><pre>#{encodePrettyToLazyText doc}
|
||||||
|]
|
|]
|
||||||
_ -> widget
|
_ -> do
|
||||||
|
widget
|
||||||
|
mroute <- getCurrentRoute
|
||||||
|
for_ mroute $ \ route -> do
|
||||||
|
params <- reqGetParams <$> getRequest
|
||||||
|
let pj = ("prettyjson", "true")
|
||||||
|
[whamlet|
|
||||||
|
<div>
|
||||||
|
<a href=@?{(route, pj : params)}>
|
||||||
|
[See JSON]
|
||||||
|
|]
|
||||||
|
|
Loading…
Reference in a new issue