Skip to content

Commit 48855cb

Browse files
committed
Added duration to jobs model
1 parent 1b8bdb5 commit 48855cb

9 files changed

+23
-1280
lines changed

app/assets/stylesheets/custom.css.scss

+5
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,9 @@ p {
310310
.job_expire select {
311311
width: 30%;
312312
display: inline;
313+
}
314+
315+
#dropdowns select {
316+
width: 30%;
317+
display: inline;
313318
}

app/controllers/jobs_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ def find_job
4747
end
4848

4949
def job_params
50-
params.require(:job).permit(:title, :description, :responsibilities, :additional_info, :question, :category_id, :location, :job_type_id, :expire)
50+
params.require(:job).permit(:title, :description, :responsibilities, :additional_info, :question, :category_id, :location, :job_type_id, :expire, :duration)
5151
end
5252
end

app/views/jobs/_filtering.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{ class: 'chosen-select' }
99
%><br>
1010
<%= f.label :category_name_eq, "Category" %><br>
11-
<%= f.collection_select(:category_name_eq, Category.all, :name, :name) %><br>
11+
<%= f.collection_select(:category_name_eq, Category.all, :name, :name)%><br>
1212
<%= f.label :job_type_name_eq, "Job Type" %><br>
1313
<%= f.collection_select(:job_type_name_eq, JobType.all, :name, :name) %><br>
1414
<%= f.label :employer_id_eq, "Where at?" %><br>

app/views/jobs/_form.html.erb

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<%= minimal_form_for @job do |f| %>
22

33
<div id="dropdowns">
4-
<%= f.collection_select :category_id, Category.all, :id, :name, {prompt: "Choose a category"} %>
5-
<%= f.collection_select :job_type_id, JobType.all, :id, :name, {prompt: "Choose Job Type"} %>
4+
<%= f.collection_select :category_id, Category.all, :id, :name, {prompt: "Choose a category"}, class: "form-control" %>
5+
<%= f.collection_select :job_type_id, JobType.all, :id, :name, {prompt: "Choose Job Type"}, class: "form-control" %>
66
</div>
77
<%= f.input :title %>
88
<div id="dropdowns">
99
<%= f.select :location,
1010
City.all.map { |u| [u.name, u.name] },
1111
{ include_blank: true },
12-
{ class: 'chosen-select' }
12+
{ class: 'chosen-select form-control' }
1313
%>
1414
</div>
1515
<%= f.input :expire %>
16+
<%= f.input :duration, hint: "In Months" %>
1617
<%= f.input :description %>
1718
<%= f.input :responsibilities %>
1819
<%= f.input :additional_info %>

app/views/jobs/show.html.erb

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<span class="glyphicon glyphicon-briefcase"></span> <%= @job.category.name %> &nbsp;
1010
<span class="glyphicon glyphicon-time"></span> <%= @job.job_type.name %> &nbsp;
1111
<span class="glyphicon glyphicon-time"></span> <%= @job.expire %> &nbsp;
12+
<span class="glyphicon glyphicon-time"></span> <%= @job.duration %> Months&nbsp;
1213
<span class="glyphicon glyphicon-map-marker"></span> <%= @job.location %> &nbsp;
1314
</p>
1415
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddDurationToJobs < ActiveRecord::Migration
2+
def change
3+
add_column :jobs, :duration, :integer
4+
end
5+
end

db/schema.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended that you check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(version: 20151025141443) do
14+
ActiveRecord::Schema.define(version: 20151028063249) do
1515

1616
create_table "categories", force: true do |t|
1717
t.string "name"
@@ -67,6 +67,7 @@
6767
t.string "location"
6868
t.integer "job_type_id"
6969
t.date "expire"
70+
t.integer "duration"
7071
end
7172

7273
create_table "responses", force: true do |t|

db/seeds.rb

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
city_list = [
1010
[
11+
"Remote",
12+
"Anywhere"
13+
],
14+
[
1115
"Mumbai",
1216
"Maharashtra"
1317
],

0 commit comments

Comments
 (0)