refinerycms-jobs 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2aa9ae56f6c89ca251060d91bbe58bb829d6bab
4
- data.tar.gz: c8f3424a74df86f58cc5b4067a512ad2785dba42
3
+ metadata.gz: f49428ee75b5231b5a1e16a23cdd00a2968883a4
4
+ data.tar.gz: 67068ee5f21b912f94794ebcaeaacbba952e4741
5
5
  SHA512:
6
- metadata.gz: 69a1889f0a6108f945d6d35c1f69279a02f4665903d62b5e091936f8f9a5e63c71b0e93f7fe3d92e653c1fb3fecc56623c2109c338565deb3bdf6174085c1109
7
- data.tar.gz: 19f07fe132997d8c6be4ba1949a5331de058402cbc25e7ff2845730108d7d09e5aee63d18c1ad55940e538d70a5d7dbd91c2d23557e040981194a43ff66738b3
6
+ metadata.gz: 1863462ed7ac02cf97d4a2f270a9ee40b458d5e5583df1c0bf0c28a86b9d55096922635a77de1a7b55d736a8ac63ac00f88cfd92201e90936416cb065c0ae1d6
7
+ data.tar.gz: 33c4962d19b7516905d746e1a55ee76b54c1c734d5ca505acf37b52a98b1361891465bbe7b305974543d56edc75c4dce2a2466ddc747e5113def028ed6228f02
@@ -6,12 +6,14 @@ module Refinery
6
6
  order: 'position ASC',
7
7
  include: [:translations, :job_applications]
8
8
 
9
- private
9
+ protected
10
10
 
11
11
  def job_params
12
12
  params.require(:job).permit permitted_job_params
13
13
  end
14
14
 
15
+ private
16
+
15
17
  def permitted_job_params
16
18
  [
17
19
  :title, :description, :employment_terms, :hours, :position, :draft, :published_at, :fill,
@@ -12,7 +12,7 @@ module Refinery
12
12
 
13
13
  def create
14
14
  @job_application = Refinery::Jobs::JobApplication.new(job_application_params)
15
- @job_application.job_id = @job.id
15
+ @job_application.job_id ||= @job.id
16
16
 
17
17
  if !@job_application.job_id.nil?
18
18
  if @job_application.save
@@ -32,7 +32,7 @@ module Refinery
32
32
  end
33
33
  end
34
34
 
35
- redirect_to refinery.jobs_job_job_application_path(params[:job_id], @job_application)
35
+ redirect_to refinery.jobs_job_job_application_path(@job, @job_application)
36
36
  else
37
37
  render action: 'new'
38
38
  end
@@ -44,7 +44,7 @@ module Refinery
44
44
  protected
45
45
 
46
46
  def find_job
47
- @job = Refinery::Jobs::Job.live.friendly.find(params[:job_id])
47
+ @job = Refinery::Jobs::Job.live.friendly.find(params[:job_id] || params[:job_application][:job_id])
48
48
  end
49
49
 
50
50
  def find_page
@@ -53,14 +53,6 @@ module Refinery
53
53
  .readonly(false)
54
54
  end
55
55
 
56
- def find_by_slug_or_id(slug_or_id)
57
- if slug_or_id.friendly_id?
58
- find_by_slug(slug_or_id)
59
- else
60
- find(slug_or_id)
61
- end
62
- end
63
-
64
56
  def published_before(date=DateTime.now)
65
57
  where(arel_table[:published_at].lt(date))
66
58
  .where(draft: false)
@@ -1,4 +1,4 @@
1
- <%= form_for [refinery, :jobs, @job, @job_application], html: { multipart: true } do |f| %>
1
+ <%= form_for [refinery, job_application], url: refinery.jobs_job_applications_path, html: { multipart: true } do |f| %>
2
2
 
3
3
  <h2><%= t('.job_application_for_position', job_title: @job.title) %></h2>
4
4
 
@@ -19,11 +19,15 @@
19
19
  <%= f.telephone_field :phone, class: 'text', required: 'required' %>
20
20
  </div>
21
21
 
22
- <% if @jobs %>
23
- <div class='field'>
24
- <%= f.label :job_id %>
25
- <%= f.select :job_id, @jobs.collect {|j| [ j.title, j.id ] }, { prompt: t('.select_a_job') }, required: true %>
26
- </div>
22
+ <% if !jobs.nil? %>
23
+ <% if jobs.many? %>
24
+ <div class='field'>
25
+ <%= f.label :job_id, class: 'required' %>
26
+ <%= f.select :job_id, jobs.collect {|j| [ j.title, j.id ] }, { prompt: t('select_a_job') }, required: true %>
27
+ </div>
28
+ <% else %>
29
+ <%= f.hidden_field :job_id, value: jobs.first.id %>
30
+ <% end %>
27
31
  <% end %>
28
32
 
29
33
  <div class='field'>
data/config/routes.rb CHANGED
@@ -2,6 +2,8 @@ Refinery::Core::Engine.routes.draw do
2
2
  namespace :jobs, path: Refinery::Jobs.page_url do
3
3
  root to: "jobs#index"
4
4
 
5
+ resources :job_applications, only: [:new, :create]
6
+
5
7
  resources :jobs, path: '', only: [:index, :show] do
6
8
  resources :job_applications, only: [:new, :create, :show]
7
9
  end
@@ -4,7 +4,7 @@ $:.push File.expand_path('../lib', __FILE__)
4
4
  Gem::Specification.new do |s|
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.name = %q{refinerycms-jobs}
7
- s.version = '3.0.1'
7
+ s.version = '3.0.2'
8
8
  s.summary = %q{Ruby on Rails jobs engine for Refinery CMS.}
9
9
  s.description = %q{Open source Ruby on Rails jobs engine designed for integration with Refinery CMS.}
10
10
  s.email = %q{}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Sanchez
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-07 00:00:00.000000000 Z
12
+ date: 2016-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: refinerycms-core