aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2017-03-26 21:10:42 +0200
committerJoris2017-03-26 21:10:42 +0200
commit1e47a7754ca38bd1a6c74765d8378caf68ce4619 (patch)
treed0d9238479dc2529a1b558bbbcde346e7e8c2935
parentc0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456 (diff)
Separate client and server watch
-rw-r--r--.gitignore2
-rw-r--r--.tmuxinator.yml5
-rw-r--r--Makefile56
-rw-r--r--elm-package.json2
-rw-r--r--public/javascripts/main.js (renamed from src/client/js/main.js)0
-rw-r--r--src/client/Dialog.elm (renamed from src/client/elm/Dialog.elm)0
-rw-r--r--src/client/Dialog/AddCategory/Model.elm (renamed from src/client/elm/Dialog/AddCategory/Model.elm)1
-rw-r--r--src/client/Dialog/AddCategory/View.elm (renamed from src/client/elm/Dialog/AddCategory/View.elm)0
-rw-r--r--src/client/Dialog/AddIncome/Model.elm (renamed from src/client/elm/Dialog/AddIncome/Model.elm)0
-rw-r--r--src/client/Dialog/AddIncome/View.elm (renamed from src/client/elm/Dialog/AddIncome/View.elm)0
-rw-r--r--src/client/Dialog/AddPayment/Model.elm (renamed from src/client/elm/Dialog/AddPayment/Model.elm)2
-rw-r--r--src/client/Dialog/AddPayment/View.elm (renamed from src/client/elm/Dialog/AddPayment/View.elm)0
-rw-r--r--src/client/Dialog/Model.elm (renamed from src/client/elm/Dialog/Model.elm)9
-rw-r--r--src/client/Dialog/Msg.elm (renamed from src/client/elm/Dialog/Msg.elm)0
-rw-r--r--src/client/Dialog/Update.elm (renamed from src/client/elm/Dialog/Update.elm)0
-rw-r--r--src/client/Init.elm (renamed from src/client/elm/Init.elm)0
-rw-r--r--src/client/LoggedData.elm (renamed from src/client/elm/LoggedData.elm)0
-rw-r--r--src/client/LoggedIn/Category/Model.elm (renamed from src/client/elm/LoggedIn/Category/Model.elm)0
-rw-r--r--src/client/LoggedIn/Category/Msg.elm (renamed from src/client/elm/LoggedIn/Category/Msg.elm)0
-rw-r--r--src/client/LoggedIn/Category/Table/View.elm (renamed from src/client/elm/LoggedIn/Category/Table/View.elm)0
-rw-r--r--src/client/LoggedIn/Category/Update.elm (renamed from src/client/elm/LoggedIn/Category/Update.elm)0
-rw-r--r--src/client/LoggedIn/Category/View.elm (renamed from src/client/elm/LoggedIn/Category/View.elm)0
-rw-r--r--src/client/LoggedIn/Home/Header/View.elm (renamed from src/client/elm/LoggedIn/Home/Header/View.elm)0
-rw-r--r--src/client/LoggedIn/Home/Model.elm (renamed from src/client/elm/LoggedIn/Home/Model.elm)0
-rw-r--r--src/client/LoggedIn/Home/Msg.elm (renamed from src/client/elm/LoggedIn/Home/Msg.elm)0
-rw-r--r--src/client/LoggedIn/Home/Update.elm (renamed from src/client/elm/LoggedIn/Home/Update.elm)0
-rw-r--r--src/client/LoggedIn/Home/View.elm (renamed from src/client/elm/LoggedIn/Home/View.elm)0
-rw-r--r--src/client/LoggedIn/Home/View/ExceedingPayers.elm (renamed from src/client/elm/LoggedIn/Home/View/ExceedingPayers.elm)0
-rw-r--r--src/client/LoggedIn/Home/View/Paging.elm (renamed from src/client/elm/LoggedIn/Home/View/Paging.elm)0
-rw-r--r--src/client/LoggedIn/Home/View/Table.elm (renamed from src/client/elm/LoggedIn/Home/View/Table.elm)0
-rw-r--r--src/client/LoggedIn/Income/Model.elm (renamed from src/client/elm/LoggedIn/Income/Model.elm)0
-rw-r--r--src/client/LoggedIn/Income/Msg.elm (renamed from src/client/elm/LoggedIn/Income/Msg.elm)0
-rw-r--r--src/client/LoggedIn/Income/Update.elm (renamed from src/client/elm/LoggedIn/Income/Update.elm)0
-rw-r--r--src/client/LoggedIn/Income/View.elm (renamed from src/client/elm/LoggedIn/Income/View.elm)0
-rw-r--r--src/client/LoggedIn/Income/View/Table.elm (renamed from src/client/elm/LoggedIn/Income/View/Table.elm)0
-rw-r--r--src/client/LoggedIn/Model.elm (renamed from src/client/elm/LoggedIn/Model.elm)0
-rw-r--r--src/client/LoggedIn/Msg.elm (renamed from src/client/elm/LoggedIn/Msg.elm)0
-rw-r--r--src/client/LoggedIn/Stat/View.elm (renamed from src/client/elm/LoggedIn/Stat/View.elm)0
-rw-r--r--src/client/LoggedIn/Update.elm (renamed from src/client/elm/LoggedIn/Update.elm)0
-rw-r--r--src/client/LoggedIn/View.elm (renamed from src/client/elm/LoggedIn/View.elm)0
-rw-r--r--src/client/LoggedIn/View/Format.elm (renamed from src/client/elm/LoggedIn/View/Format.elm)0
-rw-r--r--src/client/Main.elm (renamed from src/client/elm/Main.elm)0
-rw-r--r--src/client/Model.elm (renamed from src/client/elm/Model.elm)0
-rw-r--r--src/client/Model/Category.elm (renamed from src/client/elm/Model/Category.elm)0
-rw-r--r--src/client/Model/Conf.elm (renamed from src/client/elm/Model/Conf.elm)0
-rw-r--r--src/client/Model/Date.elm (renamed from src/client/elm/Model/Date.elm)0
-rw-r--r--src/client/Model/Income.elm (renamed from src/client/elm/Model/Income.elm)0
-rw-r--r--src/client/Model/Init.elm (renamed from src/client/elm/Model/Init.elm)0
-rw-r--r--src/client/Model/InitResult.elm (renamed from src/client/elm/Model/InitResult.elm)0
-rw-r--r--src/client/Model/Payer.elm (renamed from src/client/elm/Model/Payer.elm)0
-rw-r--r--src/client/Model/Payment.elm (renamed from src/client/elm/Model/Payment.elm)0
-rw-r--r--src/client/Model/PaymentCategory.elm (renamed from src/client/elm/Model/PaymentCategory.elm)0
-rw-r--r--src/client/Model/Size.elm (renamed from src/client/elm/Model/Size.elm)0
-rw-r--r--src/client/Model/Translations.elm (renamed from src/client/elm/Model/Translations.elm)0
-rw-r--r--src/client/Model/User.elm (renamed from src/client/elm/Model/User.elm)0
-rw-r--r--src/client/Model/View.elm (renamed from src/client/elm/Model/View.elm)0
-rw-r--r--src/client/Msg.elm (renamed from src/client/elm/Msg.elm)0
-rw-r--r--src/client/Page.elm (renamed from src/client/elm/Page.elm)0
-rw-r--r--src/client/Server.elm (renamed from src/client/elm/Server.elm)0
-rw-r--r--src/client/SignIn/Model.elm (renamed from src/client/elm/SignIn/Model.elm)0
-rw-r--r--src/client/SignIn/Msg.elm (renamed from src/client/elm/SignIn/Msg.elm)0
-rw-r--r--src/client/SignIn/Update.elm (renamed from src/client/elm/SignIn/Update.elm)0
-rw-r--r--src/client/SignIn/View.elm (renamed from src/client/elm/SignIn/View.elm)0
-rw-r--r--src/client/Tooltip.elm (renamed from src/client/elm/Tooltip.elm)0
-rw-r--r--src/client/Update.elm (renamed from src/client/elm/Update.elm)0
-rw-r--r--src/client/Utils/Cmd.elm (renamed from src/client/elm/Utils/Cmd.elm)0
-rw-r--r--src/client/Utils/Dict.elm (renamed from src/client/elm/Utils/Dict.elm)0
-rw-r--r--src/client/Utils/Either.elm (renamed from src/client/elm/Utils/Either.elm)0
-rw-r--r--src/client/Utils/Form.elm (renamed from src/client/elm/Utils/Form.elm)0
-rw-r--r--src/client/Utils/Http.elm (renamed from src/client/elm/Utils/Http.elm)0
-rw-r--r--src/client/Utils/Json.elm (renamed from src/client/elm/Utils/Json.elm)0
-rw-r--r--src/client/Utils/List.elm (renamed from src/client/elm/Utils/List.elm)0
-rw-r--r--src/client/Utils/Maybe.elm (renamed from src/client/elm/Utils/Maybe.elm)0
-rw-r--r--src/client/Utils/Search.elm (renamed from src/client/elm/Utils/Search.elm)0
-rw-r--r--src/client/Utils/String.elm (renamed from src/client/elm/Utils/String.elm)0
-rw-r--r--src/client/Validation.elm (renamed from src/client/elm/Validation.elm)25
-rw-r--r--src/client/View.elm (renamed from src/client/elm/View.elm)0
-rw-r--r--src/client/View/Color.elm (renamed from src/client/elm/View/Color.elm)0
-rw-r--r--src/client/View/Date.elm (renamed from src/client/elm/View/Date.elm)0
-rw-r--r--src/client/View/Errors.elm (renamed from src/client/elm/View/Errors.elm)0
-rw-r--r--src/client/View/Events.elm (renamed from src/client/elm/View/Events.elm)0
-rw-r--r--src/client/View/Form.elm (renamed from src/client/elm/View/Form.elm)0
-rw-r--r--src/client/View/Header.elm (renamed from src/client/elm/View/Header.elm)0
-rw-r--r--src/client/View/Plural.elm (renamed from src/client/elm/View/Plural.elm)0
-rw-r--r--src/server/Main.hs19
-rw-r--r--src/server/Model/Message/Key.hs1
-rw-r--r--src/server/Model/Message/Translations.hs5
87 files changed, 55 insertions, 72 deletions
diff --git a/.gitignore b/.gitignore
index 9835d03..4765b25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,6 @@ database-shm
database-wal
elm-stuff/
.stack-work
-public/javascripts
+public/javascripts/client.js
sessionKey
local.conf
diff --git a/.tmuxinator.yml b/.tmuxinator.yml
index 1f3a804..d8b97c5 100644
--- a/.tmuxinator.yml
+++ b/.tmuxinator.yml
@@ -2,9 +2,10 @@ name: sharedCost
windows:
- main:
- layout: fff4,119x58,0,0{94x58,0,0,0,24x58,95,0,1}
+ layout: 3747,239x59,0,0{144x59,0,0,0,94x59,145,0[94x30,145,0,1,94x28,145,31,2]}
panes:
- # Empty
- - make install build watch
+ - make install-client watch-client
+ - make install-server watch-server
- db:
- sqlite3 database
diff --git a/Makefile b/Makefile
index 72ab852..2717f9b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,50 +1,32 @@
-all: build
+# Server
+# ------
-clean:
+clean-server:
@stack clean > /dev/null
- @rm -r elm-stuff >/dev/null 2>&1 || true
-install:
+install-server:
@stack setup
- @elm package install --yes
-
-# Watch
-# -----
-
-watch: watch-server watch-elm watch-js
-
-watch-server:
- @nodemon -e hs,conf --exec 'clear && make build-and-launch-server --silent' &
-
-watch-elm:
- @nodemon -e elm --exec 'clear && make build-elm --silent' &
-
-watch-js:
- @nodemon --watch src/client/js --exec 'make build-js --silent'
-# Build and launch
-# ----------------
-
-build-and-launch-server: build-server kill-server launch-server
+build-server:
+ @stack build || :
launch-server:
- @stack exec sharedCost &
-
-kill-server:
- @killall sharedCost || :
+ @(killall sharedCost || :) && stack exec sharedCost
+watch-server:
+ @nodemon -e hs,conf --exec 'clear && make build-server --silent && make launch-server'
-# Build
-# -----
+# Client
+# ------
-.PHONY: build
-build: build-server build-elm build-js
+clean-client:
+ @rm -r elm-stuff >/dev/null 2>&1 || true
-build-server:
- @stack build || true
+install-client:
+ @elm package install --yes
-build-elm:
- @elm make src/client/elm/Main.elm --output public/javascripts/client.js || true
+build-client:
+ @elm make src/client/Main.elm --output public/javascripts/client.js || true
-build-js:
- @cp src/client/js/main.js public/javascripts/main.js || true
+watch-client:
+ @nodemon -e elm --exec 'clear && make build-client --silent'
diff --git a/elm-package.json b/elm-package.json
index 19674fe..5f76d18 100644
--- a/elm-package.json
+++ b/elm-package.json
@@ -3,7 +3,7 @@
"summary": "SharedCost",
"repository": "https://github.com/guyonvarch/sharedcost.git",
"license": "GPL-3",
- "source-directories": [ "src/client/elm" ],
+ "source-directories": [ "src/client" ],
"exposed-modules": [],
"elm-version": "0.18.0 <= v < 0.19.0",
"dependencies": {
diff --git a/src/client/js/main.js b/public/javascripts/main.js
index 3c3d797..3c3d797 100644
--- a/src/client/js/main.js
+++ b/public/javascripts/main.js
diff --git a/src/client/elm/Dialog.elm b/src/client/Dialog.elm
index a7e059a..a7e059a 100644
--- a/src/client/elm/Dialog.elm
+++ b/src/client/Dialog.elm
diff --git a/src/client/elm/Dialog/AddCategory/Model.elm b/src/client/Dialog/AddCategory/Model.elm
index 8aeec1a..7496c2b 100644
--- a/src/client/elm/Dialog/AddCategory/Model.elm
+++ b/src/client/Dialog/AddCategory/Model.elm
@@ -13,7 +13,6 @@ import View.Date as Date
import Form exposing (Form)
import Form.Field as Field exposing (Field)
import Form.Validate as Validate exposing (Validation)
-import Validation
import Model.Translations exposing (Translations)
import Model.Category exposing (Category, CategoryId)
diff --git a/src/client/elm/Dialog/AddCategory/View.elm b/src/client/Dialog/AddCategory/View.elm
index 6c02351..6c02351 100644
--- a/src/client/elm/Dialog/AddCategory/View.elm
+++ b/src/client/Dialog/AddCategory/View.elm
diff --git a/src/client/elm/Dialog/AddIncome/Model.elm b/src/client/Dialog/AddIncome/Model.elm
index ad7b25a..ad7b25a 100644
--- a/src/client/elm/Dialog/AddIncome/Model.elm
+++ b/src/client/Dialog/AddIncome/Model.elm
diff --git a/src/client/elm/Dialog/AddIncome/View.elm b/src/client/Dialog/AddIncome/View.elm
index b413308..b413308 100644
--- a/src/client/elm/Dialog/AddIncome/View.elm
+++ b/src/client/Dialog/AddIncome/View.elm
diff --git a/src/client/elm/Dialog/AddPayment/Model.elm b/src/client/Dialog/AddPayment/Model.elm
index a287d37..11d59b1 100644
--- a/src/client/elm/Dialog/AddPayment/Model.elm
+++ b/src/client/Dialog/AddPayment/Model.elm
@@ -64,7 +64,7 @@ validation categories =
Validate.map6 Model
(Validate.field "id" (Validate.maybe Validate.int))
(Validate.field "name" (Validate.string |> Validate.andThen Validate.nonEmpty))
- (Validate.field "cost" (Validate.int |> Validate.andThen (Validate.minInt 1)))
+ (Validate.field "cost" Validation.cost)
(Validate.field "date" Validation.date)
(Validate.field "category" (Validation.category categories))
(Validate.field "frequency" Payment.validateFrequency)
diff --git a/src/client/elm/Dialog/AddPayment/View.elm b/src/client/Dialog/AddPayment/View.elm
index 078d5b7..078d5b7 100644
--- a/src/client/elm/Dialog/AddPayment/View.elm
+++ b/src/client/Dialog/AddPayment/View.elm
diff --git a/src/client/elm/Dialog/Model.elm b/src/client/Dialog/Model.elm
index d4fd484..ff8bc57 100644
--- a/src/client/elm/Dialog/Model.elm
+++ b/src/client/Dialog/Model.elm
@@ -3,16 +3,7 @@ module Dialog.Model exposing
, init
)
-import Date exposing (Date)
-import View.Date as Date
-
import Form exposing (Form)
-import Form.Field as Field exposing (Field)
-import Form.Validate as Validate exposing (Validation)
-import Validation
-
-import Model.Payment as Payment exposing (Payment, Frequency, PaymentId)
-import Model.Translations exposing (Translations)
import Dialog.AddPayment.Model as AddPayment
import Dialog.AddIncome.Model as AddIncome
diff --git a/src/client/elm/Dialog/Msg.elm b/src/client/Dialog/Msg.elm
index 68ed146..68ed146 100644
--- a/src/client/elm/Dialog/Msg.elm
+++ b/src/client/Dialog/Msg.elm
diff --git a/src/client/elm/Dialog/Update.elm b/src/client/Dialog/Update.elm
index 3915548..3915548 100644
--- a/src/client/elm/Dialog/Update.elm
+++ b/src/client/Dialog/Update.elm
diff --git a/src/client/elm/Init.elm b/src/client/Init.elm
index d87e870..d87e870 100644
--- a/src/client/elm/Init.elm
+++ b/src/client/Init.elm
diff --git a/src/client/elm/LoggedData.elm b/src/client/LoggedData.elm
index 9bb0a7f..9bb0a7f 100644
--- a/src/client/elm/LoggedData.elm
+++ b/src/client/LoggedData.elm
diff --git a/src/client/elm/LoggedIn/Category/Model.elm b/src/client/LoggedIn/Category/Model.elm
index 7092fc4..7092fc4 100644
--- a/src/client/elm/LoggedIn/Category/Model.elm
+++ b/src/client/LoggedIn/Category/Model.elm
diff --git a/src/client/elm/LoggedIn/Category/Msg.elm b/src/client/LoggedIn/Category/Msg.elm
index 3184297..3184297 100644
--- a/src/client/elm/LoggedIn/Category/Msg.elm
+++ b/src/client/LoggedIn/Category/Msg.elm
diff --git a/src/client/elm/LoggedIn/Category/Table/View.elm b/src/client/LoggedIn/Category/Table/View.elm
index fa7a7b1..fa7a7b1 100644
--- a/src/client/elm/LoggedIn/Category/Table/View.elm
+++ b/src/client/LoggedIn/Category/Table/View.elm
diff --git a/src/client/elm/LoggedIn/Category/Update.elm b/src/client/LoggedIn/Category/Update.elm
index 1072ef0..1072ef0 100644
--- a/src/client/elm/LoggedIn/Category/Update.elm
+++ b/src/client/LoggedIn/Category/Update.elm
diff --git a/src/client/elm/LoggedIn/Category/View.elm b/src/client/LoggedIn/Category/View.elm
index 4e04fa2..4e04fa2 100644
--- a/src/client/elm/LoggedIn/Category/View.elm
+++ b/src/client/LoggedIn/Category/View.elm
diff --git a/src/client/elm/LoggedIn/Home/Header/View.elm b/src/client/LoggedIn/Home/Header/View.elm
index 3f8a320..3f8a320 100644
--- a/src/client/elm/LoggedIn/Home/Header/View.elm
+++ b/src/client/LoggedIn/Home/Header/View.elm
diff --git a/src/client/elm/LoggedIn/Home/Model.elm b/src/client/LoggedIn/Home/Model.elm
index ace1593..ace1593 100644
--- a/src/client/elm/LoggedIn/Home/Model.elm
+++ b/src/client/LoggedIn/Home/Model.elm
diff --git a/src/client/elm/LoggedIn/Home/Msg.elm b/src/client/LoggedIn/Home/Msg.elm
index b5f2566..b5f2566 100644
--- a/src/client/elm/LoggedIn/Home/Msg.elm
+++ b/src/client/LoggedIn/Home/Msg.elm
diff --git a/src/client/elm/LoggedIn/Home/Update.elm b/src/client/LoggedIn/Home/Update.elm
index b0ce256..b0ce256 100644
--- a/src/client/elm/LoggedIn/Home/Update.elm
+++ b/src/client/LoggedIn/Home/Update.elm
diff --git a/src/client/elm/LoggedIn/Home/View.elm b/src/client/LoggedIn/Home/View.elm
index 0b90e67..0b90e67 100644
--- a/src/client/elm/LoggedIn/Home/View.elm
+++ b/src/client/LoggedIn/Home/View.elm
diff --git a/src/client/elm/LoggedIn/Home/View/ExceedingPayers.elm b/src/client/LoggedIn/Home/View/ExceedingPayers.elm
index 6f2439c..6f2439c 100644
--- a/src/client/elm/LoggedIn/Home/View/ExceedingPayers.elm
+++ b/src/client/LoggedIn/Home/View/ExceedingPayers.elm
diff --git a/src/client/elm/LoggedIn/Home/View/Paging.elm b/src/client/LoggedIn/Home/View/Paging.elm
index dffe061..dffe061 100644
--- a/src/client/elm/LoggedIn/Home/View/Paging.elm
+++ b/src/client/LoggedIn/Home/View/Paging.elm
diff --git a/src/client/elm/LoggedIn/Home/View/Table.elm b/src/client/LoggedIn/Home/View/Table.elm
index 8828488..8828488 100644
--- a/src/client/elm/LoggedIn/Home/View/Table.elm
+++ b/src/client/LoggedIn/Home/View/Table.elm
diff --git a/src/client/elm/LoggedIn/Income/Model.elm b/src/client/LoggedIn/Income/Model.elm
index 7d852b9..7d852b9 100644
--- a/src/client/elm/LoggedIn/Income/Model.elm
+++ b/src/client/LoggedIn/Income/Model.elm
diff --git a/src/client/elm/LoggedIn/Income/Msg.elm b/src/client/LoggedIn/Income/Msg.elm
index 0a09dad..0a09dad 100644
--- a/src/client/elm/LoggedIn/Income/Msg.elm
+++ b/src/client/LoggedIn/Income/Msg.elm
diff --git a/src/client/elm/LoggedIn/Income/Update.elm b/src/client/LoggedIn/Income/Update.elm
index 0023c76..0023c76 100644
--- a/src/client/elm/LoggedIn/Income/Update.elm
+++ b/src/client/LoggedIn/Income/Update.elm
diff --git a/src/client/elm/LoggedIn/Income/View.elm b/src/client/LoggedIn/Income/View.elm
index 00a1646..00a1646 100644
--- a/src/client/elm/LoggedIn/Income/View.elm
+++ b/src/client/LoggedIn/Income/View.elm
diff --git a/src/client/elm/LoggedIn/Income/View/Table.elm b/src/client/LoggedIn/Income/View/Table.elm
index aa5e392..aa5e392 100644
--- a/src/client/elm/LoggedIn/Income/View/Table.elm
+++ b/src/client/LoggedIn/Income/View/Table.elm
diff --git a/src/client/elm/LoggedIn/Model.elm b/src/client/LoggedIn/Model.elm
index 6bcb0b2..6bcb0b2 100644
--- a/src/client/elm/LoggedIn/Model.elm
+++ b/src/client/LoggedIn/Model.elm
diff --git a/src/client/elm/LoggedIn/Msg.elm b/src/client/LoggedIn/Msg.elm
index a1379a6..a1379a6 100644
--- a/src/client/elm/LoggedIn/Msg.elm
+++ b/src/client/LoggedIn/Msg.elm
diff --git a/src/client/elm/LoggedIn/Stat/View.elm b/src/client/LoggedIn/Stat/View.elm
index f57316a..f57316a 100644
--- a/src/client/elm/LoggedIn/Stat/View.elm
+++ b/src/client/LoggedIn/Stat/View.elm
diff --git a/src/client/elm/LoggedIn/Update.elm b/src/client/LoggedIn/Update.elm
index 9e6d6ee..9e6d6ee 100644
--- a/src/client/elm/LoggedIn/Update.elm
+++ b/src/client/LoggedIn/Update.elm
diff --git a/src/client/elm/LoggedIn/View.elm b/src/client/LoggedIn/View.elm
index 2e42a73..2e42a73 100644
--- a/src/client/elm/LoggedIn/View.elm
+++ b/src/client/LoggedIn/View.elm
diff --git a/src/client/elm/LoggedIn/View/Format.elm b/src/client/LoggedIn/View/Format.elm
index f41e2cd..f41e2cd 100644
--- a/src/client/elm/LoggedIn/View/Format.elm
+++ b/src/client/LoggedIn/View/Format.elm
diff --git a/src/client/elm/Main.elm b/src/client/Main.elm
index 9674b66..9674b66 100644
--- a/src/client/elm/Main.elm
+++ b/src/client/Main.elm
diff --git a/src/client/elm/Model.elm b/src/client/Model.elm
index 5167e42..5167e42 100644
--- a/src/client/elm/Model.elm
+++ b/src/client/Model.elm
diff --git a/src/client/elm/Model/Category.elm b/src/client/Model/Category.elm
index 8b653a7..8b653a7 100644
--- a/src/client/elm/Model/Category.elm
+++ b/src/client/Model/Category.elm
diff --git a/src/client/elm/Model/Conf.elm b/src/client/Model/Conf.elm
index 308fa04..308fa04 100644
--- a/src/client/elm/Model/Conf.elm
+++ b/src/client/Model/Conf.elm
diff --git a/src/client/elm/Model/Date.elm b/src/client/Model/Date.elm
index bfba02f..bfba02f 100644
--- a/src/client/elm/Model/Date.elm
+++ b/src/client/Model/Date.elm
diff --git a/src/client/elm/Model/Income.elm b/src/client/Model/Income.elm
index 34578c6..34578c6 100644
--- a/src/client/elm/Model/Income.elm
+++ b/src/client/Model/Income.elm
diff --git a/src/client/elm/Model/Init.elm b/src/client/Model/Init.elm
index db7069f..db7069f 100644
--- a/src/client/elm/Model/Init.elm
+++ b/src/client/Model/Init.elm
diff --git a/src/client/elm/Model/InitResult.elm b/src/client/Model/InitResult.elm
index 7ce0be2..7ce0be2 100644
--- a/src/client/elm/Model/InitResult.elm
+++ b/src/client/Model/InitResult.elm
diff --git a/src/client/elm/Model/Payer.elm b/src/client/Model/Payer.elm
index 1663273..1663273 100644
--- a/src/client/elm/Model/Payer.elm
+++ b/src/client/Model/Payer.elm
diff --git a/src/client/elm/Model/Payment.elm b/src/client/Model/Payment.elm
index f61ded8..f61ded8 100644
--- a/src/client/elm/Model/Payment.elm
+++ b/src/client/Model/Payment.elm
diff --git a/src/client/elm/Model/PaymentCategory.elm b/src/client/Model/PaymentCategory.elm
index 87678fe..87678fe 100644
--- a/src/client/elm/Model/PaymentCategory.elm
+++ b/src/client/Model/PaymentCategory.elm
diff --git a/src/client/elm/Model/Size.elm b/src/client/Model/Size.elm
index f40fb01..f40fb01 100644
--- a/src/client/elm/Model/Size.elm
+++ b/src/client/Model/Size.elm
diff --git a/src/client/elm/Model/Translations.elm b/src/client/Model/Translations.elm
index 9b314e1..9b314e1 100644
--- a/src/client/elm/Model/Translations.elm
+++ b/src/client/Model/Translations.elm
diff --git a/src/client/elm/Model/User.elm b/src/client/Model/User.elm
index f6e8147..f6e8147 100644
--- a/src/client/elm/Model/User.elm
+++ b/src/client/Model/User.elm
diff --git a/src/client/elm/Model/View.elm b/src/client/Model/View.elm
index 61d42a7..61d42a7 100644
--- a/src/client/elm/Model/View.elm
+++ b/src/client/Model/View.elm
diff --git a/src/client/elm/Msg.elm b/src/client/Msg.elm
index cf592aa..cf592aa 100644
--- a/src/client/elm/Msg.elm
+++ b/src/client/Msg.elm
diff --git a/src/client/elm/Page.elm b/src/client/Page.elm
index 39232e0..39232e0 100644
--- a/src/client/elm/Page.elm
+++ b/src/client/Page.elm
diff --git a/src/client/elm/Server.elm b/src/client/Server.elm
index 7f25876..7f25876 100644
--- a/src/client/elm/Server.elm
+++ b/src/client/Server.elm
diff --git a/src/client/elm/SignIn/Model.elm b/src/client/SignIn/Model.elm
index 19d4305..19d4305 100644
--- a/src/client/elm/SignIn/Model.elm
+++ b/src/client/SignIn/Model.elm
diff --git a/src/client/elm/SignIn/Msg.elm b/src/client/SignIn/Msg.elm
index f753ebd..f753ebd 100644
--- a/src/client/elm/SignIn/Msg.elm
+++ b/src/client/SignIn/Msg.elm
diff --git a/src/client/elm/SignIn/Update.elm b/src/client/SignIn/Update.elm
index 98de777..98de777 100644
--- a/src/client/elm/SignIn/Update.elm
+++ b/src/client/SignIn/Update.elm
diff --git a/src/client/elm/SignIn/View.elm b/src/client/SignIn/View.elm
index 88f74b0..88f74b0 100644
--- a/src/client/elm/SignIn/View.elm
+++ b/src/client/SignIn/View.elm
diff --git a/src/client/elm/Tooltip.elm b/src/client/Tooltip.elm
index 4f70cda..4f70cda 100644
--- a/src/client/elm/Tooltip.elm
+++ b/src/client/Tooltip.elm
diff --git a/src/client/elm/Update.elm b/src/client/Update.elm
index 7006d5a..7006d5a 100644
--- a/src/client/elm/Update.elm
+++ b/src/client/Update.elm
diff --git a/src/client/elm/Utils/Cmd.elm b/src/client/Utils/Cmd.elm
index 5f41cbe..5f41cbe 100644
--- a/src/client/elm/Utils/Cmd.elm
+++ b/src/client/Utils/Cmd.elm
diff --git a/src/client/elm/Utils/Dict.elm b/src/client/Utils/Dict.elm
index 7d708e2..7d708e2 100644
--- a/src/client/elm/Utils/Dict.elm
+++ b/src/client/Utils/Dict.elm
diff --git a/src/client/elm/Utils/Either.elm b/src/client/Utils/Either.elm
index 275fc8c..275fc8c 100644
--- a/src/client/elm/Utils/Either.elm
+++ b/src/client/Utils/Either.elm
diff --git a/src/client/elm/Utils/Form.elm b/src/client/Utils/Form.elm
index 8d75a32..8d75a32 100644
--- a/src/client/elm/Utils/Form.elm
+++ b/src/client/Utils/Form.elm
diff --git a/src/client/elm/Utils/Http.elm b/src/client/Utils/Http.elm
index dd3870a..dd3870a 100644
--- a/src/client/elm/Utils/Http.elm
+++ b/src/client/Utils/Http.elm
diff --git a/src/client/elm/Utils/Json.elm b/src/client/Utils/Json.elm
index 29e815b..29e815b 100644
--- a/src/client/elm/Utils/Json.elm
+++ b/src/client/Utils/Json.elm
diff --git a/src/client/elm/Utils/List.elm b/src/client/Utils/List.elm
index cc57d9f..cc57d9f 100644
--- a/src/client/elm/Utils/List.elm
+++ b/src/client/Utils/List.elm
diff --git a/src/client/elm/Utils/Maybe.elm b/src/client/Utils/Maybe.elm
index 46456e1..46456e1 100644
--- a/src/client/elm/Utils/Maybe.elm
+++ b/src/client/Utils/Maybe.elm
diff --git a/src/client/elm/Utils/Search.elm b/src/client/Utils/Search.elm
index 1b70387..1b70387 100644
--- a/src/client/elm/Utils/Search.elm
+++ b/src/client/Utils/Search.elm
diff --git a/src/client/elm/Utils/String.elm b/src/client/Utils/String.elm
index 90fe68e..90fe68e 100644
--- a/src/client/elm/Utils/String.elm
+++ b/src/client/Utils/String.elm
diff --git a/src/client/elm/Validation.elm b/src/client/Validation.elm
index 18b3934..4781c3d 100644
--- a/src/client/elm/Validation.elm
+++ b/src/client/Validation.elm
@@ -1,5 +1,6 @@
module Validation exposing
- ( date
+ ( cost
+ , date
, category
)
@@ -9,30 +10,38 @@ import Date.Extra.Create exposing (dateFromFields)
import Dict
import String exposing (toInt, split)
-import Form.Validate as Validate exposing (..)
+import Form.Validate as Validate exposing (Validation)
import Model.Category exposing (Categories, CategoryId)
+cost : Validation String Int
+cost =
+ Validate.customValidation Validate.int (\n ->
+ if n == 0
+ then Err (Validate.customError "CostMustNotBeNull")
+ else Ok n
+ )
+
date : Validation String Date
date =
- customValidation string (\str ->
+ Validate.customValidation Validate.string (\str ->
case split "/" str of
[day, month, year] ->
case (toInt day, toInt month, toInt year) of
(Ok dayNum, Ok monthNum, Ok yearNum) ->
Ok (dateFromFields yearNum (intToMonth monthNum) dayNum 0 0 0 0)
- _ -> Err (customError "InvalidDate")
- _ -> Err (customError "InvalidDate")
+ _ -> Err (Validate.customError "InvalidDate")
+ _ -> Err (Validate.customError "InvalidDate")
)
category : Categories -> Validation String CategoryId
category categories =
- customValidation string (\str ->
+ Validate.customValidation Validate.string (\str ->
case toInt str of
Ok category ->
if List.member category (Dict.keys categories)
then Ok category
- else Err (customError "InvalidCategory")
+ else Err (Validate.customError "InvalidCategory")
Err _ ->
- Err (customError "InvalidCategory")
+ Err (Validate.customError "InvalidCategory")
)
diff --git a/src/client/elm/View.elm b/src/client/View.elm
index 66c498a..66c498a 100644
--- a/src/client/elm/View.elm
+++ b/src/client/View.elm
diff --git a/src/client/elm/View/Color.elm b/src/client/View/Color.elm
index a2a20c7..a2a20c7 100644
--- a/src/client/elm/View/Color.elm
+++ b/src/client/View/Color.elm
diff --git a/src/client/elm/View/Date.elm b/src/client/View/Date.elm
index 35806ba..35806ba 100644
--- a/src/client/elm/View/Date.elm
+++ b/src/client/View/Date.elm
diff --git a/src/client/elm/View/Errors.elm b/src/client/View/Errors.elm
index 3e25c99..3e25c99 100644
--- a/src/client/elm/View/Errors.elm
+++ b/src/client/View/Errors.elm
diff --git a/src/client/elm/View/Events.elm b/src/client/View/Events.elm
index d71d67d..d71d67d 100644
--- a/src/client/elm/View/Events.elm
+++ b/src/client/View/Events.elm
diff --git a/src/client/elm/View/Form.elm b/src/client/View/Form.elm
index 7a4965d..7a4965d 100644
--- a/src/client/elm/View/Form.elm
+++ b/src/client/View/Form.elm
diff --git a/src/client/elm/View/Header.elm b/src/client/View/Header.elm
index 12fb87c..12fb87c 100644
--- a/src/client/elm/View/Header.elm
+++ b/src/client/View/Header.elm
diff --git a/src/client/elm/View/Plural.elm b/src/client/View/Plural.elm
index c36eaca..c36eaca 100644
--- a/src/client/elm/View/Plural.elm
+++ b/src/client/View/Plural.elm
diff --git a/src/server/Main.hs b/src/server/Main.hs
index b7764c9..7ae8c1c 100644
--- a/src/server/Main.hs
+++ b/src/server/Main.hs
@@ -1,22 +1,17 @@
{-# LANGUAGE OverloadedStrings #-}
-import Web.Scotty
-
import Network.Wai.Middleware.Static
-
-import Job.Daemon (runDaemons)
-
import qualified Data.Text.Lazy as LT
+import Web.Scotty
-import qualified Controller.Index as Index
-import qualified Controller.SignIn as SignIn
-import qualified Controller.Payment as Payment
-import qualified Controller.Income as Income
-import qualified Controller.Category as Category
-
+import Job.Daemon (runDaemons)
import Model.Database (runMigrations)
-
import qualified Conf
+import qualified Controller.Category as Category
+import qualified Controller.Income as Income
+import qualified Controller.Index as Index
+import qualified Controller.Payment as Payment
+import qualified Controller.SignIn as SignIn
main :: IO ()
main = do
diff --git a/src/server/Model/Message/Key.hs b/src/server/Model/Message/Key.hs
index 36b3ba0..79ccf39 100644
--- a/src/server/Model/Message/Key.hs
+++ b/src/server/Model/Message/Key.hs
@@ -127,6 +127,7 @@ data Key =
| Empty
| InvalidString
| InvalidDate
+ | CostMustNotBeNull
| InvalidInt
| InvalidCategory
| SmallerIntThan
diff --git a/src/server/Model/Message/Translations.hs b/src/server/Model/Message/Translations.hs
index 6565344..16fc3fd 100644
--- a/src/server/Model/Message/Translations.hs
+++ b/src/server/Model/Message/Translations.hs
@@ -498,6 +498,11 @@ m l InvalidDate =
English -> "day/month/year required"
French -> "jour/mois/année requis"
+m l CostMustNotBeNull =
+ case l of
+ English -> "Cost must not be zero"
+ French -> "Le coût ne doît pas être nul"
+
m l InvalidInt =
case l of
English -> "Integer required"