Added loads

This commit is contained in:
Jeremy Caudle
2022-02-06 15:04:32 +00:00
parent 140921ce10
commit 055b79373c
42 changed files with 944 additions and 7 deletions

View File

@@ -0,0 +1,7 @@
<div id="<%= dom_id company %>">
<p>
<strong>Name:</strong>
<%= company.name %>
</p>
</div>

View File

@@ -0,0 +1,2 @@
json.extract! company, :id, :name, :created_at, :updated_at
json.url company_url(company, format: :json)

View File

@@ -0,0 +1,22 @@
<%= form_with(model: company) do |form| %>
<% if company.errors.any? %>
<div style="color: red">
<h2><%= pluralize(company.errors.count, "error") %> prohibited this company from being saved:</h2>
<ul>
<% company.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.submit %>
</div>
<% end %>

View File

@@ -0,0 +1,10 @@
<h1>Editing company</h1>
<%= render "form", company: @company %>
<br>
<div>
<%= link_to "Show this company", @company %> |
<%= link_to "Back to companies", companies_path %>
</div>

View File

@@ -0,0 +1,14 @@
<p style="color: green"><%= notice %></p>
<h1>Companies</h1>
<div id="companies">
<% @companies.each do |company| %>
<%= render company %>
<p>
<%= link_to "Show this company", company %>
</p>
<% end %>
</div>
<%= link_to "New company", new_company_path %>

View File

@@ -0,0 +1 @@
json.array! @companies, partial: "companies/company", as: :company

View File

@@ -0,0 +1,9 @@
<h1>New company</h1>
<%= render "form", company: @company %>
<br>
<div>
<%= link_to "Back to companies", companies_path %>
</div>

View File

@@ -0,0 +1,10 @@
<p style="color: green"><%= notice %></p>
<%= render @company %>
<div>
<%= link_to "Edit this company", edit_company_path(@company) %> |
<%= link_to "Back to companies", companies_path %>
<%= button_to "Destroy this company", @company, method: :delete %>
</div>

View File

@@ -0,0 +1 @@
json.partial! "companies/company", company: @company