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
|
isPostingTag account tag = not $ tag `elem` journalInheritedAccountTags j account
|
||||||
isAbsoluteURI = maybe False URI.isPathAbsolute . URI.mkURI
|
isAbsoluteURI = maybe False URI.isPathAbsolute . URI.mkURI
|
||||||
documentRoute = DocumentR . flip StaticRoute [] . T.splitOn "/"
|
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
|
defaultLayout $ do
|
||||||
setTitle "päiväkirja - hledger-web"
|
setTitle "päiväkirja - hledger-web"
|
||||||
|
|||||||
@ -191,6 +191,14 @@ ul {
|
|||||||
max-width: 10em;
|
max-width: 10em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tag-name a {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-name a:hover {
|
||||||
|
text-decoration: underline dotted;
|
||||||
|
}
|
||||||
|
|
||||||
.tag-value {
|
.tag-value {
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
padding: 0 6px;
|
padding: 0 6px;
|
||||||
|
|||||||
@ -40,7 +40,8 @@ $if elem AddPermission perms
|
|||||||
$forall (tagName, tagValue) <- filter isVisibleTag $ ttags torig
|
$forall (tagName, tagValue) <- filter isVisibleTag $ ttags torig
|
||||||
<li .tag title="#{mconcat [tagName, ": ", tagValue]}">
|
<li .tag title="#{mconcat [tagName, ": ", tagValue]}">
|
||||||
<div .tag-name>
|
<div .tag-name>
|
||||||
#{tagName}
|
<a href=@?{addTagQuery tagName tagValue}>
|
||||||
|
#{tagName}
|
||||||
$if not $ T.null $ T.strip tagValue
|
$if not $ T.null $ T.strip tagValue
|
||||||
<div .tag-value>
|
<div .tag-value>
|
||||||
$if isAbsoluteURI tagValue
|
$if isAbsoluteURI tagValue
|
||||||
@ -69,7 +70,8 @@ $if elem AddPermission perms
|
|||||||
$forall (tagName, tagValue) <- filter (isPostingTag acc) $ filter isVisibleTag tags
|
$forall (tagName, tagValue) <- filter (isPostingTag acc) $ filter isVisibleTag tags
|
||||||
<li .tag title="#{mconcat [tagName, ": ", tagValue]}">
|
<li .tag title="#{mconcat [tagName, ": ", tagValue]}">
|
||||||
<div .tag-name>
|
<div .tag-name>
|
||||||
#{tagName}
|
<a href=@?{addTagQuery tagName tagValue}>
|
||||||
|
#{tagName}
|
||||||
$if not $ T.null $ T.strip tagValue
|
$if not $ T.null $ T.strip tagValue
|
||||||
<div .tag-value>
|
<div .tag-value>
|
||||||
$if isAbsoluteURI tagValue
|
$if isAbsoluteURI tagValue
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user