cleaned up accounts

This commit is contained in:
2016-09-28 22:12:55 -05:00
parent 33f3be1c79
commit 81c667da0f
11 changed files with 34 additions and 35 deletions

View File

@ -52,6 +52,6 @@ class AccountsController < ApplicationController
end
def account_params
params.require(:account).permit(:username, :password, :home, :site)
params.require(:account).permit(:username, :password, :home_folder, :contact_email)
end
end

View File

@ -4,6 +4,6 @@ class Account < ApplicationRecord
validates :username, presence: true
validates :password, presence: true
validates :home, presence: true
validates :site, presence: true
validates :home_folder, presence: true
validates :contact_email, presence: true
end

View File

@ -1,3 +1,3 @@
# frozen_string_literal: true
json.extract! account, :id, :username, :password, :home, :site, :created_at, :updated_at
json.extract! account, :id, :username, :password, :home_folder, :contact_email, :created_at, :updated_at
json.url account_url(account, format: :json)

View File

@ -22,13 +22,13 @@
</div>
<div class="field">
<%= f.label :home %>
<%= f.text_field :home %>
<%= f.label :home_folder %>
<%= f.text_field :home_folder %>
</div>
<div class="field">
<%= f.label :site %>
<%= f.text_field :site %>
<%= f.label :contact_email %>
<%= f.text_field :contact_email %>
</div>
<div class="actions">

View File

@ -5,10 +5,10 @@
<table>
<thead>
<tr>
<th>Home Folder</th>
<th>Username</th>
<th>Password</th>
<th>Site</th>
<th>Home</th>
<th>Contact eMail</th>
<th colspan="3"></th>
</tr>
</thead>
@ -16,6 +16,7 @@
<tbody>
<% @accounts.each do |account| %>
<tr>
<td><%= account.home_folder %></td>
<td><%= account.username %></td>
<td class="passwd" data-id="passwd">
<%= link_to reveal_password_path(account.id), remote: true do %>
@ -23,8 +24,7 @@
<% end %>
<span>********</span>
</td>
<td><%= account.site %></td>
<td><%= account.home %></td>
<td><%= account.contact_email %></td>
<td><%= link_to 'Show', account %></td>
<td><%= link_to 'Edit', edit_account_path(account) %></td>
</tr>

View File

@ -16,13 +16,13 @@
</p>
<p>
<strong>Home:</strong>
<%= @account.home %>
<strong>Home Folder:</strong>
<%= @account.home_folder %>
</p>
<p>
<strong>Site:</strong>
<%= @account.site %>
<strong>Contact Email:</strong>
<%= @account.contact_email %>
</p>
<%= link_to 'Destroy', @account, method: :delete, data: { confirm: 'Are you sure?' } %>