Paste server written in Haskell. Fork of Hpaste, fully freedom and privacy respecting and generally improved. At the time of writing there's an instance at <http://paste.rel4tion.org>.

[[ 🗃 ^aoqmo toothpaste ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/aoqmo

SSH: git clone USERNAME@vervis.peers.community:aoqmo

Branches

Tags

hpaste :: src / Hpaste / View /

Reported.hs

{-# OPTIONS -Wall -fno-warn-name-shadowing #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

-- | Reported page view.

module Hpaste.View.Reported
  (page)
  where

import Hpaste.Types
import Hpaste.View.Html
import Hpaste.View.Layout

import Text.Blaze.Pagination
import Data.Monoid.Operator ((++))
import Data.Time.Show       (showDateTime)
import Prelude              hiding ((++))
import Network.URI
import Text.Blaze.Html5     as H hiding (map)
import Snap.App.Types

-- | Render the reported page.
page :: PN -> [Report] -> String -> Html
page pn rs key =
  layoutPage $ Page {
    pageTitle = "Reported pastes"
  , pageBody = reported pn rs key
  , pageName = "reported"
  }

-- | View the paginated reports.
reported :: PN -> [Report] -> String -> Html
reported pn rs key = do
  darkSection "Reported pastes" $ do
    pagination pn
    table ! aClass "latest-pastes" $ do
      tr $ mapM_ (th . toHtml) $ words "Date Paste Delete Comments"
      reports rs
    pagination pn

    where reports = mapM_ $ \Report{..} -> tr $ do
                      td $ toHtml $ showDateTime reportDate
                      td $ href ("/" ++ show reportPasteId ++ "?show_private=true") $ show reportPasteId
		      td $ href ("/delete?id=" ++ show reportPasteId ++ "&key=" ++ key) ("Delete"::String)
                      td $ toHtml reportComments
[See repo JSON]