diff options
author | Marius Peter <marius.peter@tutanota.com> | 2024-11-11 16:55:14 +0100 |
---|---|---|
committer | Marius Peter <marius.peter@tutanota.com> | 2024-11-11 16:55:14 +0100 |
commit | fea9476a591559bd8fdcf17b64e5114c592a5b08 (patch) | |
tree | 08aa0fdd62752f1d286aa66ac77413fb03d6d737 /app/views |
C'est l'heure d'assurer le suivi de quelques flacons!main
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/layouts/application.html.erb | 22 | ||||
-rw-r--r-- | app/views/layouts/mailer.html.erb | 13 | ||||
-rw-r--r-- | app/views/layouts/mailer.text.erb | 1 | ||||
-rw-r--r-- | app/views/pwa/manifest.json.erb | 22 | ||||
-rw-r--r-- | app/views/pwa/service-worker.js | 26 | ||||
-rw-r--r-- | app/views/wines/_form.html.erb | 33 | ||||
-rw-r--r-- | app/views/wines/edit.html.erb | 5 | ||||
-rw-r--r-- | app/views/wines/index.html.erb | 16 | ||||
-rw-r--r-- | app/views/wines/new.html.erb | 5 | ||||
-rw-r--r-- | app/views/wines/show.html.erb | 17 |
10 files changed, 160 insertions, 0 deletions
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..ef26703 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html> + <head> + <title><%= content_for(:title) || "Flacon" %></title> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <meta name="apple-mobile-web-app-capable" content="yes"> + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + <%= yield :head %> + + <link rel="manifest" href="/manifest.json"> + <link rel="icon" href="/icon.png" type="image/png"> + <link rel="icon" href="/icon.svg" type="image/svg+xml"> + <link rel="apple-touch-icon" href="/icon.png"> + <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> + </head> + + <body> + <%= yield %> + </body> +</html> diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb new file mode 100644 index 0000000..3aac900 --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <style> + /* Email styles need to be inline */ + </style> + </head> + + <body> + <%= yield %> + </body> +</html> diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb new file mode 100644 index 0000000..37f0bdd --- /dev/null +++ b/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/app/views/pwa/manifest.json.erb b/app/views/pwa/manifest.json.erb new file mode 100644 index 0000000..7a1a68b --- /dev/null +++ b/app/views/pwa/manifest.json.erb @@ -0,0 +1,22 @@ +{ + "name": "Flacon", + "icons": [ + { + "src": "/icon.png", + "type": "image/png", + "sizes": "512x512" + }, + { + "src": "/icon.png", + "type": "image/png", + "sizes": "512x512", + "purpose": "maskable" + } + ], + "start_url": "/", + "display": "standalone", + "scope": "/", + "description": "Flacon.", + "theme_color": "red", + "background_color": "red" +} diff --git a/app/views/pwa/service-worker.js b/app/views/pwa/service-worker.js new file mode 100644 index 0000000..b3a13fb --- /dev/null +++ b/app/views/pwa/service-worker.js @@ -0,0 +1,26 @@ +// Add a service worker for processing Web Push notifications: +// +// self.addEventListener("push", async (event) => { +// const { title, options } = await event.data.json() +// event.waitUntil(self.registration.showNotification(title, options)) +// }) +// +// self.addEventListener("notificationclick", function(event) { +// event.notification.close() +// event.waitUntil( +// clients.matchAll({ type: "window" }).then((clientList) => { +// for (let i = 0; i < clientList.length; i++) { +// let client = clientList[i] +// let clientPath = (new URL(client.url)).pathname +// +// if (clientPath == event.notification.data.path && "focus" in client) { +// return client.focus() +// } +// } +// +// if (clients.openWindow) { +// return clients.openWindow(event.notification.data.path) +// } +// }) +// ) +// }) diff --git a/app/views/wines/_form.html.erb b/app/views/wines/_form.html.erb new file mode 100644 index 0000000..fe676b2 --- /dev/null +++ b/app/views/wines/_form.html.erb @@ -0,0 +1,33 @@ +<!-- -*- mode: web; -*- --> + +<%= form_with model: wine do |form| %> + <div> + <%= form.label :name %><br> + <%= form.text_field :name %> + <% wine.errors.full_messages_for(:name).each do |message| %> + <div><%= message %></div> + <% end %> + </div> + + <div> + <%= form.label :year %><br> + <%= form.text_field :year %> + <% wine.errors.full_messages_for(:year).each do |message| %> + <div><%= message %></div> + <% end %> + </div> + + <div> + <%= form.label :variety %><br> + <%= form.text_field :variety %> + </div> + + <div> + <%= form.label :notes %><br> + <%= form.text_field :notes %> + </div> + + <div> + <%= form.submit %> + </div> +<% end %> diff --git a/app/views/wines/edit.html.erb b/app/views/wines/edit.html.erb new file mode 100644 index 0000000..a97c707 --- /dev/null +++ b/app/views/wines/edit.html.erb @@ -0,0 +1,5 @@ +<!-- -*- mode: web; -*- --> + +<h1>Edit Wine</h1> + +<%= render "form", wine: @wine %> diff --git a/app/views/wines/index.html.erb b/app/views/wines/index.html.erb new file mode 100644 index 0000000..0202ada --- /dev/null +++ b/app/views/wines/index.html.erb @@ -0,0 +1,16 @@ +<!-- -*- mode: web; -*- --> + +<h1>Wines#index</h1> +<h2>List of wines</h2> + +<%= link_to "Add Wine", new_wine_path %> + +<ul> + <% @wines.each do |wine| %> + <li> + <%= link_to wine.name, wine %>, + <%= wine.year %>, + <%= wine.variety %> + </li> + <% end %> +</ul> diff --git a/app/views/wines/new.html.erb b/app/views/wines/new.html.erb new file mode 100644 index 0000000..eeb6fd6 --- /dev/null +++ b/app/views/wines/new.html.erb @@ -0,0 +1,5 @@ +<!-- -*- mode: web; -*- --> + +<h1>Add Wine</h1> + +<%= render "form", wine: @wine %> diff --git a/app/views/wines/show.html.erb b/app/views/wines/show.html.erb new file mode 100644 index 0000000..cd8925d --- /dev/null +++ b/app/views/wines/show.html.erb @@ -0,0 +1,17 @@ +<!-- -*- mode: web; -*- --> + +<li><%= link_to "Back to homepage", root_path %></li> + +<h1><%= @wine.name %></h1> +<h2><%= @wine.year %></h2> +<p><%= @wine.notes %></p> + +<ul> + <li><%= link_to "Edit", edit_wine_path(@wine) %></li> + <li><%= link_to "Destroy", + wine_path(@wine), + data: { + turbo_method: :delete, + turbo_confirm: "Are you sure you want to delete #{@wine.name}?" + } %></li> +</ul> |