initial commit
This commit is contained in:
47
app/views/clients/_client.html.erb
Normal file
47
app/views/clients/_client.html.erb
Normal file
@@ -0,0 +1,47 @@
|
||||
<div id="<%= dom_id client %>">
|
||||
<p>
|
||||
<strong>Company name:</strong>
|
||||
<%= client.company_name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Firstname:</strong>
|
||||
<%= client.firstname %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Lastname:</strong>
|
||||
<%= client.lastname %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Streetname:</strong>
|
||||
<%= client.streetname %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Zipcode:</strong>
|
||||
<%= client.zipcode %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>City:</strong>
|
||||
<%= client.city %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Country:</strong>
|
||||
<%= client.country %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Email:</strong>
|
||||
<%= client.email %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Phone:</strong>
|
||||
<%= client.phone %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
2
app/views/clients/_client.json.jbuilder
Normal file
2
app/views/clients/_client.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! client, :id, :company_name, :firstname, :lastname, :streetname, :zipcode, :city, :country, :email, :phone, :created_at, :updated_at
|
||||
json.url client_url(client, format: :json)
|
||||
62
app/views/clients/_form.html.erb
Normal file
62
app/views/clients/_form.html.erb
Normal file
@@ -0,0 +1,62 @@
|
||||
<%= form_with(model: client) do |form| %>
|
||||
<% if client.errors.any? %>
|
||||
<div style="color: red">
|
||||
<h2><%= pluralize(client.errors.count, "error") %> prohibited this client from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% client.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= form.label :company_name, style: "display: block" %>
|
||||
<%= form.text_field :company_name %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :firstname, style: "display: block" %>
|
||||
<%= form.text_field :firstname %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :lastname, style: "display: block" %>
|
||||
<%= form.text_field :lastname %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :streetname, style: "display: block" %>
|
||||
<%= form.text_field :streetname %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :zipcode, style: "display: block" %>
|
||||
<%= form.text_field :zipcode %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :city, style: "display: block" %>
|
||||
<%= form.text_field :city %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :country, style: "display: block" %>
|
||||
<%= form.text_field :country %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :email, style: "display: block" %>
|
||||
<%= form.text_field :email %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :phone, style: "display: block" %>
|
||||
<%= form.text_field :phone %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
12
app/views/clients/edit.html.erb
Normal file
12
app/views/clients/edit.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<% content_for :title, "Editing client" %>
|
||||
|
||||
<h1>Editing client</h1>
|
||||
|
||||
<%= render "form", client: @client %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Show this client", @client %> |
|
||||
<%= link_to "Back to clients", clients_path %>
|
||||
</div>
|
||||
16
app/views/clients/index.html.erb
Normal file
16
app/views/clients/index.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<% content_for :title, "Clients" %>
|
||||
|
||||
<h1>Clients</h1>
|
||||
|
||||
<div id="clients">
|
||||
<% @clients.each do |client| %>
|
||||
<%= render client %>
|
||||
<p>
|
||||
<%= link_to "Show this client", client %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to "New client", new_client_path %>
|
||||
1
app/views/clients/index.json.jbuilder
Normal file
1
app/views/clients/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @clients, partial: "clients/client", as: :client
|
||||
11
app/views/clients/new.html.erb
Normal file
11
app/views/clients/new.html.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
<% content_for :title, "New client" %>
|
||||
|
||||
<h1>New client</h1>
|
||||
|
||||
<%= render "form", client: @client %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Back to clients", clients_path %>
|
||||
</div>
|
||||
10
app/views/clients/show.html.erb
Normal file
10
app/views/clients/show.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @client %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Edit this client", edit_client_path(@client) %> |
|
||||
<%= link_to "Back to clients", clients_path %>
|
||||
|
||||
<%= button_to "Destroy this client", @client, method: :delete %>
|
||||
</div>
|
||||
1
app/views/clients/show.json.jbuilder
Normal file
1
app/views/clients/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "clients/client", client: @client
|
||||
Reference in New Issue
Block a user