added virtuals
This commit is contained in:
27
app/views/virtuals/_form.html.erb
Normal file
27
app/views/virtuals/_form.html.erb
Normal file
@@ -0,0 +1,27 @@
|
||||
<%= form_with(model: virtual) do |form| %>
|
||||
<% if virtual.errors.any? %>
|
||||
<div style="color: red">
|
||||
<h2><%= pluralize(virtual.errors.count, "error") %> prohibited this virtual from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% virtual.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= form.label :email, style: "display: block" %>
|
||||
<%= form.text_field :email %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :destination, style: "display: block" %>
|
||||
<%= form.text_field :destination %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
12
app/views/virtuals/_virtual.html.erb
Normal file
12
app/views/virtuals/_virtual.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<div id="<%= dom_id virtual %>">
|
||||
<p>
|
||||
<strong>Email:</strong>
|
||||
<%= virtual.email %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Destination:</strong>
|
||||
<%= virtual.destination %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
2
app/views/virtuals/_virtual.json.jbuilder
Normal file
2
app/views/virtuals/_virtual.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! virtual, :id, :email, :destination, :created_at, :updated_at
|
||||
json.url virtual_url(virtual, format: :json)
|
||||
10
app/views/virtuals/edit.html.erb
Normal file
10
app/views/virtuals/edit.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<h1>Editing virtual</h1>
|
||||
|
||||
<%= render "form", virtual: @virtual %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Show this virtual", @virtual %> |
|
||||
<%= link_to "Back to virtuals", virtuals_path %>
|
||||
</div>
|
||||
14
app/views/virtuals/index.html.erb
Normal file
14
app/views/virtuals/index.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<h1>Virtuals</h1>
|
||||
|
||||
<div id="virtuals">
|
||||
<% @virtuals.each do |virtual| %>
|
||||
<%= render virtual %>
|
||||
<p>
|
||||
<%= link_to "Show this virtual", virtual %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to "New virtual", new_virtual_path %>
|
||||
1
app/views/virtuals/index.json.jbuilder
Normal file
1
app/views/virtuals/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @virtuals, partial: "virtuals/virtual", as: :virtual
|
||||
9
app/views/virtuals/new.html.erb
Normal file
9
app/views/virtuals/new.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<h1>New virtual</h1>
|
||||
|
||||
<%= render "form", virtual: @virtual %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Back to virtuals", virtuals_path %>
|
||||
</div>
|
||||
10
app/views/virtuals/show.html.erb
Normal file
10
app/views/virtuals/show.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @virtual %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Edit this virtual", edit_virtual_path(@virtual) %> |
|
||||
<%= link_to "Back to virtuals", virtuals_path %>
|
||||
|
||||
<%= button_to "Destroy this virtual", @virtual, method: :delete %>
|
||||
</div>
|
||||
1
app/views/virtuals/show.json.jbuilder
Normal file
1
app/views/virtuals/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "virtuals/virtual", virtual: @virtual
|
||||
Reference in New Issue
Block a user