Initial app
This commit is contained in:
22
app/views/contests/index.html.slim
Normal file
22
app/views/contests/index.html.slim
Normal file
@@ -0,0 +1,22 @@
|
||||
.container.mt-5
|
||||
- if authenticated?
|
||||
.float-end
|
||||
= button_to "Log out", session_path, method: :delete
|
||||
|
||||
h1 Welcome!
|
||||
|
||||
.alert.alert-primary role="alert"
|
||||
| This is a brand new website!
|
||||
|
||||
h4.mt-4 Manage your contests
|
||||
|
||||
- @contests.each do |contest|
|
||||
.card.mb-2
|
||||
.card-body
|
||||
.card-title
|
||||
= contest.name
|
||||
a.btn.btn-primary href=contest_path(contest)
|
||||
| Open
|
||||
|
||||
a.btn.btn-primary.mt-4 href=new_contest_path
|
||||
| Create a new contest
|
8
app/views/contests/new.html.slim
Normal file
8
app/views/contests/new.html.slim
Normal file
@@ -0,0 +1,8 @@
|
||||
h1 Create a new contest
|
||||
|
||||
= form_with model: @contest do |form|
|
||||
div
|
||||
= form.label :name
|
||||
= form.text_field :name
|
||||
div
|
||||
= form.submit
|
5
app/views/contests/show.html.slim
Normal file
5
app/views/contests/show.html.slim
Normal file
@@ -0,0 +1,5 @@
|
||||
.container.mt-5
|
||||
h1 Contest: "#{@contest.name}"
|
||||
|
||||
a.btn.btn-primary href=root_path
|
||||
| Back to all contests
|
28
app/views/layouts/application.html.erb
Normal file
28
app/views/layouts/application.html.erb
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= content_for(:title) || "Puzzle Scoreboard" %></title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<%= 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) %>
|
||||
|
||||
<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">
|
||||
|
||||
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
||||
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
|
||||
<%= javascript_importmap_tags %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
13
app/views/layouts/mailer.html.erb
Normal file
13
app/views/layouts/mailer.html.erb
Normal file
@@ -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>
|
1
app/views/layouts/mailer.text.erb
Normal file
1
app/views/layouts/mailer.text.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= yield %>
|
9
app/views/passwords/edit.html.erb
Normal file
9
app/views/passwords/edit.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<h1>Update your password</h1>
|
||||
|
||||
<%= 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 %><br>
|
||||
<%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72 %><br>
|
||||
<%= form.submit "Save" %>
|
||||
<% end %>
|
8
app/views/passwords/new.html.erb
Normal file
8
app/views/passwords/new.html.erb
Normal file
@@ -0,0 +1,8 @@
|
||||
<h1>Forgot your password?</h1>
|
||||
|
||||
<%= 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] %><br>
|
||||
<%= form.submit "Email reset instructions" %>
|
||||
<% end %>
|
4
app/views/passwords_mailer/reset.html.erb
Normal file
4
app/views/passwords_mailer/reset.html.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<p>
|
||||
You can reset your password within the next 15 minutes on
|
||||
<%= link_to "this password reset page", edit_password_url(@user.password_reset_token) %>.
|
||||
</p>
|
2
app/views/passwords_mailer/reset.text.erb
Normal file
2
app/views/passwords_mailer/reset.text.erb
Normal file
@@ -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) %>
|
8
app/views/puzzles/index.html.slim
Normal file
8
app/views/puzzles/index.html.slim
Normal file
@@ -0,0 +1,8 @@
|
||||
h1 Puzzles
|
||||
|
||||
= link_to "New puzzle", new_puzzle_path
|
||||
|
||||
div
|
||||
- @puzzles.each do |puzzle|
|
||||
div
|
||||
= link_to puzzle.name, puzzle
|
11
app/views/puzzles/new.html.slim
Normal file
11
app/views/puzzles/new.html.slim
Normal file
@@ -0,0 +1,11 @@
|
||||
h1 New puzzle
|
||||
|
||||
= form_with model: @puzzle do |form|
|
||||
div
|
||||
= form.label :name
|
||||
= form.text_field :name
|
||||
div
|
||||
= form.label :image, style: "display: block"
|
||||
= form.file_field :image, accept: "image/*"
|
||||
div
|
||||
= form.submit
|
7
app/views/puzzles/show.html.slim
Normal file
7
app/views/puzzles/show.html.slim
Normal file
@@ -0,0 +1,7 @@
|
||||
h1 = @puzzle.name
|
||||
|
||||
= link_to "Back", puzzles_path
|
||||
|
||||
= image_tag @puzzle.image if @puzzle.image.attached?
|
||||
|
||||
= button_to "Delete", @puzzle, method: :delete, data: { turbo_confirm: "Are you suuure??" }
|
22
app/views/pwa/manifest.json.erb
Normal file
22
app/views/pwa/manifest.json.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "PuzzleScoreboard",
|
||||
"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": "PuzzleScoreboard.",
|
||||
"theme_color": "red",
|
||||
"background_color": "red"
|
||||
}
|
26
app/views/pwa/service-worker.js
Normal file
26
app/views/pwa/service-worker.js
Normal file
@@ -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)
|
||||
// }
|
||||
// })
|
||||
// )
|
||||
// })
|
11
app/views/sessions/new.html.erb
Normal file
11
app/views/sessions/new.html.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
<%= 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] %><br>
|
||||
<%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72 %><br>
|
||||
<%= form.submit "Sign in" %>
|
||||
<% end %>
|
||||
<br>
|
||||
|
||||
<%= link_to "Forgot password?", new_password_path %>
|
Reference in New Issue
Block a user