diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/layouts/application.html.erb | 16 | ||||
-rw-r--r-- | app/views/layouts/mailer.html.erb | 14 | ||||
-rw-r--r-- | app/views/layouts/mailer.text.erb | 1 | ||||
-rw-r--r-- | app/views/machines/_form.html.erb | 27 | ||||
-rw-r--r-- | app/views/machines/_machine.html.erb | 12 | ||||
-rw-r--r-- | app/views/machines/_machine.json.jbuilder | 4 | ||||
-rw-r--r-- | app/views/machines/edit.html.erb | 10 | ||||
-rw-r--r-- | app/views/machines/index.html.erb | 14 | ||||
-rw-r--r-- | app/views/machines/index.json.jbuilder | 3 | ||||
-rw-r--r-- | app/views/machines/new.html.erb | 9 | ||||
-rw-r--r-- | app/views/machines/show.html.erb | 10 | ||||
-rw-r--r-- | app/views/machines/show.json.jbuilder | 3 | ||||
-rw-r--r-- | app/views/players/_form.html.erb | 32 | ||||
-rw-r--r-- | app/views/players/_player.html.erb | 17 | ||||
-rw-r--r-- | app/views/players/_player.json.jbuilder | 4 | ||||
-rw-r--r-- | app/views/players/edit.html.erb | 10 | ||||
-rw-r--r-- | app/views/players/index.html.erb | 14 | ||||
-rw-r--r-- | app/views/players/index.json.jbuilder | 3 | ||||
-rw-r--r-- | app/views/players/new.html.erb | 9 | ||||
-rw-r--r-- | app/views/players/show.html.erb | 10 | ||||
-rw-r--r-- | app/views/players/show.json.jbuilder | 3 |
21 files changed, 225 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..665f897 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <title>Knockout</title> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> + <%= javascript_importmap_tags %> + </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..4ee4c89 --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <style> + /* Email styles need to be inline */ + </style> + <title></title> + </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/machines/_form.html.erb b/app/views/machines/_form.html.erb new file mode 100644 index 0000000..0e59129 --- /dev/null +++ b/app/views/machines/_form.html.erb @@ -0,0 +1,27 @@ +<%= form_with(model: machine) do |form| %> + <% if machine.errors.any? %> + <div style="color: red"> + <h2><%= pluralize(machine.errors.count, "error") %> prohibited this machine from being saved:</h2> + + <ul> + <% machine.errors.each do |error| %> + <li><%= error.full_message %></li> + <% end %> + </ul> + </div> + <% end %> + + <div> + <%= form.label :name, style: "display: block" %> + <%= form.text_field :name %> + </div> + + <div> + <%= form.label :edition, style: "display: block" %> + <%= form.text_field :edition %> + </div> + + <div> + <%= form.submit %> + </div> +<% end %> diff --git a/app/views/machines/_machine.html.erb b/app/views/machines/_machine.html.erb new file mode 100644 index 0000000..edba53e --- /dev/null +++ b/app/views/machines/_machine.html.erb @@ -0,0 +1,12 @@ +<div id="<%= dom_id machine %>"> + <p> + <strong>Name:</strong> + <%= machine.name %> + </p> + + <p> + <strong>Edition:</strong> + <%= machine.edition %> + </p> + +</div> diff --git a/app/views/machines/_machine.json.jbuilder b/app/views/machines/_machine.json.jbuilder new file mode 100644 index 0000000..ef51e42 --- /dev/null +++ b/app/views/machines/_machine.json.jbuilder @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +json.extract! machine, :id, :name, :edition, :created_at, :updated_at +json.url machine_url(machine, format: :json) diff --git a/app/views/machines/edit.html.erb b/app/views/machines/edit.html.erb new file mode 100644 index 0000000..a390477 --- /dev/null +++ b/app/views/machines/edit.html.erb @@ -0,0 +1,10 @@ +<h1>Editing machine</h1> + +<%= render "form", machine: @machine %> + +<br> + +<div> + <%= link_to "Show this machine", @machine %> | + <%= link_to "Back to machines", machines_path %> +</div> diff --git a/app/views/machines/index.html.erb b/app/views/machines/index.html.erb new file mode 100644 index 0000000..b5e2c85 --- /dev/null +++ b/app/views/machines/index.html.erb @@ -0,0 +1,14 @@ +<p style="color: green"><%= notice %></p> + +<h1>Machines</h1> + +<div id="machines"> + <% @machines.each do |machine| %> + <%= render machine %> + <p> + <%= link_to "Show this machine", machine %> + </p> + <% end %> +</div> + +<%= link_to "New machine", new_machine_path %> diff --git a/app/views/machines/index.json.jbuilder b/app/views/machines/index.json.jbuilder new file mode 100644 index 0000000..9947db2 --- /dev/null +++ b/app/views/machines/index.json.jbuilder @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +json.array! @machines, partial: 'machines/machine', as: :machine diff --git a/app/views/machines/new.html.erb b/app/views/machines/new.html.erb new file mode 100644 index 0000000..ae58280 --- /dev/null +++ b/app/views/machines/new.html.erb @@ -0,0 +1,9 @@ +<h1>New machine</h1> + +<%= render "form", machine: @machine %> + +<br> + +<div> + <%= link_to "Back to machines", machines_path %> +</div> diff --git a/app/views/machines/show.html.erb b/app/views/machines/show.html.erb new file mode 100644 index 0000000..1af79f9 --- /dev/null +++ b/app/views/machines/show.html.erb @@ -0,0 +1,10 @@ +<p style="color: green"><%= notice %></p> + +<%= render @machine %> + +<div> + <%= link_to "Edit this machine", edit_machine_path(@machine) %> | + <%= link_to "Back to machines", machines_path %> + + <%= button_to "Destroy this machine", @machine, method: :delete %> +</div> diff --git a/app/views/machines/show.json.jbuilder b/app/views/machines/show.json.jbuilder new file mode 100644 index 0000000..21b2852 --- /dev/null +++ b/app/views/machines/show.json.jbuilder @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +json.partial! 'machines/machine', machine: @machine diff --git a/app/views/players/_form.html.erb b/app/views/players/_form.html.erb new file mode 100644 index 0000000..48dadc5 --- /dev/null +++ b/app/views/players/_form.html.erb @@ -0,0 +1,32 @@ +<%= form_with(model: player) do |form| %> + <% if player.errors.any? %> + <div style="color: red"> + <h2><%= pluralize(player.errors.count, "error") %> prohibited this player from being saved:</h2> + + <ul> + <% player.errors.each do |error| %> + <li><%= error.full_message %></li> + <% end %> + </ul> + </div> + <% end %> + + <div> + <%= form.label :name, style: "display: block" %> + <%= form.text_field :name %> + </div> + + <div> + <%= form.label :paid, style: "display: block" %> + <%= form.check_box :paid %> + </div> + + <div> + <%= form.label :strikes, style: "display: block" %> + <%= form.number_field :strikes %> + </div> + + <div> + <%= form.submit %> + </div> +<% end %> diff --git a/app/views/players/_player.html.erb b/app/views/players/_player.html.erb new file mode 100644 index 0000000..35e7cb1 --- /dev/null +++ b/app/views/players/_player.html.erb @@ -0,0 +1,17 @@ +<div id="<%= dom_id player %>"> + <p> + <strong>Name:</strong> + <%= player.name %> + </p> + + <p> + <strong>Paid:</strong> + <%= player.paid %> + </p> + + <p> + <strong>Strikes:</strong> + <%= player.strikes %> + </p> + +</div> diff --git a/app/views/players/_player.json.jbuilder b/app/views/players/_player.json.jbuilder new file mode 100644 index 0000000..deda657 --- /dev/null +++ b/app/views/players/_player.json.jbuilder @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +json.extract! player, :id, :name, :paid, :strikes, :created_at, :updated_at +json.url player_url(player, format: :json) diff --git a/app/views/players/edit.html.erb b/app/views/players/edit.html.erb new file mode 100644 index 0000000..a6cea2b --- /dev/null +++ b/app/views/players/edit.html.erb @@ -0,0 +1,10 @@ +<h1>Editing player</h1> + +<%= render "form", player: @player %> + +<br> + +<div> + <%= link_to "Show this player", @player %> | + <%= link_to "Back to players", players_path %> +</div> diff --git a/app/views/players/index.html.erb b/app/views/players/index.html.erb new file mode 100644 index 0000000..eac7710 --- /dev/null +++ b/app/views/players/index.html.erb @@ -0,0 +1,14 @@ +<p style="color: green"><%= notice %></p> + +<h1>Players</h1> + +<div id="players"> + <% @players.each do |player| %> + <%= render player %> + <p> + <%= link_to "Show this player", player %> + </p> + <% end %> +</div> + +<%= link_to "New player", new_player_path %> diff --git a/app/views/players/index.json.jbuilder b/app/views/players/index.json.jbuilder new file mode 100644 index 0000000..da56f8d --- /dev/null +++ b/app/views/players/index.json.jbuilder @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +json.array! @players, partial: 'players/player', as: :player diff --git a/app/views/players/new.html.erb b/app/views/players/new.html.erb new file mode 100644 index 0000000..c248abe --- /dev/null +++ b/app/views/players/new.html.erb @@ -0,0 +1,9 @@ +<h1>New player</h1> + +<%= render "form", player: @player %> + +<br> + +<div> + <%= link_to "Back to players", players_path %> +</div> diff --git a/app/views/players/show.html.erb b/app/views/players/show.html.erb new file mode 100644 index 0000000..19ade1d --- /dev/null +++ b/app/views/players/show.html.erb @@ -0,0 +1,10 @@ +<p style="color: green"><%= notice %></p> + +<%= render @player %> + +<div> + <%= link_to "Edit this player", edit_player_path(@player) %> | + <%= link_to "Back to players", players_path %> + + <%= button_to "Destroy this player", @player, method: :delete %> +</div> diff --git a/app/views/players/show.json.jbuilder b/app/views/players/show.json.jbuilder new file mode 100644 index 0000000..07dba4a --- /dev/null +++ b/app/views/players/show.json.jbuilder @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +json.partial! 'players/player', player: @player |