Skip to content

Commit ba327ee

Browse files
committed
Add a simple home page; fixes #5
1 parent c76e72b commit ba327ee

File tree

6 files changed

+34
-5
lines changed

6 files changed

+34
-5
lines changed

app/controllers/home_controller.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class HomeController < ApplicationController
2+
def index
3+
@jobs = Job.accessible_by(current_ability).page(1).per(5)
4+
end
5+
end

app/views/home/index.html.erb

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<div class="row">
2+
<div class="col-md-6">
3+
<div class="jumbotron">
4+
<h1 class="display-3">Code4Lib Jobs</h1>
5+
<p class="lead">
6+
<a href="http://code4lib.org">code4lib</a> is a niche within a niche:
7+
an international community of software developers, designers and
8+
architects who happen to work in the cultural heritage sector
9+
(libraries, archives, museums, galleries, etc). There are a lot
10+
of esoteric tools, projects and people to know. The idea is that
11+
this job board can help
12+
people get an idea of what kinds of skills and experience are useful
13+
to acquire.
14+
</p>
15+
<%= link_to 'Post new job', new_job_path, class: 'btn btn-primary' %>
16+
</div>
17+
</div>
18+
<div class="col-md-6">
19+
<h1>Recently posted jobs</h1>
20+
<%= render 'jobs/table', jobs: @jobs, show_pagination: false %>
21+
<%= link_to 'All jobs ->', jobs_path, class: 'btn btn-primary' %>
22+
</div>
23+
</div>

app/views/jobs/_table.html.erb

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<%= page_entries_info jobs %>
1+
<% show_pagination = true if show_pagination.nil? %>
2+
<%= page_entries_info jobs if show_pagination %>
23

34
<table class="table table-striped">
45
<thead>
@@ -36,4 +37,4 @@
3637
</tbody>
3738
</table>
3839

39-
<%= paginate jobs, theme: 'twitter-bootstrap-4' %>
40+
<%= paginate jobs, theme: 'twitter-bootstrap-4' if show_pagination %>

app/views/jobs/index.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<% end %>
44

55
<p id="notice"><%= notice %></p>
6-
<%= link_to 'New Job', new_job_path, class: 'btn btn-primary float-right' if can? :create, Job %>
6+
<%= link_to 'Post new job', new_job_path, class: 'btn btn-primary float-right' if can? :create, Job %>
77

88
<h1><%= params[:job_type].humanize if params[:job_type] %> Jobs</h1>
99
<%= render 'table', jobs: @jobs %>

app/views/layouts/application.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<div class="collapse navbar-collapse" id="navbarsMain">
2020
<ul class="navbar-nav mr-auto">
21-
<%= nav_link 'Jobs', root_path %>
21+
<%= nav_link 'Jobs', jobs_path %>
2222
<%= nav_link 'Tags', tags_path %>
2323
<%= nav_link 'Employers', employers_path %>
2424
</ul>

config/routes.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
resources :tags, only: [:index, :show]
99
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
1010

11-
root to: 'jobs#index'
11+
root to: 'home#index'
1212
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
1313
end

0 commit comments

Comments
 (0)