refinerycms-jobs 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -28
  3. data/.teatro.yml +15 -0
  4. data/.travis.yml +15 -0
  5. data/Gemfile +49 -2
  6. data/Rakefile +5 -5
  7. data/app/controllers/refinery/jobs/admin/job_applications_controller.rb +30 -0
  8. data/app/controllers/refinery/jobs/admin/jobs_controller.rb +13 -33
  9. data/app/controllers/refinery/jobs/admin/settings_controller.rb +4 -4
  10. data/app/controllers/refinery/jobs/job_applications_controller.rb +22 -22
  11. data/app/controllers/refinery/jobs/jobs_controller.rb +9 -6
  12. data/app/helpers/refinery/jobs/controller_helper.rb +7 -3
  13. data/app/models/refinery/jobs/job.rb +19 -5
  14. data/app/models/refinery/jobs/job_application.rb +3 -7
  15. data/app/views/refinery/jobs/admin/{jobs → job_applications}/_job_application.html.erb +13 -1
  16. data/app/views/refinery/jobs/admin/{jobs/job_applications.html.erb → job_applications/index.html.erb} +0 -0
  17. data/app/views/refinery/jobs/admin/jobs/_job.html.erb +33 -23
  18. data/app/views/refinery/jobs/job_applications/_form.html.erb +28 -16
  19. data/bin/rails +5 -0
  20. data/bin/rake +21 -0
  21. data/bin/rspec +22 -0
  22. data/bin/spring +18 -0
  23. data/config/locales/de.yml +105 -0
  24. data/config/locales/en.yml +12 -6
  25. data/config/locales/fr.yml +12 -6
  26. data/config/routes.rb +8 -9
  27. data/db/migrate/20141001192020_add_fields_to_jobs.rb +14 -17
  28. data/db/migrate/20150629201609_add_spam_to_job_applications.rb +5 -0
  29. data/db/seeds.rb +5 -6
  30. data/lib/generators/refinery/jobs/templates/config/initializers/refinery/jobs.rb.erb +2 -0
  31. data/lib/refinery/jobs/configuration.rb +2 -1
  32. data/lib/refinery/jobs/dragonfly.rb +0 -2
  33. data/lib/refinery/jobs/engine.rb +3 -3
  34. data/readme.md +5 -3
  35. data/refinerycms-jobs.gemspec +9 -6
  36. data/spec/factories/helper/factory_sequence.rb +17 -0
  37. data/spec/factories/job.rb +9 -0
  38. data/spec/factories/job_application.rb +11 -0
  39. data/spec/models/refinery/jobs/job_application_spec.rb +42 -0
  40. data/spec/models/refinery/jobs/job_spec.rb +60 -0
  41. data/spec/models/refinery/jobs/settings_spec.rb +43 -0
  42. data/spec/spec_helper.rb +49 -0
  43. data/spec/support/fixtures/refinerycms_is_awesome.txt +1 -0
  44. data/spec/support/helper/generator_helper.rb +11 -0
  45. data/tasks/rspec.rake +6 -0
  46. data/tasks/testing.rake +8 -0
  47. metadata +85 -11
  48. data/app/helpers/refinery/jobs/jobs_helper.rb +0 -7
  49. data/app/views/refinery/jobs/admin/job_applications/_job.html.erb +0 -13
  50. data/app/views/refinery/jobs/admin/job_applications/_sortable_list.html.erb +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bf6508cb6a3b48338b0b91fd97f3a156a90b447
4
- data.tar.gz: 461a6ca77a920595754d42125dcd2dd247992bf6
3
+ metadata.gz: b2aa9ae56f6c89ca251060d91bbe58bb829d6bab
4
+ data.tar.gz: c8f3424a74df86f58cc5b4067a512ad2785dba42
5
5
  SHA512:
