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/machines/_form.html.erb | 27 +++++++++++++++++++++++++++ app/views/machines/_machine.html.erb | 12 ++++++++++++ app/views/machines/_machine.json.jbuilder | 4 ++++ app/views/machines/edit.html.erb | 10 ++++++++++ app/views/machines/index.html.erb | 14 ++++++++++++++ app/views/machines/index.json.jbuilder | 3 +++ app/views/machines/new.html.erb | 9 +++++++++ app/views/machines/show.html.erb | 10 ++++++++++ app/views/machines/show.json.jbuilder | 3 +++ 9 files changed, 92 insertions(+) create mode 100644 app/views/machines/_form.html.erb create mode 100644 app/views/machines/_machine.html.erb create mode 100644 app/views/machines/_machine.json.jbuilder create mode 100644 app/views/machines/edit.html.erb create mode 100644 app/views/machines/index.html.erb create mode 100644 app/views/machines/index.json.jbuilder create mode 100644 app/views/machines/new.html.erb create mode 100644 app/views/machines/show.html.erb create mode 100644 app/views/machines/show.json.jbuilder (limited to 'app/views/machines') 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? %> +
+

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

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

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

+ +

+ Edition: + <%= machine.edition %> +

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

Editing machine

+ +<%= render "form", machine: @machine %> + +
+ +
+ <%= link_to "Show this machine", @machine %> | + <%= link_to "Back to machines", machines_path %> +
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 @@ +

<%= notice %>

+ +

Machines

+ +
+ <% @machines.each do |machine| %> + <%= render machine %> +

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

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

New machine

+ +<%= render "form", machine: @machine %> + +
+ +
+ <%= link_to "Back to machines", machines_path %> +
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 @@ +

<%= notice %>

+ +<%= render @machine %> + +
+ <%= link_to "Edit this machine", edit_machine_path(@machine) %> | + <%= link_to "Back to machines", machines_path %> + + <%= button_to "Destroy this machine", @machine, method: :delete %> +
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 -- cgit 1.4.1