Latest updates
This commit is contained in:
17
app/views/cafs/_caf.html.erb
Normal file
17
app/views/cafs/_caf.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<div id="<%= dom_id caf %>">
|
||||
<p>
|
||||
<strong>Company:</strong>
|
||||
<%= caf.company_id %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= caf.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= caf.description %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
2
app/views/cafs/_caf.json.jbuilder
Normal file
2
app/views/cafs/_caf.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! caf, :id, :company_id, :name, :description, :created_at, :updated_at
|
||||
json.url caf_url(caf, format: :json)
|
||||
30
app/views/cafs/_form.html.erb
Normal file
30
app/views/cafs/_form.html.erb
Normal file
@@ -0,0 +1,30 @@
|
||||
<%= form_for( [company, caf] ) do |form| %>
|
||||
<% if caf.errors.any? %>
|
||||
<div style="color: red">
|
||||
<h2><%= pluralize(caf.errors.count, "error") %> prohibited this caf from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% caf.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= form.hidden_field :company_id, value: company.id %>
|
||||
|
||||
|
||||
<div>
|
||||
<%= form.label :name, style: "display: block" %>
|
||||
<%= form.text_field :name %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :description, style: "display: block" %>
|
||||
<%= form.text_area :description %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
10
app/views/cafs/edit.html.erb
Normal file
10
app/views/cafs/edit.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<h1>Editing caf</h1>
|
||||
|
||||
<%= render "form", caf: @caf %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Show this caf", @caf %> |
|
||||
<%= link_to "Back to cafs", cafs_path %>
|
||||
</div>
|
||||
14
app/views/cafs/index.html.erb
Normal file
14
app/views/cafs/index.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<h1>Cafs</h1>
|
||||
|
||||
<div id="cafs">
|
||||
<% @cafs.each do |caf| %>
|
||||
<%= render caf %>
|
||||
<p>
|
||||
<%= link_to "Show this caf", caf %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to "New caf", new_company_caf_path(@company) %>
|
||||
1
app/views/cafs/index.json.jbuilder
Normal file
1
app/views/cafs/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @cafs, partial: "cafs/caf", as: :caf
|
||||
9
app/views/cafs/new.html.erb
Normal file
9
app/views/cafs/new.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<h1>New caf</h1>
|
||||
|
||||
<%= render partial: "form", locals: { company: @company, caf: @caf } %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Back to cafs", company_cafs_path(@company) %>
|
||||
</div>
|
||||
10
app/views/cafs/show.html.erb
Normal file
10
app/views/cafs/show.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @caf %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Edit this caf", edit_caf_path(@caf) %> |
|
||||
<%= link_to "Back to cafs", cafs_path %>
|
||||
|
||||
<%= button_to "Destroy this caf", @caf, method: :delete %>
|
||||
</div>
|
||||
1
app/views/cafs/show.json.jbuilder
Normal file
1
app/views/cafs/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "cafs/caf", caf: @caf
|
||||
Reference in New Issue
Block a user