From be2a93525069de2dfa3c23b0c23e7a9f7ad4c03d Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 29 Dec 2024 15:14:43 +0100 Subject: First commit. --- app/views/admin/dashboard/index.html.erb | 10 ++++++++ app/views/admin/dashboard/tmp | 19 ++++++++++++++ app/views/home/_code_of_honor.html.erb | 14 +++++++++++ app/views/home/index.html.erb | 42 +++++++++++++++++++++++++++++++ app/views/layouts/_footer.html.erb | 3 +++ app/views/layouts/_notifications.html.erb | 8 ++++++ app/views/layouts/_topnav.html.erb | 5 ++++ app/views/layouts/application.html.erb | 33 ++++++++++++++++++++++++ app/views/layouts/mailer.html.erb | 13 ++++++++++ app/views/layouts/mailer.text.erb | 1 + app/views/passwords/edit.html.erb | 9 +++++++ app/views/passwords/new.html.erb | 8 ++++++ app/views/passwords_mailer/reset.html.erb | 4 +++ app/views/passwords_mailer/reset.text.erb | 2 ++ app/views/pwa/manifest.json.erb | 22 ++++++++++++++++ app/views/pwa/service-worker.js | 26 +++++++++++++++++++ app/views/registrations/new.html.erb | 17 +++++++++++++ app/views/scores/_form.html.erb | 19 ++++++++++++++ app/views/scores/edit_all.html.erb | 7 ++++++ app/views/scores/new.html.erb | 7 ++++++ app/views/sessions/new.html.erb | 20 +++++++++++++++ app/views/tartiflettes/index.html.erb | 3 +++ app/views/tartiflettes/show.html.erb | 3 +++ 23 files changed, 295 insertions(+) create mode 100644 app/views/admin/dashboard/index.html.erb create mode 100644 app/views/admin/dashboard/tmp create mode 100644 app/views/home/_code_of_honor.html.erb create mode 100644 app/views/home/index.html.erb create mode 100644 app/views/layouts/_footer.html.erb create mode 100644 app/views/layouts/_notifications.html.erb create mode 100644 app/views/layouts/_topnav.html.erb create mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/layouts/mailer.html.erb create mode 100644 app/views/layouts/mailer.text.erb create mode 100644 app/views/passwords/edit.html.erb create mode 100644 app/views/passwords/new.html.erb create mode 100644 app/views/passwords_mailer/reset.html.erb create mode 100644 app/views/passwords_mailer/reset.text.erb create mode 100644 app/views/pwa/manifest.json.erb create mode 100644 app/views/pwa/service-worker.js create mode 100644 app/views/registrations/new.html.erb create mode 100644 app/views/scores/_form.html.erb create mode 100644 app/views/scores/edit_all.html.erb create mode 100644 app/views/scores/new.html.erb create mode 100644 app/views/sessions/new.html.erb create mode 100644 app/views/tartiflettes/index.html.erb create mode 100644 app/views/tartiflettes/show.html.erb (limited to 'app/views') diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb new file mode 100644 index 0000000..30cf866 --- /dev/null +++ b/app/views/admin/dashboard/index.html.erb @@ -0,0 +1,10 @@ +

Administrateur

+ + + +

+ <%= button_to "Déconnexion", + session_path(session), + method: :delete %> +

+

<%= link_to "Télécharger tous les scores en format CSV", admin_scores_export_path %>

diff --git a/app/views/admin/dashboard/tmp b/app/views/admin/dashboard/tmp new file mode 100644 index 0000000..986fc28 --- /dev/null +++ b/app/views/admin/dashboard/tmp @@ -0,0 +1,19 @@ +<% ScoringCriterium.grouped_by_category.each do |category, criteria| %> +

<%= category.capitalize %>

+ + + + + + + + + <% @tartiflettes.each do |tartiflette| %> + + + + + <% end %> + +
NuméroScore
<%= tartiflette.scoring_id %><%= tartiflette.scores.where(&:scoring_criterium.include? criteria) %>
+<% end %> diff --git a/app/views/home/_code_of_honor.html.erb b/app/views/home/_code_of_honor.html.erb new file mode 100644 index 0000000..517a73e --- /dev/null +++ b/app/views/home/_code_of_honor.html.erb @@ -0,0 +1,14 @@ +
+

