From 2c8c227493509175fcdbcba3e6a85f8b954a169e Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 15 Jan 2022 12:10:26 -0500 Subject: init --- app/views/players/_form.html.erb | 32 ++++++++++++++++++++++++++++++++ app/views/players/_player.html.erb | 17 +++++++++++++++++ app/views/players/_player.json.jbuilder | 4 ++++ app/views/players/edit.html.erb | 10 ++++++++++ app/views/players/index.html.erb | 14 ++++++++++++++ app/views/players/index.json.jbuilder | 3 +++ app/views/players/new.html.erb | 9 +++++++++ app/views/players/show.html.erb | 10 ++++++++++ app/views/players/show.json.jbuilder | 3 +++ 9 files changed, 102 insertions(+) create mode 100644 app/views/players/_form.html.erb create mode 100644 app/views/players/_player.html.erb create mode 100644 app/views/players/_player.json.jbuilder create mode 100644 app/views/players/edit.html.erb create mode 100644 app/views/players/index.html.erb create mode 100644 app/views/players/index.json.jbuilder create mode 100644 app/views/players/new.html.erb create mode 100644 app/views/players/show.html.erb create mode 100644 app/views/players/show.json.jbuilder (limited to 'app/views/players') 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? %> +
+

<%= pluralize(player.errors.count, "error") %> prohibited this player from being saved:

+ + +
+ <% end %> + +
+ <%= form.label :name, style: "display: block" %> + <%= form.text_field :name %> +
+ +
+ <%= form.label :paid, style: "display: block" %> + <%= form.check_box :paid %> +
+ +
+ <%= form.label :strikes, style: "display: block" %> + <%= form.number_field :strikes %> +
+ +
+ <%= form.submit %> +
+<% 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 @@ +
+

+ Name: + <%= player.name %> +

+ +

+ Paid: + <%= player.paid %> +

+ +

+ Strikes: + <%= player.strikes %> +

+ +
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 @@ +

Editing player

+ +<%= render "form", player: @player %> + +
+ +
+ <%= link_to "Show this player", @player %> | + <%= link_to "Back to players", players_path %> +
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 @@ +

<%= notice %>

+ +

Players

+ +
+ <% @players.each do |player| %> + <%= render player %> +

+ <%= link_to "Show this player", player %> +

+ <% end %> +
+ +<%= 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 @@ +

New player

+ +<%= render "form", player: @player %> + +
+ +
+ <%= link_to "Back to players", players_path %> +
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 @@ +

<%= notice %>

+ +<%= render @player %> + +
+ <%= link_to "Edit this player", edit_player_path(@player) %> | + <%= link_to "Back to players", players_path %> + + <%= button_to "Destroy this player", @player, method: :delete %> +
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 -- cgit 1.4.1