Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hikaru
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
hikaru
Commits
ba544e38
Verified
Commit
ba544e38
authored
5 years ago
by
jan.hamal.dvorak
Browse files
Options
Downloads
Patches
Plain Diff
Add link feedback
Signed-off-by:
Jan Hamal Dvořák
<
mordae@anilinux.org
>
parent
aef39a58
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Hikaru/Link.hs
+28
-1
28 additions, 1 deletion
lib/Hikaru/Link.hs
with
28 additions
and
1 deletion
lib/Hikaru/Link.hs
+
28
−
1
View file @
ba544e38
...
@@ -7,7 +7,8 @@ Maintainer : mordae@anilinux.org
...
@@ -7,7 +7,8 @@ Maintainer : mordae@anilinux.org
Stability : unstable
Stability : unstable
Portability : non-portable (ghc)
Portability : non-portable (ghc)
This module provides various ways to build local links.
This module provides various ways to build local links and provide
feedback based on the request path.
-}
-}
module
Hikaru.Link
module
Hikaru.Link
...
@@ -18,6 +19,10 @@ module Hikaru.Link
...
@@ -18,6 +19,10 @@ module Hikaru.Link
,
lhref_
,
lhref_
,
phref_
,
phref_
,
qhref_
,
qhref_
-- ** Path Feedback
,
isActivePath
,
isActivePrefix
)
)
where
where
import
BasePrelude
import
BasePrelude
...
@@ -96,4 +101,26 @@ where
...
@@ -96,4 +101,26 @@ where
qhref_
qs
=
href_
(
makeLink
[]
qs
)
qhref_
qs
=
href_
(
makeLink
[]
qs
)
-- Path Feedback -----------------------------------------------------------
-- |
-- Determine whether the supplied path is the one user has requested.
--
isActivePath
::
(
MonadAction
m
)
=>
[
Text
]
->
m
Bool
isActivePath
link
=
do
path
<-
getPathInfo
return
$
link
==
path
-- |
-- Determine whether the supplied path is a prefix of the one user has
-- requested. Empty path components in the supplied path are ignored.
--
isActivePrefix
::
(
MonadAction
m
)
=>
[
Text
]
->
m
Bool
isActivePrefix
link
=
do
path
<-
getPathInfo
return
$
isPrefixOf
(
filter
(
/=
""
)
link
)
path
-- vim:set ft=haskell sw=2 ts=2 et:
-- vim:set ft=haskell sw=2 ts=2 et:
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment