employee login and authentication with session

This commit is contained in:
Min Zeya Phyo
2017-04-14 22:47:44 +06:30
parent c1e61c1a39
commit db75780267
27 changed files with 137 additions and 96 deletions

View File

@@ -1,2 +0,0 @@
json.extract! employee, :id, :name, :role, :encrypted_access_code, :created_at, :updated_at
json.url employee_url(employee, format: :json)

View File

@@ -4,6 +4,7 @@
<div class="form-inputs">
<%= f.input :name %>
<%= f.input :role, :collection => Lookup.collection_of("employee_roles") %>
<%= f.input :emp_id, :as => :integer, :label => "Employee Numberic ID (*Unique)" %>
<%= f.input :password %>
</div>

View File

@@ -1,6 +1,11 @@
<h1>Editing Employee</h1>
<%= render 'form', employee: @employee %>
<%= link_to 'Show', @employee %> |
<%= link_to 'Back', employees_path %>
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_employees_path %>">Employees</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', employee: @employee %>
</div>

View File

@@ -13,20 +13,19 @@
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Role</th>
<th colspan="3"></th>
<th style="width:40%">Name</th>
<th style="width:40%">Role</th>
<th style="width:20%">Action</th>
</tr>
</thead>
<tbody>
<% @employees.each do |employee| %>
<tr>
<td><%= employee.name %></td>
<td><%= link_to employee.name, employee[:setting] %></td>
<td><%= employee.role %></td>
<td><%= link_to 'Show', employee[:setting] %></td>
<td><%= link_to 'Edit', edit_settings_employee_path(employee) %></td>
<td><%= link_to 'Destroy', employee[:setting], method: :delete, data: { confirm: 'Are you sure?' } %></td>
<td>
<%= link_to 'Edit', edit_settings_employee_path(employee) %> | <%= link_to 'Destroy', employee[:setting], method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>

View File

@@ -1 +0,0 @@
json.array! @employees, partial: 'employees/employee', as: :employee

View File

@@ -1 +0,0 @@
json.partial! "employees/employee", employee: @employee