6
- metadata.gz: dcac81632f3861b19b9c5fe7aae613a79c7623ee753acd6950de9e7d9f7a7dc5896094ac67f38f6c391ec1dc054ab04468967748bb1376f0196841879924b8a5
7
- data.tar.gz: d69996dcb5eb87b3015ce1b20637b13399859584e0211c479d937a26b0ce7d055bf7bcecd98763f3d3e425cf1ca3f838c0ac659e5a27c25012c9580d8c79596a
6
+ metadata.gz: 69a1889f0a6108f945d6d35c1f69279a02f4665903d62b5e091936f8f9a5e63c71b0e93f7fe3d92e653c1fb3fecc56623c2109c338565deb3bdf6174085c1109
7
+ data.tar.gz: 19f07fe132997d8c6be4ba1949a5331de058402cbc25e7ff2845730108d7d09e5aee63d18c1ad55940e538d70a5d7dbd91c2d23557e040981194a43ff66738b3
data/.gitignore CHANGED
@@ -1,29 +1,9 @@
1
- public/system/*
2
- public/themes/*
3
- log/*.log
4
- tmp/**/*
5
1
  .DS_Store
6
- doc/api
7
- doc/app
8
- doc/*
9
- config/database.yml
10
- config/amazon_s3.yml
11
- config/rackspace_cloudfiles.yml
12
- public/images/system/*
13
- nbproject
14
- index/**/*
15
- db/*.sqlite3
16
- *.tmproj
17
- *.autobackupbyrefinery.*
18
- refinerycms*.gem
19
- public/javascripts/cache
20
- public/stylesheets/cache
21
- config/database.yml.example
22
- .yardoc/
23
- refinerycms.gemspec
24
- .bundle
25
- vendor/cache
26
- *.lock
27
- callsite_hash.*
28
- **/*/slim_scrooge/ext/Makefile
29
- public/javascripts/messages.js
2
+ Gemfile.lock
3
+ spec/dummy
4
+
5
+ # Local Gemfile for developing without sharing dependencies
6
+ .gemfile
7
+ .gems
8
+ .ruby-version
9
+ .rbenv-gemsets
data/.teatro.yml ADDED
@@ -0,0 +1,15 @@
1
+ stage:
2
+ before:
3
+ - bundle exec rake refinery:testing:dummy_app
4
+
5
+ run:
6
+ # workdir is sandbox
7
+ - bundle exec rails server
8
+
9
+ database:
10
+ - echo "skip database stage. rake sandbox already did everything"
11
+
12
+ config:
13
+ database: postgresql
14
+ services:
15
+ - postgresql
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ cache: bundler
3
+ bundler_args: --without development
4
+ before_script: "bin/rake refinery:testing:dummy_app"
5
+ env:
6
+ - DB=postgresql
7
+ - DB=mysql
8
+ notifications:
9
+ webhooks:
10
+ - https://webhooks.gitter.im/e/2e2c6c0937f4fe221327
11
+ rvm:
12
+ - 2.2
13
+ - 2.1
14
+ - 2.0.0
15
+ sudo: false
data/Gemfile CHANGED
@@ -1,5 +1,52 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'refinerycms', '~> 2.0.3'
5
+ git 'https://github.com/refinery/refinerycms', branch: 'master' do
6
+ gem "refinerycms"
7
+
8
+ group :test do
9
+ gem 'refinerycms-testing'
10
+ gem 'poltergeist', github: 'teampoltergeist/poltergeist', branch: 'master'
11
+ end
12
+ end
13
+
14
+ # Database Configuration
15
+ unless ENV["TRAVIS"]
16
+ gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
17
+ gem "sqlite3", platform: :ruby
18
+ end
19
+
20
+ if !ENV["TRAVIS"] || ENV["DB"] == "mysql"
21
+ gem "activerecord-jdbcmysql-adapter", platform: :jruby
22
+ gem "jdbc-mysql", "= 5.1.13", platform: :jruby
23
+ gem "mysql2", platform: :ruby
24
+ end
25
+
26
+ if !ENV["TRAVIS"] || ENV["DB"] == "postgresql"
27
+ gem "activerecord-jdbcpostgresql-adapter", platform: :jruby
28
+ gem "pg", platform: :ruby
29
+ end
30
+
31
+ gem "jruby-openssl", platform: :jruby
32
+
33
+ # Refinery/rails should pull in the proper versions of these
34
+ group :assets do
35
+ gem "sass-rails"
36
+ gem "coffee-rails"
37
+ gem "uglifier"
38
+ end
39
+
40
+ group :development do
41
+ gem 'quiet_assets'
42
+ end
43
+
44
+ group :test do
45
+ gem "launchy"
46
+ gem "byebug"
47
+ end
48
+
49
+ # Load local gems according to Refinery developer preference.
50
+ if File.exist? local_gemfile = File.expand_path("../.gemfile", __FILE__)
51
+ eval File.read(local_gemfile)
52
+ end
data/Rakefile CHANGED
@@ -6,15 +6,15 @@ rescue LoadError
6
6
  end
