-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Index and new actions for jobs and departments.
Test coverage.
- Loading branch information
phill
committed
Mar 1, 2016
1 parent
7cf30f4
commit a56dd02
Showing
40 changed files
with
497 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,11 @@ | ||
== README | ||
== Employment agency | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
This application keeps a record of HR department's operations. | ||
It implements the following operations: | ||
|
||
Things you may want to cover: | ||
* Creation of a new employee | ||
* Editing employee's attributes | ||
* Move an employee to another department or job and change salary | ||
* Dismissal an employee | ||
* Review operations connected with an employee | ||
|
||
* Ruby version | ||
|
||
* System dependencies | ||
|
||
* Configuration | ||
|
||
* Database creation | ||
|
||
* Database initialization | ||
|
||
* How to run the test suite | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
|
||
* Deployment instructions | ||
|
||
* ... | ||
|
||
|
||
Please feel free to use a different markup language if you do not plan to run | ||
<tt>rake doc:app</tt>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class DepartmentsController < ApplicationController | ||
|
||
# Shows a list of departments | ||
def index | ||
@departments = Department.all | ||
end | ||
|
||
# Shows a form for a new department | ||
def new | ||
@department = Department.new | ||
end | ||
|
||
# Creates a department | ||
def create | ||
@department = Department.new(department_params) | ||
|
||
if @department.save | ||
redirect_to departments_path | ||
else | ||
render 'new' | ||
end | ||
end | ||
|
||
private | ||
|
||
def department_params | ||
params.require(:department).permit(:name) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class JobsController < ApplicationController | ||
|
||
# Shows a list of jobs | ||
def index | ||
@jobs = Job.all | ||
end | ||
|
||
# Shows a form for a new job | ||
def new | ||
@job = Job.new | ||
end | ||
|
||
# Creates a job | ||
def create | ||
@job = Job.new(job_params) | ||
|
||
if @job.save | ||
redirect_to jobs_path | ||
else | ||
render 'new' | ||
end | ||
end | ||
|
||
private | ||
|
||
def job_params | ||
params.require(:job).permit(:name) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<tr> | ||
<td><%= department.name %></td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class="page-header"> | ||
<h1>Departments</h1> | ||
</div> | ||
|
||
<p> | ||
<a class="btn btn-success" href="<%= new_department_path %>">Add a department</a> | ||
</p> | ||
|
||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render :partial => @departments %> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="page-header"> | ||
<h2>New department</h2> | ||
</div> | ||
|
||
<%= bootstrap_form_for @department do |f| %> | ||
|
||
<%= f.text_field :name %> | ||
|
||
<div class="form-actions"> | ||
<%= f.submit "Create", class: "btn btn-primary" %> | ||
<%= link_to "Return", departments_path, class: "btn btn-default" %> | ||
</div> | ||
|
||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<tr> | ||
<td><%= action.date %></td> | ||
<td><%= action.type_text %></td> | ||
<td><span class="label label-<%= action.type_class %>"><%= action.type_text %></span></td> | ||
<td><%= display_changes(action.department_old.try(:name), action.department_new.try(:name)) %></td> | ||
<td><%= display_changes(action.job_old.try(:name), action.job_new.try(:name)) %></td> | ||
<td><%= display_changes(action.salary_old, action.salary_new) %></td> | ||
<td><%= display_changes(number_with_delimiter(action.salary_old), number_with_delimiter(action.salary_new)) %></td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<tr> | ||
<td><%= job.name %></td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class="page-header"> | ||
<h1>Jobs</h1> | ||
</div> | ||
|
||
<p> | ||
<a class="btn btn-success" href="<%= new_job_path %>">Add a job</a> | ||
</p> | ||
|
||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render :partial => @jobs %> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="page-header"> | ||
<h2>New job</h2> | ||
</div> | ||
|
||
<%= bootstrap_form_for @job do |f| %> | ||
|
||
<%= f.text_field :name %> | ||
|
||
<div class="form-actions"> | ||
<%= f.submit "Create", class: "btn btn-primary" %> | ||
<%= link_to "Return", jobs_path, class: "btn btn-default" %> | ||
</div> | ||
|
||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div id="navbar" class="collapse navbar-collapse"> | ||
<ul class="nav navbar-nav"> | ||
<li><%= link_to "Employees", employees_path %></li> | ||
<li><%= link_to "Departments", departments_path %></li> | ||
<li><%= link_to "Jobs", jobs_path %></li> | ||
</ul> | ||
</div> |
Oops, something went wrong.