Initial commit
This commit is contained in:
49
app/views/spaces/_form.html.erb
Normal file
49
app/views/spaces/_form.html.erb
Normal file
@@ -0,0 +1,49 @@
|
||||
<%= form_for(@space) do |f| %>
|
||||
<% if @space.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@space.errors.count, "error") %> prohibited this space from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @space.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :name %><br>
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :type %><br>
|
||||
<%= f.text_field :type %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :address %><br>
|
||||
<%= f.text_field :address %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :hours %><br>
|
||||
<%= f.text_field :hours %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :phone %><br>
|
||||
<%= f.text_field :phone %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :email %><br>
|
||||
<%= f.text_field :email %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :website %><br>
|
||||
<%= f.text_field :website %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :description %><br>
|
||||
<%= f.text_area :description %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/spaces/edit.html.erb
Normal file
6
app/views/spaces/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing space</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @space %> |
|
||||
<%= link_to 'Back', spaces_path %>
|
||||
41
app/views/spaces/index.html.erb
Normal file
41
app/views/spaces/index.html.erb
Normal file
@@ -0,0 +1,41 @@
|
||||
<h1>Listing spaces</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Address</th>
|
||||
<th>Hours</th>
|
||||
<th>Phone</th>
|
||||
<th>Email</th>
|
||||
<th>Website</th>
|
||||
<th>Description</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @spaces.each do |space| %>
|
||||
<tr>
|
||||
<td><%= space.name %></td>
|
||||
<td><%= space.type %></td>
|
||||
<td><%= space.address %></td>
|
||||
<td><%= space.hours %></td>
|
||||
<td><%= space.phone %></td>
|
||||
<td><%= space.email %></td>
|
||||
<td><%= space.website %></td>
|
||||
<td><%= space.description %></td>
|
||||
<td><%= link_to 'Show', space %></td>
|
||||
<td><%= link_to 'Edit', edit_space_path(space) %></td>
|
||||
<td><%= link_to 'Destroy', space, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Space', new_space_path %>
|
||||
4
app/views/spaces/index.json.jbuilder
Normal file
4
app/views/spaces/index.json.jbuilder
Normal file
@@ -0,0 +1,4 @@
|
||||
json.array!(@spaces) do |space|
|
||||
json.extract! space, :name, :type, :address, :hours, :phone, :email, :website, :description
|
||||
json.url space_url(space, format: :json)
|
||||
end
|
||||
5
app/views/spaces/new.html.erb
Normal file
5
app/views/spaces/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New space</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', spaces_path %>
|
||||
44
app/views/spaces/show.html.erb
Normal file
44
app/views/spaces/show.html.erb
Normal file
@@ -0,0 +1,44 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= @space.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Type:</strong>
|
||||
<%= @space.type %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Address:</strong>
|
||||
<%= @space.address %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Hours:</strong>
|
||||
<%= @space.hours %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Phone:</strong>
|
||||
<%= @space.phone %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Email:</strong>
|
||||
<%= @space.email %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Website:</strong>
|
||||
<%= @space.website %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= @space.description %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_space_path(@space) %> |
|
||||
<%= link_to 'Back', spaces_path %>
|
||||
1
app/views/spaces/show.json.jbuilder
Normal file
1
app/views/spaces/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.extract! @space, :name, :type, :address, :hours, :phone, :email, :website, :description, :created_at, :updated_at
|
||||
Reference in New Issue
Block a user