refinerycms-applicants 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7cac2501636cd48fb45c34f17dfd022869a47cf
4
- data.tar.gz: ec5dd73f6c3f9d32d1ee54a690b2fa854b6a5a4e
3
+ metadata.gz: 4895aa64c2713fd958450d577d414460d9b97837
4
+ data.tar.gz: 44d44f48f4e8c97e14044985b630272245f0783c
5
5
  SHA512:
6
- metadata.gz: 225226618ecb20bf1f85be2621c728e63ee74ced427b24ef864554c5f0ff2feab15f965b7509f530b4c105749953f46e4e2ed765582835e23b1c26544ab0d2a2
7
- data.tar.gz: 9ee6de27a70adb7d348f9bf5c439bcc1dbeaa2adf6a5e1d706a4ce838634cae8a3e3f6faafb3066c36901556b95bacbfccf1d320ced387ce6692feddae21c863
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
@@ -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
- <% f.fields_for(:answers, answer) do |fa| %>
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 %>
@@ -0,0 +1,10 @@
1
+ A new application has been received for <%= @host %>.
2
+
3
+ Name: <%= @applicant.name %>
4
+ Email: <%= @applicant.email %>
5
+
6
+ <% @applicant.answers.each do |answer| -%>
7
+ Q: <%= answer.question.name %>
8
+ A: <%= answer.body %>
9
+
10
+ <% end -%>
@@ -1,6 +1,6 @@
1
1
  <% content_for :body_content_left do %>
2
2
  <div class='applicants'>
3
- <%=raw @page[Page.default_parts.first.to_sym] %>
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
- <% f.fields_for(:answers, answer) do |fa| %>
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 %>
@@ -34,5 +34,6 @@ en:
34
34
  other: Other Applicants
35
35
  activerecord:
36
36
  attributes:
37
- name: "Your group or company name"
37
+ name: Your group or company name
38
+ email: Contact email address
38
39
 
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Refinery
2
2
  module Applicants
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
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.1.0
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-12 00:00:00.000000000 Z
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.3
89
+ rubygems_version: 2.0.2
88
90
  signing_key:
89
91
  specification_version: 4
90
92
  summary: Applicants engine for Refinery CMS