Code d'honneur

+

+ Tout Tartifleur s'engage à voter dans le respect de la + tradition de la WTT. Il ou elle se doit de voter en toute + honnêteté intellectuelle afin de favoriser un résultat mérité + ! +

+ <% if session[:agreed_to_code_of_honor] %> + <%= button_to "Renéguer", toggle_code_of_honor_path %> + <% else %> + <%= button_to "Accepter", toggle_code_of_honor_path %> + <% end %> +
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 0000000..ca8f3a3 --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,42 @@ +

World Tartiflette Tour 2024

+ +<%= image_tag("blason_Savoie.png", :alt => "blason de la Savoie", id: "blason", width: 80) %> + +<%= render "code_of_honor" %> + +

Noter les Tartiflettes

+ + +

+ <%= link_to "Admin", admin_dashboard_path %> +

diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb new file mode 100644 index 0000000..bba04fb --- /dev/null +++ b/app/views/layouts/_footer.html.erb @@ -0,0 +1,3 @@ + diff --git a/app/views/layouts/_notifications.html.erb b/app/views/layouts/_notifications.html.erb new file mode 100644 index 0000000..3e1eb83 --- /dev/null +++ b/app/views/layouts/_notifications.html.erb @@ -0,0 +1,8 @@ +
+ <% if alert %> +

<%= alert %>

+ <% end %> + <% if notice %> +

<%= notice %>

+ <% end %> +
diff --git a/app/views/layouts/_topnav.html.erb b/app/views/layouts/_topnav.html.erb new file mode 100644 index 0000000..f93ed99 --- /dev/null +++ b/app/views/layouts/_topnav.html.erb @@ -0,0 +1,5 @@ + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..680dec1 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,33 @@ + + + + <%= content_for(:title) || "WTT" %> + + + + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + <%= yield :head %> + + <%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %> + <%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %> + + <%= favicon_link_tag "blason_Savoie.png" %> + + + <%# Includes all stylesheet files in app/assets/stylesheets %> + <%= stylesheet_link_tag :app, "data-turbo-track": "reload" %> + + + + <%= render "layouts/topnav" %> + <%= render "layouts/notifications" %> +
+ <%= yield %> +
+ <%= render "layouts/footer" %> + + 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 @@ + + + + + + + + + <%= yield %> + + 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/passwords/edit.html.erb b/app/views/passwords/edit.html.erb new file mode 100644 index 0000000..9f0c87c --- /dev/null +++ b/app/views/passwords/edit.html.erb @@ -0,0 +1,9 @@ +

Update your password

+ +<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> + +<%= form_with url: password_path(params[:token]), method: :put do |form| %> + <%= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter new password", maxlength: 72 %>
+ <%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72 %>
+ <%= form.submit "Save" %> +<% end %> diff --git a/app/views/passwords/new.html.erb b/app/views/passwords/new.html.erb new file mode 100644 index 0000000..44efb2b --- /dev/null +++ b/app/views/passwords/new.html.erb @@ -0,0 +1,8 @@ +

Forgot your password?

+ +<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> + +<%= form_with url: passwords_path do |form| %> + <%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %>
+ <%= form.submit "Email reset instructions" %> +<% end %> diff --git a/app/views/passwords_mailer/reset.html.erb b/app/views/passwords_mailer/reset.html.erb new file mode 100644 index 0000000..4a06619 --- /dev/null +++ b/app/views/passwords_mailer/reset.html.erb @@ -0,0 +1,4 @@ +

+ You can reset your password within the next 15 minutes on + <%= link_to "this password reset page", edit_password_url(@user.password_reset_token) %>. +

