Latest updates

This commit is contained in:
2022-04-07 12:45:09 +01:00
parent 557b43c911
commit 21b42c69a5
25 changed files with 412 additions and 14 deletions

View 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>

View File

@@ -0,0 +1,2 @@
json.extract! caf, :id, :company_id, :name, :description, :created_at, :updated_at
json.url caf_url(caf, format: :json)

View 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 %>

View 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>

View 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) %>

View File

@@ -0,0 +1 @@
json.array! @cafs, partial: "cafs/caf", as: :caf

View 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>

View 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>

View File

@@ -0,0 +1 @@
json.partial! "cafs/caf", caf: @caf

View File

@@ -1,5 +1,4 @@
<h1>CAF Compliance Tracking</h1>
<h2>By Hidden Agenda Ltd</h2>
<% if !user_signed_in? %>
Not Signed in.
@@ -7,11 +6,28 @@ Not Signed in.
<% else %>
<%#= current_user.roletxt %>
<% if current_user.admin? %>
<h2>Companies</h2>
<%= link_to "Add Company", new_company_path %>
<h3>Companies <small><%= link_to "Add Company", new_company_path %></small></h3>
<ul>
<% @companies.each do |company| %>
<li><%= company.name %> <%= link_to "Edit", edit_company_path(company) %>
<ul>
<% company.users.each do |user|%>
<li><%= user.email %></li>
<% end %>
<li>Add user</li>
</ul>
<ul>
<% company.cafs.each do |caf| %>
<li><%= caf.name %>
<% end %>
<li><%= link_to "Add CAF", new_company_caf_path(company) %></li>
</ul>
<% end %>
</ul>
<p>
<%= link_to "Add User" %>
</p>
<% end %>
<% if current_user.user? %>