7
7
 
8
8
  ENGINE_PATH = File.dirname(__FILE__)
9
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
9
+ APP_RAKEFILE = File.expand_path "../spec/dummy/Rakefile", __FILE__
10
10
 
11
- if File.exists?(APP_RAKEFILE)
11
+ if File.exists? APP_RAKEFILE
12
12
  load 'rails/tasks/engine.rake'
13
13
  end
14
14
 
15
15
  require "refinerycms-testing"
16
- Refinery::Testing::Railtie.load_tasks
17
- Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
16
+ Refinery::Testing::Railtie.load_dummy_tasks ENGINE_PATH
18
17
 
19
- load File.expand_path('../tasks/testing.rake', __FILE__)
20
18
  load File.expand_path('../tasks/rspec.rake', __FILE__)
19
+
20
+ task :default => :spec
@@ -0,0 +1,30 @@
1
+ module Refinery
2
+ module Jobs
3
+ module Admin
4
+ class JobApplicationsController < Refinery::AdminController
5
+ before_action :find_job, only: [:index, :destroy]
6
+
7
+ crudify :'refinery/jobs/job_application'
8
+
9
+
10
+ def index
11
+ if @job
12
+ @job_applications = @job.job_applications.paginate( page: params[:page] )
13
+ end
14
+ end
15
+
16
+ def destroy
17
+ Refinery::Jobs::JobApplication.find(params[:id]).destroy
18
+ redirect_to refinery.jobs_admin_job_job_applications_path(@job)
19
+ end
20
+
21
+
22
+ protected
23
+
24
+ def find_job
25
+ @job = Refinery::Jobs::Job.find params[:job_id]
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,43 +1,23 @@
1
1
  module Refinery
2
2
  module Jobs
3
3
  module Admin
4
- class JobsController < ::Refinery::AdminController
4
+ class JobsController < Refinery::AdminController
5
5
  crudify :'refinery/jobs/job',
6
- :order => 'published_at DESC',
7
- :include => [:translations]
8
-
9
- def job_applications
10
- find_job
11
- @job_applications = @job.job_applications.paginate :page => params[:page]
12
- end
6
+ order: 'position ASC',
7
+ include: [:translations, :job_applications]
13
8
 
14
9
  private
15
- def job_params
16
- params.require(:job).permit(
17
- :title,
18
- :description,
19
- :employment_terms,
20
- :hours,
21
- :position,
22
- :draft,
23
- :published_at,
24
- :fill,
25
- :ref,
26
- :education,
27
- :experience,
28
- :skills,
29
- :languages,
30
- :salary,
31
- :length,
32
- :employment_date,
33
- :contact
34
- )
35
- end
36
10
 
37
- protected
38
- def find_job
39
- @job = Refinery::Jobs::Job.find_by_slug_or_id(params[:id])
40
- end
11
+ def job_params
12
+ params.require(:job).permit permitted_job_params
13
+ end
14
+
15
+ def permitted_job_params
16
+ [
17
+ :title, :description, :employment_terms, :hours, :position, :draft, :published_at, :fill,
18
+ :ref, :education, :experience, :skills, :languages, :salary, :length, :employment_date, :contact
19
+ ]
20
+ end
41
21
  end
42
22
  end
43
23
  end
@@ -3,15 +3,15 @@ module Refinery
3
3
  module Admin