diff --git a/app/views/passwords_mailer/reset.text.erb b/app/views/passwords_mailer/reset.text.erb new file mode 100644 index 0000000..2cf03fc --- /dev/null +++ b/app/views/passwords_mailer/reset.text.erb @@ -0,0 +1,2 @@ +You can reset your password within the next 15 minutes on this password reset page: +<%= edit_password_url(@user.password_reset_token) %> diff --git a/app/views/pwa/manifest.json.erb b/app/views/pwa/manifest.json.erb new file mode 100644 index 0000000..883d71c --- /dev/null +++ b/app/views/pwa/manifest.json.erb @@ -0,0 +1,22 @@ +{ + "name": "Wtt", + "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": "Wtt.", + "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/registrations/new.html.erb b/app/views/registrations/new.html.erb new file mode 100644 index 0000000..9d9f9bc --- /dev/null +++ b/app/views/registrations/new.html.erb @@ -0,0 +1,17 @@ +

Sign Up

+ +<%= form_with model: @user, url: registration_path, method: :post, local: true do |f| %> +
+ <%= f.label :email_address %> + <%= f.email_field :email_address, required: true %> +
+
+ <%= f.label :password %> + <%= f.password_field :password, required: true %> +
+
+ <%= f.label :password_confirmation %> + <%= f.password_field :password_confirmation, required: true %> +
+ <%= f.submit "Sign Up" %> +<% end %> diff --git a/app/views/scores/_form.html.erb b/app/views/scores/_form.html.erb new file mode 100644 index 0000000..9cbcec7 --- /dev/null +++ b/app/views/scores/_form.html.erb @@ -0,0 +1,19 @@ +<%= form_with url: form_url, method: form_method, local: true do |f| %> + <% ScoringCriterium.grouped_by_category.each do |category, criteria| %> +
+ <%= category.titlecase %> + <% criteria.each do |criterium| %> + <% current_score = existing_scores.find { |score| score.scoring_criterium_id == criterium.id } %> +

+ <%= select_tag "scores[#{criterium.id}][value]", + options_for_select(1..5, current_score&.value), + required: true, + prompt: "Score" %> + <%= label_tag "scores[#{criterium.id}][value]", + criterium.name.capitalize %> +

+ <% end %> +
+ <% end %> + <%= f.submit submit_text %> +<% end %> diff --git a/app/views/scores/edit_all.html.erb b/app/views/scores/edit_all.html.erb new file mode 100644 index 0000000..2be7149 --- /dev/null +++ b/app/views/scores/edit_all.html.erb @@ -0,0 +1,7 @@ +

Modifier les Notes pour la Tartiflette nº<%= @tartiflette.scoring_id %>

+ +<%= render "form", + form_url: tartiflette_update_scores_path(@tartiflette), + form_method: :patch, + existing_scores: @scores, + submit_text: "Mettre à jour mes scores" %> diff --git a/app/views/scores/new.html.erb b/app/views/scores/new.html.erb new file mode 100644 index 0000000..cf171cc --- /dev/null +++ b/app/views/scores/new.html.erb @@ -0,0 +1,7 @@ +

Noter la Tartiflette nº<%= @tartiflette.scoring_id %>

+ +<%= render "form", + form_url: tartiflette_scores_path(@tartiflette), + form_method: :post, + existing_scores: [], + submit_text: "Envoyer mes scores" %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb new file mode 100644 index 0000000..51029b1 --- /dev/null +++ b/app/views/sessions/new.html.erb @@ -0,0 +1,20 @@ +<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> +<%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %> + +<%= form_with url: session_path do |form| %> + <%= form.email_field :email_address, + required: true, + autofocus: true, + autocomplete: "username", + placeholder: "Enter your email address", + value: params[:email_address] %>
+ <%= form.password_field :password, + required: true, + autocomplete: "current-password", + placeholder: "Enter your password", + maxlength: 72 %>
+ <%= form.submit "Sign in" %> +<% end %> +
+ +<%= link_to "Forgot password?", new_password_path %> diff --git a/app/views/tartiflettes/index.html.erb b/app/views/tartiflettes/index.html.erb new file mode 100644 index 0000000..09b2748 --- /dev/null +++ b/app/views/tartiflettes/index.html.erb @@ -0,0 +1,3 @@ +

Tartiflettes

+ +

Toutes les tartiflettes

diff --git a/app/views/tartiflettes/show.html.erb b/app/views/tartiflettes/show.html.erb new file mode 100644 index 0000000..3753604 --- /dev/null +++ b/app/views/tartiflettes/show.html.erb @@ -0,0 +1,3 @@ +

Tartiflette nº<%= @tartiflette.scoring_id %>

+ +

Scores obtenus pour une tartiflette donnée.

-- cgit v1.2.3