added the last two models

This commit is contained in:
2023-05-10 19:53:55 +01:00
parent f15f9be809
commit 05f803436e
21 changed files with 303 additions and 6 deletions

View File

@@ -0,0 +1,12 @@
<div id="<%= dom_id credential %>">
<p>
<strong>Email:</strong>
<%= credential.email %>
</p>
<p>
<strong>Password:</strong>
<%= credential.password %>
</p>
</div>

View File

@@ -0,0 +1,2 @@
json.extract! credential, :id, :email, :password, :created_at, :updated_at
json.url credential_url(credential, format: :json)

View File

@@ -0,0 +1,27 @@
<%= form_with(model: credential) do |form| %>
<% if credential.errors.any? %>
<div style="color: red">
<h2><%= pluralize(credential.errors.count, "error") %> prohibited this credential from being saved:</h2>
<ul>
<% credential.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 :password, style: "display: block" %>
<%= form.text_field :password %>
</div>
<div>
<%= form.submit %>
</div>
<% end %>

View File

@@ -0,0 +1,10 @@
<h1>Editing credential</h1>
<%= render "form", credential: @credential %>
<br>
<div>
<%= link_to "Show this credential", @credential %> |
<%= link_to "Back to credentials", credentials_path %>
</div>

View File

@@ -0,0 +1,14 @@
<p style="color: green"><%= notice %></p>
<h1>Credentials</h1>
<div id="credentials">
<% @credentials.each do |credential| %>
<%= render credential %>
<p>
<%= link_to "Show this credential", credential %>
</p>
<% end %>
</div>
<%= link_to "New credential", new_credential_path %>

View File

@@ -0,0 +1 @@
json.array! @credentials, partial: "credentials/credential", as: :credential

View File

@@ -0,0 +1,9 @@
<h1>New credential</h1>
<%= render "form", credential: @credential %>
<br>
<div>
<%= link_to "Back to credentials", credentials_path %>
</div>

View File

@@ -0,0 +1,10 @@
<p style="color: green"><%= notice %></p>
<%= render @credential %>
<div>
<%= link_to "Edit this credential", edit_credential_path(@credential) %> |
<%= link_to "Back to credentials", credentials_path %>
<%= button_to "Destroy this credential", @credential, method: :delete %>
</div>

View File

@@ -0,0 +1 @@
json.partial! "credentials/credential", credential: @credential