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
7327a1b6
Verified
Commit
7327a1b6
authored
5 years ago
by
jan.hamal.dvorak
Browse files
Options
Downloads
Patches
Plain Diff
Adjust the FormNote signature
Signed-off-by:
Jan Hamal Dvořák
<
mordae@anilinux.org
>
parent
6245f978
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/Form.hs
+19
-19
19 additions, 19 deletions
lib/Hikaru/Form.hs
with
19 additions
and
19 deletions
lib/Hikaru/Form.hs
+
19
−
19
View file @
7327a1b6
...
@@ -14,6 +14,7 @@ module Hikaru.Form
...
@@ -14,6 +14,7 @@ module Hikaru.Form
(
MonadCsrf
(
..
)
(
MonadCsrf
(
..
)
,
View
(
..
)
,
View
(
..
)
,
FormNote
(
..
)
,
FormNote
(
..
)
,
NoteLevel
(
..
)
,
Form
,
Form
,
FieldT
,
FieldT
,
newForm
,
newForm
...
@@ -50,9 +51,7 @@ where
...
@@ -50,9 +51,7 @@ where
import
Data.Text
(
Text
,
strip
)
import
Data.Text
(
Text
,
strip
)
import
Hikaru.Action
import
Hikaru.Action
import
Hikaru.CSRF
import
Hikaru.CSRF
import
Hikaru.Localize
import
Hikaru.Types
import
Hikaru.Types
import
Lucid
-- Form Types --------------------------------------------------------------
-- Form Types --------------------------------------------------------------
...
@@ -111,24 +110,25 @@ where
...
@@ -111,24 +110,25 @@ where
mempty
=
FormFields
[]
[]
mempty
=
FormFields
[]
[]
-- |
-- TODO
--
data
FormNote
l
data
FormNote
l
=
NoteError
=
FormNote
{
noteLabel
::
l
{
noteLevel
::
NoteLevel
}
,
noteLabel
::
l
|
NoteNeutral
{
noteLabel
::
l
}
|
NoteSuccess
{
noteLabel
::
l
}
}
deriving
(
Eq
,
Ord
)
deriving
(
Eq
,
Ord
)
instance
(
ToHtml
l
)
=>
ToHtml
(
FormNote
l
)
where
toHtml
=
toHtml
.
noteLabel
toHtmlRaw
=
toHtmlRaw
.
noteLabel
instance
(
Localized
l
)
=>
Localized
(
FormNote
l
)
where
-- |
localize
lang
=
localize
lang
.
noteLabel
-- TODO
--
data
NoteLevel
=
NoteError
|
NoteNeutral
|
NoteSuccess
deriving
(
Eq
,
Ord
)
newtype
FormT
l
m
a
newtype
FormT
l
m
a
...
@@ -274,7 +274,7 @@ where
...
@@ -274,7 +274,7 @@ where
let
view
=
HiddenField
{
viewName
=
name'
let
view
=
HiddenField
{
viewName
=
name'
,
viewValue
=
Just
token
,
viewValue
=
Just
token
,
viewNotes
=
if
envCheck
&&
not
valid
,
viewNotes
=
if
envCheck
&&
not
valid
then
[
NoteError
msg
]
then
[
FormNote
NoteError
msg
]
else
[]
else
[]
,
viewAttrs
=
[]
,
viewAttrs
=
[]
}
}
...
@@ -483,7 +483,7 @@ where
...
@@ -483,7 +483,7 @@ where
whenChecking
do
whenChecking
do
value
<-
fieldValue
value
<-
fieldValue
case
value
of
case
value
of
Nothing
->
addNote
$
NoteError
label
Nothing
->
addNote
$
FormNote
NoteError
label
Just
_v
->
return
()
Just
_v
->
return
()
...
@@ -562,8 +562,8 @@ where
...
@@ -562,8 +562,8 @@ where
isErrorNote
::
FormNote
l
->
Bool
isErrorNote
::
FormNote
l
->
Bool
isErrorNote
NoteError
{}
=
True
isErrorNote
(
FormNote
NoteError
_
)
=
True
isErrorNote
_
=
False
isErrorNote
_
else
=
False
formParamMaybe
::
(
Monad
m
,
FromParam
a
)
=>
Text
->
FormT
l
m
(
Maybe
a
)
formParamMaybe
::
(
Monad
m
,
FromParam
a
)
=>
Text
->
FormT
l
m
(
Maybe
a
)
...
...
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