4
4
  class SettingsController < Refinery::AdminController
5
5
 
6
- before_filter :find_setting, :only => [:edit, :update]
7
- after_filter :save_subject_for_confirmation,
8
- :save_message_for_confirmation, :save_notification_recipients, :only => :update
6
+ before_action :find_setting, only: [:edit, :update]
7
+ after_action :save_subject_for_confirmation,
8
+ :save_message_for_confirmation, :save_notification_recipients, only: :update
9
9
 
10
10
  def edit
11
11
  end
12
12
 
13
13
  def update
14
- flash[:notice] = t('refinery.crudify.updated', :what => @setting.name.gsub("job_", "").titleize)
14
+ flash[:notice] = t('refinery.crudify.updated', what: @setting.name.gsub("job_", "").titleize)
15
15
 
16
16
  unless request.xhr? or from_dialog?
17
17
  redirect_back_or_default(refinery.jobs_admin_jobs_path)
@@ -1,25 +1,20 @@
1
1
  module Refinery
2
2
  module Jobs
3
3
  class JobApplicationsController < ::ApplicationController
4
- include ControllerHelper
5
4
 
6
- before_filter :find_page
7
- before_filter :find_job, :only => [:new]
5
+ before_action :find_page
6
+ before_action :find_job, only: [:new, :create, :show]
8
7
 
9
8
  def new
10
9
  @job_application = Refinery::Jobs::JobApplication.new
11
-
12
10
  present(@page)
13
11
  end
14
12
 
15
13
  def create
16
14
  @job_application = Refinery::Jobs::JobApplication.new(job_application_params)
17
- @job_id_integer = Refinery::Jobs::Job.find_by_slug_or_id(params[:job_id])
18
-
19
- if !@job_id_integer.nil?
20
- @job_application.job_id = @job_id_integer.id
21
- @job = @job_application.job
15
+ @job_application.job_id = @job.id
22
16
 
17
+ if !@job_application.job_id.nil?
23
18
  if @job_application.save
24
19
  if @job_application.ham? || Refinery::Jobs.send_notifications_for_job_applications_marked_as_spam
25
20
  begin
@@ -37,31 +32,36 @@ module Refinery
37
32
  end
38
33
  end
39
34
 
40
- redirect_to refinery.jobs_job_job_application_url(@job, @job_application)
35
+ redirect_to refinery.jobs_job_job_application_path(params[:job_id], @job_application)
41
36
  else
42
- render :action => 'new'
37
+ render action: 'new'
43
38
  end
44
39
  else
45
40
  error_404
46
41
  end
47
42
  end
48
43
 
49
- def show
50
- @job_application = Refinery::Jobs::JobApplication.find(params[:id])
51
- @job = @job_application.job
44
+ protected
52
45
 
53
- present(@page)
46
+ def find_job
47
+ @job = Refinery::Jobs::Job.live.friendly.find(params[:job_id])
48
+ end
54
49
 
55
- respond_to do |format|
56
- format.html { render :action => 'show' }
57
- format.xml { render :xml => @future_student }
58
- end
50
+ def find_page
51
+ @page = Refinery::Page.friendly.find_by(link_url: Refinery::Jobs.page_url)
52
+ end
53
+
54
+ def job_application_params
55
+ params.require(:job_application).permit(permitted_job_application_params)
59
56
  end
60
57
 
61
58
  private
62
- def job_application_params
63
- params.require(:job_application).permit!
64
- end
59
+
60
+ def permitted_job_application_params
61
+ [
62
+ :job_id, :name, :email, :phone, :cover_letter, :resume
63
+ ]
64
+ end
65
65
  end
66
66
  end
67
67
  end
@@ -3,14 +3,17 @@ module Refinery
3
3
  class JobsController < ::ApplicationController
4
4
  include ControllerHelper
5
5
 
6
- helper :'refinery/jobs/jobs'
7
- before_filter :find_page
8
- before_filter :find_all_jobs, :only => [:index]
9
- before_filter :find_job, :only => [:show]
6
+ before_action :find_page
7
+ before_action :find_all_jobs, only: :index
8
+ before_action :find_job, only: :show
9
+
10
+ before_action :new_job_applicaton, only: [:index, :show]
10
11
 
