added the last two models
This commit is contained in:
12
app/views/credentials/_credential.html.erb
Normal file
12
app/views/credentials/_credential.html.erb
Normal 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>
|
||||
2
app/views/credentials/_credential.json.jbuilder
Normal file
2
app/views/credentials/_credential.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! credential, :id, :email, :password, :created_at, :updated_at
|
||||
json.url credential_url(credential, format: :json)
|
||||
27
app/views/credentials/_form.html.erb
Normal file
27
app/views/credentials/_form.html.erb
Normal 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 %>
|
||||
10
app/views/credentials/edit.html.erb
Normal file
10
app/views/credentials/edit.html.erb
Normal 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>
|
||||
14
app/views/credentials/index.html.erb
Normal file
14
app/views/credentials/index.html.erb
Normal 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 %>
|
||||
1
app/views/credentials/index.json.jbuilder
Normal file
1
app/views/credentials/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @credentials, partial: "credentials/credential", as: :credential
|
||||
9
app/views/credentials/new.html.erb
Normal file
9
app/views/credentials/new.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<h1>New credential</h1>
|
||||
|
||||
<%= render "form", credential: @credential %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Back to credentials", credentials_path %>
|
||||
</div>
|
||||
10
app/views/credentials/show.html.erb
Normal file
10
app/views/credentials/show.html.erb
Normal 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>
|
||||
1
app/views/credentials/show.json.jbuilder
Normal file
1
app/views/credentials/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "credentials/credential", credential: @credential
|
||||
Reference in New Issue
Block a user