Adding versioning
This commit is contained in:
@@ -2,4 +2,8 @@ class ApplicationController < ActionController::Base
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
def info_for_paper_trail
|
||||
{ :whodunnit => request.remote_ip }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
class Space < ActiveRecord::Base
|
||||
has_paper_trail
|
||||
end
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
<%= f.text_field :name %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :type %><br>
|
||||
<%= f.text_field :type %>
|
||||
<%= f.label :category %><br>
|
||||
<%= f.text_field :category %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :address %><br>
|
||||
|
||||
40
app/views/spaces/_space.html.erb
Normal file
40
app/views/spaces/_space.html.erb
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= space.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Category:</strong>
|
||||
<%= space.category %>
|
||||
</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>
|
||||
@@ -4,7 +4,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Category</th>
|
||||
<th>Address</th>
|
||||
<th>Hours</th>
|
||||
<th>Phone</th>
|
||||
@@ -21,7 +21,7 @@
|
||||
<% @spaces.each do |space| %>
|
||||
<tr>
|
||||
<td><%= space.name %></td>
|
||||
<td><%= space.type %></td>
|
||||
<td><%= space.category %></td>
|
||||
<td><%= space.address %></td>
|
||||
<td><%= space.hours %></td>
|
||||
<td><%= space.phone %></td>
|
||||
|
||||
@@ -1,44 +1,18 @@
|
||||
<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>
|
||||
<%= render partial: "space", locals: {space: @space} %>
|
||||
|
||||
<%= link_to 'Edit', edit_space_path(@space) %> |
|
||||
<%= link_to 'Back', spaces_path %>
|
||||
|
||||
<h3>Revision history</h3>
|
||||
<dl>
|
||||
<% @space.versions.each do |v| %>
|
||||
<dt><b><%= v.event.capitalize %> <%= v.created_at %> <%= v.whodunnit if v.whodunnit %></b></dt>
|
||||
<dd>
|
||||
<% if v.reify %>
|
||||
<%= render partial: "space", locals: {space: v.reify} %>
|
||||
<% end %>
|
||||
</dd>
|
||||
<% end %>
|
||||
</dl>
|
||||
Reference in New Issue
Block a user