Filter by tag by clicking on it
This commit is contained in:
parent
827afc4e7f
commit
095c87fbaa
@ -41,6 +41,11 @@ getJournalR = do
|
||||
isPostingTag account tag = not $ tag `elem` journalInheritedAccountTags j account
|
||||
isAbsoluteURI = maybe False URI.isPathAbsolute . URI.mkURI
|
||||
documentRoute = DocumentR . flip StaticRoute [] . T.splitOn "/"
|
||||
escapeRegex = T.pack . concatMap escape . T.unpack
|
||||
escape c
|
||||
| c `elem` (".[$^()|*+?{\\" :: [Char]) = ['\\', c]
|
||||
| otherwise = [c]
|
||||
addTagQuery name value = (JournalR, [("q", qparam <> " \"tag:" <> escapeRegex name <> (if T.null value then "" else "=" <> escapeRegex value) <> "\"")]) -- XXX:is there no way to escape quotes
|
||||
|
||||
defaultLayout $ do
|
||||
setTitle "päiväkirja - hledger-web"
|
||||
|
||||
@ -191,6 +191,14 @@ ul {
|
||||
max-width: 10em;
|
||||
}
|
||||
|
||||
.tag-name a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.tag-name a:hover {
|
||||
text-decoration: underline dotted;
|
||||
}
|
||||
|
||||
.tag-value {
|
||||
background-color: #eee;
|
||||
padding: 0 6px;
|
||||
|
||||
@ -40,7 +40,8 @@ $if elem AddPermission perms
|
||||
$forall (tagName, tagValue) <- filter isVisibleTag $ ttags torig
|
||||
<li .tag title="#{mconcat [tagName, ": ", tagValue]}">
|
||||
<div .tag-name>
|
||||
#{tagName}
|
||||
<a href=@?{addTagQuery tagName tagValue}>
|
||||
#{tagName}
|
||||
$if not $ T.null $ T.strip tagValue
|
||||
<div .tag-value>
|
||||
$if isAbsoluteURI tagValue
|
||||
@ -69,7 +70,8 @@ $if elem AddPermission perms
|
||||
$forall (tagName, tagValue) <- filter (isPostingTag acc) $ filter isVisibleTag tags
|
||||
<li .tag title="#{mconcat [tagName, ": ", tagValue]}">
|
||||
<div .tag-name>
|
||||
#{tagName}
|
||||
<a href=@?{addTagQuery tagName tagValue}>
|
||||
#{tagName}
|
||||
$if not $ T.null $ T.strip tagValue
|
||||
<div .tag-value>
|
||||
$if isAbsoluteURI tagValue
|
||||
|
||||
Loading…
Reference in New Issue
Block a user