aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/migrations/202208261848_add_auth_info_to_babies.rb10
-rw-r--r--lib/biberon.rb3
-rw-r--r--locales/en.yml7
-rw-r--r--locales/fr.yml7
-rw-r--r--views/index.slim39
5 files changed, 53 insertions, 13 deletions
diff --git a/db/migrations/202208261848_add_auth_info_to_babies.rb b/db/migrations/202208261848_add_auth_info_to_babies.rb
new file mode 100644
index 0000000..b73215c
--- /dev/null
+++ b/db/migrations/202208261848_add_auth_info_to_babies.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+Sequel.migration do
+ change do
+ alter_table :babies do
+ add_column :email, String, null: false, default: ''
+ add_unique_constraint [:name, :email]
+ end
+ end
+end
diff --git a/lib/biberon.rb b/lib/biberon.rb
index c578b75..6db82eb 100644
--- a/lib/biberon.rb
+++ b/lib/biberon.rb
@@ -57,6 +57,9 @@ module Biberon
end
end
+ r.post 'create' do
+ end
+
r.is 'settings' do
@title = R18n.t.settings.settings
diff --git a/locales/en.yml b/locales/en.yml
index bc657f5..2ccc592 100644
--- a/locales/en.yml
+++ b/locales/en.yml
@@ -4,10 +4,13 @@ footer:
made_with_love: Made with ❤️ at %1
in_france: France
session:
- name: Name
- password: Password
+ add_a_baby: Add a baby
login: Log in
logout: Logout
+baby:
+ email: Email
+ name: Name
+ password: Password
biberon:
hour: Hour
quantity: Quantity
diff --git a/locales/fr.yml b/locales/fr.yml
index 132e038..8c37ca8 100644
--- a/locales/fr.yml
+++ b/locales/fr.yml
@@ -4,10 +4,13 @@ footer:
made_with_love: Fait avec ❤️ à %1
in_france: Loire-Atlantique, France
session:
- name: Nom
- password: Mot de passe
+ add_a_baby: Ajouter un bébé
login: Se connecter
logout: Se déconnecter
+baby:
+ email: Email
+ name: Nom
+ password: Mot de passe
biberon:
hour: Heure
quantity: Quantité
diff --git a/views/index.slim b/views/index.slim
index a76a297..500a6cf 100644
--- a/views/index.slim
+++ b/views/index.slim
@@ -1,12 +1,33 @@
-form action='/session/create' method='post'
- fieldset
- == csrf_tag '/session/create'
+.row
+ .column.column-50
+ form action='/session/create' method='post'
+ fieldset
+ == csrf_tag '/session/create'
+ legend = R18n.t.session.login
- label for='name' = R18n.t.session.name
- input#name type='text' name='name' required=true
+ label for='name' = R18n.t.baby.name
+ input#name type='text' name='name' required=true
- label for='password' = R18n.t.session.password
- input#password type='password' name='password' required=true
+ label for='password' = R18n.t.baby.password
+ input#password type='password' name='password' required=true
- input.button-primary type='submit' value=R18n.t.session.login
- input.button-outline< type='reset' value=R18n.t.cancel
+ input.button-primary type='submit' value=R18n.t.session.login
+ input.button-outline< type='reset' value=R18n.t.cancel
+
+ .column.column-50
+ form action='/baby/create' method='post'
+ fieldset
+ == csrf_tag '/baby/create'
+ legend = R18n.t.session.add_a_baby
+
+ label for='name' = R18n.t.baby.name
+ input#name type='text' name='name' required=true
+
+ label for='email' = R18n.t.baby.email
+ input#email type='email' name='email' required=true
+
+ label for='password' = R18n.t.baby.password
+ input#password type='password' name='password' required=true
+
+ input.button-primary type='submit' value=R18n.t.session.add_a_baby
+ input.button-outline< type='reset' value=R18n.t.cancel