11
12
  def show
12
- find_job
13
- @job_application = Refinery::Jobs::JobApplication.new
13
+ @breadcrumb = OpenStruct.new({
14
+ title: @job.title,
15
+ url: refinery.jobs_job_url(@job)
16
+ })
14
17
  end
15
18
  end
16
19
  end
@@ -3,15 +3,19 @@ module Refinery
3
3
  module ControllerHelper
4
4
  protected
5
5
  def find_all_jobs
6
- @jobs = Refinery::Jobs::Job.published.friendly.order("position ASC").page(params[:page])
6
+ @jobs = Refinery::Jobs::Job.live.friendly.page(params[:page]).order(:position)
7
7
  end
8
8
 
9
9
  def find_job
10
- @job = Refinery::Jobs::Job.published.friendly.find(params[:id])
10
+ @job = Refinery::Jobs::Job.live.friendly.find(params[:id])
11
11
  end
12
12
 
13
13
  def find_page
14
- @page = Refinery::Page.friendly.find_by(:link_url => '/jobs')
14
+ @page = Refinery::Page.friendly.find_by(link_url: Refinery::Jobs.page_url)
15
+ end
16
+
17
+ def new_job_applicaton
18
+ @job_application = Refinery::Jobs::JobApplication.new
15
19
  end
16
20
  end
17
21
  end
@@ -1,3 +1,5 @@
1
+ require 'acts_as_indexed'
2
+
1
3
  module Refinery
2
4
  module Jobs
3
5
  class Job < ActiveRecord::Base
@@ -6,16 +8,17 @@ module Refinery
6
8
 
7
9
  translates :title, :description, :slug, :education, :experience, :skills, :languages, :salary, :length, :contact
8
10
 
9
- friendly_id :friendly_id_source, :use => [:slugged, :globalize]
11
+ friendly_id :friendly_id_source, use:[:slugged, :finders, :globalize]
10
12
 
11
- acts_as_indexed :fields => [:title, :description, :employment_terms, :hours]
13
+ acts_as_indexed fields: [:title, :description, :employment_terms, :hours]
12
14
 
13
- has_many :job_applications, :dependent => :destroy, :foreign_key => :job_id
15
+ has_many :job_applications, dependent: :destroy, foreign_key: :job_id
14
16
 
15
17
  validates_presence_of :title, :description
16
18
  validates_uniqueness_of :title
17
19
 
18
- scope :published, -> { where :draft => false }
20
+ validates_length_of :title, :employment_terms, :ref, :education, :experience,
21
+ :skills, :languages, :salary, :hours, :employment_terms, :length, :contact, maximum: 255
19
22
 
20
23
  def self.latest(number = 5)
21
24
  limit(number).order('created_at DESC')
@@ -31,6 +34,10 @@ module Refinery
31
34
  title
32
35
  end
33
36
 
37
+ def live?
38
+ !draft && published_at <= DateTime.now
39
+ end
40
+
34
41
  class << self
35
42
  # Wrap up the logic of finding the pages based on the translations table.
36
43
  def with_globalize(conditions = {})
@@ -53,7 +60,14 @@ module Refinery
53
60
  find(slug_or_id)
54
61
  end
55
62
  end
63
+
64
+ def published_before(date=DateTime.now)
65
+ where(arel_table[:published_at].lt(date))
66
+ .where(draft: false)
67
+ .with_globalize
68
+ end
69
+ alias_method :live, :published_before
56
70
  end
57
71
  end
58
72
  end
59
- end
73
+ end
@@ -1,4 +1,3 @@
1
- require 'dragonfly'
2
1
  require 'refinery/core/base_model'
3
2
  require 'filters_spam'
4
3
 
@@ -7,9 +6,9 @@ module Refinery
7
6
  class JobApplication < Refinery::Core::BaseModel
8
7
  self.table_name = 'refinery_job_applications'
9
8
 
10
- dragonfly_accessor :resume, :app => :refinery_jobs
9
+ dragonfly_accessor :resume, app: :refinery_jobs
11
10
 
12
- belongs_to :job, :class_name => "Refinery::Jobs::Job", :foreign_key => "job_id"
11
+ belongs_to :job, class_name: 'Refinery::Jobs::Job', foreign_key: 'job_id'
13
12
 
14
13
  filters_spam message_field: :cover_letter,
15
14
  email_field: :email,
@@ -21,12 +20,9 @@ module Refinery
21
20
  validates :email, format: {
22
21
  with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
23
22
  }, length: { maximum: 255 }
24
- validates :resume, :presence => true
23
+ validates :resume, presence: true
25
24
  validates_with Refinery::Jobs::Validators::FileSizeValidator
26
25
 
27
- def self.latest(number = 5)
28
- limit(number).order('created_at DESC')
29
- end
30
26
  end
31
27
  end
32
28
  end
@@ -1,3 +1,13 @@
1
+ <% # setup params for various action links
2
+ delete_url = refinery.jobs_admin_job_job_application_path(@job, job_application)
3
+ delete_options = {
4
+ class: "cancel confirm-delete",
5
+ data: {
6
+ confirm: t('message', scope: 'refinery.admin.delete', title: job_application.name)
7
+ }
8
+ }
9
+ %>
10
+
1
11
  <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(job_application) -%>">
2
12
  <span class='title'>
3
13
  <b><%= t('.created_at')%> :</b>
@@ -17,4 +27,6 @@
17
27
 
18
28
  <%= link_to t('.download_resume', name: job_application.name), job_application.resume.url %><span class="preview">&nbsp;</span><br>
19
29
  </span>
20
- </li>
30
+
31
+ <%= action_icon(:delete, delete_url, t('delete', scope: 'refinery.admin.pages' ), delete_options ) %>
32
+ </li>
@@ -1,39 +1,49 @@
1
+ <% # setup params for various action links
2
+ open_url = refinery.jobs_admin_job_job_applications_path(job)
3
+ preview_url = refinery.jobs_job_url(job)
4
+ edit_url = refinery.edit_jobs_admin_job_path(job)
5
+ delete_url = refinery.jobs_admin_job_path(job)
6
+ delete_options = {
7
+ class: "cancel confirm-delete",
8
+ data: {confirm: t('message', scope: 'refinery.admin.delete', title: job.title)}
9
+ }
10
+ %>
11
+
1
12
  <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(job) -%>">
2
13
  <span class='title'>
3
14
  <%= job.title.presence || job.translations.detect {|t| t.title.present?}.title %>
4
15
  <span class="preview">
5
- <% job.translations.each do |translation| %>
6
- <% if translation.title.present? %>
7
- <%= link_to refinery_icon_tag("flags/#{translation.locale}.png", :size => '16x11'),
8
- refinery.edit_jobs_admin_job_path(job, :switch_locale => translation.locale),
9
- :class => 'locale' %>
10
- <% end %>
11
- <% end %>
12
-
13
16
  <% if job.draft? %>
14
17
  <span class="label notice"><%= t('refinery.jobs.admin.jobs.job.draft') %></span>
15
18
  <% else %>
16
19
  <%= job.published_at.strftime('%b %d, %Y') %>
17
20
  <% end %>
21
+
22
+ <% if Refinery::I18n.frontend_locales.many? %>
23
+ <span class='locales'>
24
+ <% job.translations.sort_by{ |t| Refinery::I18n.frontend_locales.index(t.locale)}.each do |translation| %>
25
+ <% if translation.title.present? %>
26
+ <%= link_to refinery.edit_jobs_admin_job_path(job, :switch_locale => translation.locale), :class => 'locale', title: translation.locale.upcase do %>
27
+
28
+ <div class="<%=translation.locale %> locale_marker">
29
+ <%= locale_text_icon(translation.locale.upcase) %>
30
+ </div>
31
+ <% end %>
32
+ <% end %>
33
+ <% end %>
34
+ </span>
35
+ <% end %>
36
+
37
+ <%= t('.job_applications_count', count: job.job_applications.count ) %>
18
38
  </span>
19
39
  </span>
20
40
 
21
41
  <span class='actions'>
22
- <% if !job.job_applications.blank? %>
23
- <%= link_to refinery_icon_tag("folder_open.png"), refinery.job_applications_jobs_admin_job_path(job),
24
- :title => t('.view_applications_for_this_job') %>
42
+ <% if job.job_applications.any? %>
43
+ <%= action_icon(:folder, open_url, t('.view_applications_for_this_job')) %>
25
44
  <% end %>
26
- <%= link_to refinery_icon_tag("application_go.png"), refinery.jobs_job_url(job),
27
- :title => t('.view_live_html'),
28
- :target => "_blank" %>
29
- <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_jobs_admin_job_path(job),
30
- :title => t('.edit') %>
31
- <%= link_to refinery_icon_tag("delete.png"), refinery.jobs_admin_job_path(job),
32
- :class => "cancel confirm-delete",
33
- :title => t('.delete'),
34
- :method => :delete,
35
- :data => {
36
- :confirm => t('message', :scope => 'refinery.admin.delete', :title => job.title)
37
- } %>
45
+ <%= action_icon(:preview, preview_url, t('.view_live_html')) %>
46
+ <%= action_icon(:edit, edit_url, t('.edit' ) ) %>
47
+ <%= action_icon(:delete, delete_url, t('.delete' ), delete_options ) %>
38
48
  </span>
39
49
  </li>
@@ -1,33 +1,45 @@
1
- <%= form_for [refinery, :jobs, @job, @job_application], :html => { :multipart => true } do |f| %>
1
+ <%= form_for [refinery, :jobs, @job, @job_application], html: { multipart: true } do |f| %>
2
2
 
3
- <%= render '/refinery/admin/error_messages', {:object => @job_application, :include_object_name => true} %>
3
+ <h2><%= t('.job_application_for_position', job_title: @job.title) %></h2>
4
4
 
5
- <h2><%= t('.job_application_for_position') %></h2>
5
+ <%= render '/refinery/admin/error_messages', {object: @job_application, include_object_name: true} %>
6
6
 
7
7
  <div class='field'>
8
- <%= f.label :name %>
9
- <%= f.text_field :name %>
8
+ <%= f.label :name, class: 'required' %>
9
+ <%= f.text_field :name, class: 'text', required: 'required' %>
10
10
  </div>
11
11
 
12
12
  <div class='field'>
13
- <%= f.label :email %>
14
- <%= f.text_field :email %>
13
+ <%= f.label :email, class: 'required' %>
14
+ <%= f.email_field :email, class: 'text', required: 'required' %>
15
15
  </div>
16
16
 
17
17
  <div class='field'>
18
- <%= f.label :phone %>
19
- <%= f.text_field :phone %>
18
+ <%= f.label :phone, class: 'required' %>
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>
27
+ <% end %>
28
+
22
29
  <div class='field'>
23
- <%= f.label :cover_letter %>
24
- <%= f.text_area :cover_letter %>
30
+ <%= f.label :cover_letter, class: 'required' %>
31
+ <%= f.text_area :cover_letter, class: 'text', required: 'required' %>
25
32
  </div>
26
33
 
27
- <div class='field'>
28
- <%= f.label :resume %>
29
- <%= f.file_field :resume %>
34
+ <div class='field message_field'>
35
+ <%= f.label :resume, class: 'required' %>
36
+ <%= f.file_field :resume, class: 'text', required: 'required' %>
30
37
  </div>
31
38
 
32
- <%= f.submit t('.apply') %>
33
- <% end %>
39
+ <div class="actions">
40
+ <p class="instruction">
41
+ <%= t('.mandatory_fields').html_safe %>
42
+ </p>
43
+ <%= f.submit t('.apply') %>
44
+ </div>
45
+ <% end %>
data/bin/rails ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_PATH = File.expand_path('../..', __FILE__)
5
+ load File.expand_path('../../spec/dummy/bin/rails', __FILE__)