Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Darya Rednikina
elm_frontend
Commits
0d3e3f6e
Commit
0d3e3f6e
authored
Dec 18, 2019
by
Darya Rednikina
Browse files
fixed all errors from new elm-plugin
parent
446b3819
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/Login.elm
View file @
0d3e3f6e
module
Login
exposing
(
..
)
module
Login
exposing
(
Model
,
Msg
(
..
)
,
init
,
update
,
view
)
import
Browser
exposing
(
..
)
import
Html
exposing
(
..
)
import
Html
.
Attributes
exposing
(
..
)
import
Html
.
Events
exposing
(
..
)
import
Route
exposing
(
..
)
import
Validation
as
V
exposing
(
..
)
import
Html
exposing
(
Html
,
a
,
button
,
div
,
fieldset
,
h1
,
input
,
p
,
text
,
ul
)
import
Html
.
Attributes
exposing
(
class
,
placeholder
,
type_
,
value
)
import
Html
.
Events
exposing
(
onInput
,
onSubmit
)
import
Route
exposing
(
href
)
import
Validation
as
V
exposing
(
Problem
,
ValidatedField
,
viewProblem
)
init
:
(
Model
,
Cmd
Msg
)
...
...
@@ -58,7 +57,7 @@ update msg model =
SubmittedForm
->
case
validate
model
.
form
of
Ok
validForm
->
Ok
_
->
(
{
model
|
problems
=
[]
}
,
Cmd
.
none
)
...
...
@@ -148,8 +147,8 @@ trimFields form =
fieldsToValidate
:
List
ValidatedField
fieldsToValidate
=
[
Email
,
Password
[
V
.
Email
,
V
.
Password
]
...
...
@@ -180,7 +179,7 @@ validateField (Trimmed form) field =
in
List
.
map
(
V
.
InvalidEntry
field
)
<|
case
field
of
Email
->
V
.
Email
->
emptyValidation
form
.
email
"
email can't be blank."
_
->
...
...
src/Main.elm
View file @
0d3e3f6e
module
Main
exposing
(
..
)
module
Main
exposing
(
main
)
import
Browser
exposing
(
..
)
import
Browser
exposing
(
UrlRequest
,
application
)
import
Browser
.
Navigation
as
Nav
import
Html
exposing
(
..
)
import
Html
.
Attributes
exposing
(
..
)
import
Html
.
Events
exposing
(
..
)
import
Html
exposing
(
Html
,
h3
,
text
)
import
Login
exposing
(
Model
)
import
Register
exposing
(
Model
)
import
Route
exposing
(
..
)
import
Route
exposing
(
Route
)
import
Url
exposing
(
Url
)
...
...
@@ -143,7 +141,7 @@ main =
init
:
()
->
Url
->
Nav
.
Key
->
(
Model
,
Cmd
Msg
)
init
flags
url
navKey
=
init
_
url
navKey
=
let
model
=
{
route
=
Route
.
parseUrl
url
...
...
src/Register.elm
View file @
0d3e3f6e
module
Register
exposing
(
..
)
import
Browser
exposing
(
..
)
import
Html
exposing
(
..
)
import
Html
.
Attributes
exposing
(
..
)
import
Html
.
Events
exposing
(
..
)
import
List
exposing
(
..
)
import
Route
exposing
(
..
)
module
Register
exposing
(
Model
,
Msg
(
..
)
,
init
,
update
,
view
)
import
Html
exposing
(
Html
,
a
,
button
,
div
,
fieldset
,
h1
,
input
,
p
,
text
,
ul
)
import
Html
.
Attributes
exposing
(
class
,
placeholder
,
type_
,
value
)
import
Html
.
Events
exposing
(
onInput
,
onSubmit
)
import
Route
exposing
(
href
)
import
Validation
as
V
exposing
(
Problem
,
ValidatedField
)
...
...
@@ -68,7 +66,7 @@ update msg model =
SubmittedForm
->
case
validate
model
.
form
of
Ok
validForm
->
Ok
_
->
(
{
model
|
problems
=
[]
}
,
Cmd
.
none
)
...
...
src/Route.elm
View file @
0d3e3f6e
...
...
@@ -3,7 +3,7 @@ module Route exposing (Route(..), href, parseUrl)
import
Html
exposing
(
Attribute
)
import
Html
.
Attributes
as
Attr
import
Url
exposing
(
Url
)
import
Url
.
Parser
exposing
(
..
)
import
Url
.
Parser
exposing
(
Parser
,
map
,
oneOf
,
parse
,
s
,
top
)
type
Route
...
...
src/Validation.elm
View file @
0d3e3f6e
module
Validation
exposing
(
..
)
module
Validation
exposing
(
Problem
(
..
)
,
ValidatedField
(
..
)
,
viewProblem
)
import
Html
exposing
(
..
)
import
Html
.
Attributes
exposing
(
..
)
import
Html
exposing
(
Html
,
li
,
text
)
type
Problem
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment