refinerycms-applicants 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/app/controllers/applicants_controller.rb +3 -1
- data/app/mailers/applicant_mailer.rb +13 -0
- data/app/models/applicant.rb +2 -1
- data/app/views/admin/applicants/_form.html.erb +6 -1
- data/app/views/applicant_mailer/notification.text.erb +10 -0
- data/app/views/applicants/new.html.erb +7 -2
- data/config/locales/en.yml +2 -1
- data/lib/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4895aa64c2713fd958450d577d414460d9b97837
|
4
|
+
data.tar.gz: 44d44f48f4e8c97e14044985b630272245f0783c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e56bd1a95b98c18256339a7c718db728b884fbfd5be9396a05e9837c3a7290af9b481b7ce0b18d62118a92e60ae730f503429ca7e23c2f483ab6c4eecc1a897d
|
7
|
+
data.tar.gz: bcc84deed6b028a7447d6c687d9f2b1d75776969ff9d85aabfdb35a947661de9f0db51593bd9490dc29ab77c632ca20375e9728fa2dcc4e238c8d794fd46a1c5
|
data/README.md
CHANGED
@@ -31,3 +31,7 @@ Then run the following commands to install the Gem and migrate your database:
|
|
31
31
|
rails generate refinerycms_applicants
|
32
32
|
rake db:migrate
|
33
33
|
|
34
|
+
If you wish to enable email notifications, log into the Refinery admin and edit
|
35
|
+
the applicant_recipients setting:
|
36
|
+
|
37
|
+
['myemail@example.com']
|
@@ -13,8 +13,10 @@ class ApplicantsController < ApplicationController
|
|
13
13
|
|
14
14
|
def create
|
15
15
|
@applicant = Applicant.new(params[:applicant])
|
16
|
-
|
17
16
|
if @applicant.save
|
17
|
+
if RefinerySetting.find_or_set(:applicant_recipients, []).present?
|
18
|
+
ApplicantMailer.notification(@applicant, request).deliver
|
19
|
+
end
|
18
20
|
redirect_to thank_you_applicants_url
|
19
21
|
else
|
20
22
|
render :action => 'new'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class ApplicantMailer < ActionMailer::Base
|
2
|
+
def notification(applicant_id, request)
|
3
|
+
@applicant = Applicant.find(applicant_id)
|
4
|
+
@host = request.host
|
5
|
+
|
6
|
+
mail(
|
7
|
+
:subject => "[#{RefinerySetting[:site_name]}] New Applicant: #{@applicant.name}",
|
8
|
+
:to => RefinerySetting[:applicant_recipients],
|
9
|
+
:from => "\"#{RefinerySetting[:site_name]}\" <no-reply@#{@host}>",
|
10
|
+
:reply_to => @applicant.email,
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
data/app/models/applicant.rb
CHANGED
@@ -4,10 +4,11 @@ class Applicant < ActiveRecord::Base
|
|
4
4
|
has_many :questions, :through => :answers
|
5
5
|
|
6
6
|
acts_as_indexed :fields => [:name]
|
7
|
-
attr_accessible :name, :position, :answers_attributes
|
7
|
+
attr_accessible :name, :email, :position, :answers_attributes
|
8
8
|
accepts_nested_attributes_for :answers
|
9
9
|
|
10
10
|
validates :name, :presence => true, :uniqueness => true
|
11
|
+
validates :email, :presence => true
|
11
12
|
|
12
13
|
def build_answers
|
13
14
|
Question.current.all.each do |q|
|
@@ -11,6 +11,11 @@
|
|
11
11
|
<%= f.text_field :name, :class => 'larger widest' -%>
|
12
12
|
</div>
|
13
13
|
|
14
|
+
<div class='field'>
|
15
|
+
<%= f.label :email -%>
|
16
|
+
<%= f.text_field :email, :class => 'larger widest' -%>
|
17
|
+
</div>
|
18
|
+
|
14
19
|
<div class='field'>
|
15
20
|
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
|
16
21
|
<ul id='page_parts'>
|
@@ -23,7 +28,7 @@
|
|
23
28
|
|
24
29
|
<div id='page_part_editors'>
|
25
30
|
<% @applicant.answers.each do |answer| %>
|
26
|
-
|
31
|
+
<%= f.fields_for(:answers, answer) do |fa| %>
|
27
32
|
<div class='page_part' id='<%= answer.question.name.parameterize %>'>
|
28
33
|
<%= fa.text_area :body, :rows => 20, :class => 'wymeditor widest', :maxlength => answer.character_limit -%>
|
29
34
|
<%= fa.hidden_field :applicant_question_id, :value => answer.question.id %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% content_for :body_content_left do %>
|
2
2
|
<div class='applicants'>
|
3
|
-
<%=raw @page
|
3
|
+
<%=raw @page.content_for(Page.default_parts.first.to_sym) %>
|
4
4
|
|
5
5
|
<%= form_for @applicant do |f| %>
|
6
6
|
<%= render :partial => "/shared/admin/error_messages",
|
@@ -13,10 +13,15 @@
|
|
13
13
|
<%= f.text_field :name, :maxlength => 255 %>
|
14
14
|
</div>
|
15
15
|
|
16
|
+
<div class='field'>
|
17
|
+
<%= f.required_label :email %>
|
18
|
+
<%= f.text_field :email, :maxlength => 255 %>
|
19
|
+
</div>
|
20
|
+
|
16
21
|
<div style="clear:both;"></div>
|
17
22
|
|
18
23
|
<% @applicant.answers.each do |answer| %>
|
19
|
-
|
24
|
+
<%= f.fields_for(:answers, answer) do |fa| %>
|
20
25
|
<div class='field message_field'>
|
21
26
|
<% if answer.answer_required? %>
|
22
27
|
<%= fa.required_label :body, answer.question.name %>
|
data/config/locales/en.yml
CHANGED
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-applicants
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Plante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: refinerycms
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- app/controllers/admin/questions_controller.rb
|
44
44
|
- app/controllers/applicants_controller.rb
|
45
45
|
- app/helpers/applicants_helper.rb
|
46
|
+
- app/mailers/applicant_mailer.rb
|
46
47
|
- app/models/answer.rb
|
47
48
|
- app/models/applicant.rb
|
48
49
|
- app/models/question.rb
|
@@ -60,6 +61,7 @@ files:
|
|
60
61
|
- app/views/admin/questions/edit.html.erb
|
61
62
|
- app/views/admin/questions/index.html.erb
|
62
63
|
- app/views/admin/questions/new.html.erb
|
64
|
+
- app/views/applicant_mailer/notification.text.erb
|
63
65
|
- app/views/applicants/new.html.erb
|
64
66
|
- app/views/applicants/thank_you.html.erb
|
65
67
|
- README.md
|
@@ -84,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
86
|
version: '0'
|
85
87
|
requirements: []
|
86
88
|
rubyforge_project:
|
87
|
-
rubygems_version: 2.0.
|
89
|
+
rubygems_version: 2.0.2
|
88
90
|
signing_key:
|
89
91
|
specification_version: 4
|
90
92
|
summary: Applicants engine for Refinery CMS
|