refinerycms-applicants 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +33 -0
- data/app/controllers/admin/applicants_controller.rb +20 -0
- data/app/controllers/admin/questions_controller.rb +15 -0
- data/app/controllers/applicants_controller.rb +30 -0
- data/app/helpers/applicants_helper.rb +15 -0
- data/app/models/answer.rb +24 -0
- data/app/models/applicant.rb +22 -0
- data/app/models/question.rb +29 -0
- data/app/views/admin/applicants/_applicant.html.erb +15 -0
- data/app/views/admin/applicants/_applicants.html.erb +2 -0
- data/app/views/admin/applicants/_form.html.erb +78 -0
- data/app/views/admin/applicants/_sortable_list.html.erb +7 -0
- data/app/views/admin/applicants/edit.html.erb +1 -0
- data/app/views/admin/applicants/index.html.erb +60 -0
- data/app/views/admin/applicants/new.html.erb +1 -0
- data/app/views/admin/questions/_form.html.erb +55 -0
- data/app/views/admin/questions/_question.html.erb +15 -0
- data/app/views/admin/questions/_questions.html.erb +2 -0
- data/app/views/admin/questions/_sortable_list.html.erb +7 -0
- data/app/views/admin/questions/edit.html.erb +1 -0
- data/app/views/admin/questions/index.html.erb +60 -0
- data/app/views/admin/questions/new.html.erb +1 -0
- data/app/views/applicants/index.html.erb +11 -0
- data/app/views/applicants/new.html.erb +74 -0
- data/app/views/applicants/show.html.erb +53 -0
- data/app/views/applicants/thank_you.html.erb +1 -0
- data/config/locales/en.yml +34 -0
- data/config/routes.rb +22 -0
- data/lib/generators/refinerycms_applicants_generator.rb +6 -0
- data/lib/refinerycms-applicants.rb +22 -0
- data/lib/tasks/applicants.rake +13 -0
- data/lib/version.rb +5 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 823e1cee1bb696cd2021a8cc8bd3a6e72702255f
|
4
|
+
data.tar.gz: 3bc73fd3a86a75f71569e5f26f44162fad47d7a2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2ac9e15af155042f0c1ce466d39fd0031f033347ca07084836d2796269d5c5eb8dcc710ecab44edd9b919a699b006f48452d54519c6d10364fc936360d6dd893
|
7
|
+
data.tar.gz: 8a67c8a04221311dc0844a9e620426f68493c94351c34b383f2c4c6ee0f1e73b0021e3ce8aaf7f303011bbf23fa75c2c43d35cceb725af3d15464ce92d3d57ef
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Nick Plante
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Applicants engine for Refinery CMS
|
2
|
+
|
3
|
+
## About
|
4
|
+
|
5
|
+
Adds a lightweight applicant management engine to your Refinery-based site.
|
6
|
+
Visitors can apply to be part of your program, exhibit at your event, etc by
|
7
|
+
filling out a form. You can add and edit questions for the form and manage
|
8
|
+
visitor submissions via the Refinery admin interface.
|
9
|
+
|
10
|
+
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
[Refinery CMS](http://refinerycms.com) version 1.0.x. This plugin does _not_
|
14
|
+
work with Refinery 2.x. Sorry. It's extracted from a couple older Refinery sites
|
15
|
+
that are still being maintained. Pull requests welcome if someone wants to
|
16
|
+
modernize it :).
|
17
|
+
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Include the latest [gem](http://rubygems.org/gems/refinerycms-applicants) into your
|
22
|
+
Refinery CMS application's Gemfile:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
gem "refinerycms-applicants", '~> 2.0.0'
|
26
|
+
```
|
27
|
+
|
28
|
+
Then run the following commands to install the Gem and migrate your database:
|
29
|
+
|
30
|
+
bundle install
|
31
|
+
rails generate refinery_applicants
|
32
|
+
rake db:migrate
|
33
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Admin
|
2
|
+
class ApplicantsController < Admin::BaseController
|
3
|
+
|
4
|
+
crudify :applicant,
|
5
|
+
:title_attribute => 'name'
|
6
|
+
|
7
|
+
def index
|
8
|
+
search_all_applicants if searching?
|
9
|
+
paginate_all_applicants
|
10
|
+
|
11
|
+
render :partial => 'applicants' if request.xhr?
|
12
|
+
end
|
13
|
+
|
14
|
+
def new
|
15
|
+
@applicant = Applicant.new
|
16
|
+
@applicant.build_answers if @applicant.answers.empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Admin
|
2
|
+
class QuestionsController < Admin::BaseController
|
3
|
+
|
4
|
+
crudify :question,
|
5
|
+
:title_attribute => 'name'
|
6
|
+
|
7
|
+
def index
|
8
|
+
search_all_questions if searching?
|
9
|
+
paginate_all_questions
|
10
|
+
|
11
|
+
render :partial => 'questions' if request.xhr?
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class ApplicantsController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :find_page
|
4
|
+
|
5
|
+
def thank_you
|
6
|
+
@page = Page.find_by_link_url('/apply/thank-you', :include => [:parts, :slugs])
|
7
|
+
end
|
8
|
+
|
9
|
+
def new
|
10
|
+
@applicant = Applicant.new
|
11
|
+
@applicant.build_answers
|
12
|
+
end
|
13
|
+
|
14
|
+
def create
|
15
|
+
@applicant = Applicant.new(params[:applicant])
|
16
|
+
|
17
|
+
if @applicant.save
|
18
|
+
redirect_to thank_you_applicants_url
|
19
|
+
else
|
20
|
+
render :action => 'new'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def find_page
|
27
|
+
@page = Page.find_by_link_url("/apply")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Answer < ActiveRecord::Base
|
2
|
+
self.table_name = 'applicant_answers'
|
3
|
+
|
4
|
+
acts_as_indexed :fields => [:body]
|
5
|
+
attr_accessible :body, :applicant_id, :applicant_question_id, :question
|
6
|
+
|
7
|
+
belongs_to :applicant
|
8
|
+
belongs_to :question, :foreign_key => :applicant_question_id
|
9
|
+
|
10
|
+
delegate :answer_type, :character_limit, :character_limit?, :answer_required?, :to => :question, :allow_nil => true
|
11
|
+
|
12
|
+
# validates :applicant, :presence => true
|
13
|
+
# validates :question, :presence => true
|
14
|
+
validates :body, :presence => true, :if => :answer_required?
|
15
|
+
validate :validate_body_length
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def validate_body_length
|
20
|
+
if character_limit? && body.length > character_limit
|
21
|
+
self.errors.add(:body, "must be less than #{character_limit} characters")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Applicant < ActiveRecord::Base
|
2
|
+
|
3
|
+
has_many :answers
|
4
|
+
has_many :questions, :through => :answers
|
5
|
+
|
6
|
+
acts_as_indexed :fields => [:name, :contact_name, :contact_email, :contact_phone]
|
7
|
+
attr_accessible :name, :contact_name, :contact_email, :contact_phone, :position, :answers_attributes
|
8
|
+
accepts_nested_attributes_for :answers
|
9
|
+
|
10
|
+
validates :name, :presence => true, :uniqueness => true
|
11
|
+
validates :contact_name, :presence => true
|
12
|
+
validates :contact_email, :presence => true
|
13
|
+
validates :contact_phone, :presence => true
|
14
|
+
|
15
|
+
def build_answers
|
16
|
+
Question.all.each do |q|
|
17
|
+
answers.build(:question => q)
|
18
|
+
end
|
19
|
+
|
20
|
+
answers
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Question < ActiveRecord::Base
|
2
|
+
ANSWER_TYPES = ['string', 'text']
|
3
|
+
|
4
|
+
self.table_name = 'applicant_questions'
|
5
|
+
|
6
|
+
acts_as_indexed :fields => [:name]
|
7
|
+
attr_accessible :name, :character_limit, :answer_type, :answer_required, :position
|
8
|
+
|
9
|
+
has_many :answers, :foreign_key => :applicant_question_id
|
10
|
+
has_many :applicants, :through => :answers
|
11
|
+
|
12
|
+
validates :name, :presence => true, :uniqueness => true
|
13
|
+
validates :answer_type, :presence => true, :inclusion => ANSWER_TYPES
|
14
|
+
|
15
|
+
before_create :set_defaults
|
16
|
+
|
17
|
+
def character_limit?
|
18
|
+
character_limit && character_limit > 0
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def set_defaults
|
24
|
+
self.answer_type = 'text' if self.answer_type.blank?
|
25
|
+
self.answer_required = false if self.answer_required.blank?
|
26
|
+
self.character_limit = 0 if self.character_limit.blank?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(applicant) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= applicant.name %>
|
4
|
+
<span class="preview"> </span>
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
<%= link_to refinery_icon_tag("application_edit.png"), edit_admin_applicant_path(applicant),
|
8
|
+
:title => t('edit', :scope => 'admin.applicants.applicant') %>
|
9
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_applicant_path(applicant),
|
10
|
+
:class => "cancel confirm-delete",
|
11
|
+
:title => t('delete', :scope => 'admin.applicants.applicant'),
|
12
|
+
:confirm => t('message', :scope => 'shared.admin.delete', :title => applicant.name),
|
13
|
+
:method => :delete %>
|
14
|
+
</span>
|
15
|
+
</li>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<h2><%= t('admin.applicants.index.title') %></h2>
|
2
|
+
|
3
|
+
<%= form_for [:admin, @applicant] do |f| -%>
|
4
|
+
<%= render :partial => "/shared/admin/error_messages", :locals => {
|
5
|
+
:object => @applicant,
|
6
|
+
:include_object_name => true
|
7
|
+
} %>
|
8
|
+
|
9
|
+
<div class='field'>
|
10
|
+
<%= f.label :name -%>
|
11
|
+
<%= f.text_field :name, :class => 'larger widest' -%>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<table width="100%" border="0">
|
15
|
+
<tr>
|
16
|
+
<td>
|
17
|
+
<div class='field'>
|
18
|
+
<%= f.label :contact_name -%>
|
19
|
+
<%= f.text_field :contact_name -%>
|
20
|
+
</div>
|
21
|
+
</td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td>
|
25
|
+
<div class='field'>
|
26
|
+
<%= f.label :contact_email -%>
|
27
|
+
<%= f.text_field :contact_email -%>
|
28
|
+
</div>
|
29
|
+
</td>
|
30
|
+
</tr>
|
31
|
+
<tr>
|
32
|
+
<td>
|
33
|
+
<div class='field'>
|
34
|
+
<%= f.label :contact_phone -%>
|
35
|
+
<%= f.text_field :contact_phone -%>
|
36
|
+
</div>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
<div class='field'>
|
42
|
+
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
|
43
|
+
<ul id='page_parts'>
|
44
|
+
<% @applicant.answers.each_with_index do |answer, part_index| %>
|
45
|
+
<li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
|
46
|
+
<%= link_to answer.question.name, "##{answer.question.name.parameterize}" %>
|
47
|
+
</li>
|
48
|
+
<% end %>
|
49
|
+
</ul>
|
50
|
+
|
51
|
+
<div id='page_part_editors'>
|
52
|
+
<% @applicant.answers.each do |answer| %>
|
53
|
+
<% f.fields_for(:answers, answer) do |fa| %>
|
54
|
+
<div class='page_part' id='<%= answer.question.name.parameterize %>'>
|
55
|
+
<%= fa.text_area :body, :rows => 20, :class => 'wymeditor widest', :maxlength => answer.character_limit -%>
|
56
|
+
<%= fa.hidden_field :applicant_question_id, :value => answer.question.id %>
|
57
|
+
</div>
|
58
|
+
<% end %>
|
59
|
+
<% end %>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<%= render :partial => "/shared/admin/form_actions",
|
65
|
+
:locals => {
|
66
|
+
:f => f,
|
67
|
+
:continue_editing => false,
|
68
|
+
:delete_title => t('delete', :scope => 'admin.applicants.applicant'),
|
69
|
+
:delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @applicant.name)
|
70
|
+
} %>
|
71
|
+
<% end -%>
|
72
|
+
<% content_for :javascripts do %>
|
73
|
+
<script>
|
74
|
+
$(document).ready(function(){
|
75
|
+
page_options.init(false, '', '');
|
76
|
+
});
|
77
|
+
</script>
|
78
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<ul id='sortable_list'>
|
2
|
+
<%= render :partial => 'applicant', :collection => @applicants %>
|
3
|
+
</ul>
|
4
|
+
<%= render :partial => "/shared/admin/sortable_list",
|
5
|
+
:locals => {
|
6
|
+
:continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true
|
7
|
+
} %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<div id='records'>
|
2
|
+
<h2>
|
3
|
+
<%= t('admin.applicants.index.title') %>
|
4
|
+
<% if searching? %>
|
5
|
+
— <%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %>
|
6
|
+
<% end %>
|
7
|
+
</h2>
|
8
|
+
<% if @applicants.any? %>
|
9
|
+
<div class='pagination_container'>
|
10
|
+
<%= render :partial => 'applicants' %>
|
11
|
+
</div>
|
12
|
+
<% else %>
|
13
|
+
<p>
|
14
|
+
<% unless searching? %>
|
15
|
+
<strong>
|
16
|
+
<%= t('.no_items_yet') %>
|
17
|
+
</strong>
|
18
|
+
<% else %>
|
19
|
+
<%= t('no_results', :scope => 'shared.admin.search') %>
|
20
|
+
<% end %>
|
21
|
+
</p>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
<div id='actions'>
|
25
|
+
<ul>
|
26
|
+
<% if Admin::ApplicantsController.searchable? %>
|
27
|
+
<li>
|
28
|
+
<%= render :partial => "/shared/admin/search",
|
29
|
+
:locals => {
|
30
|
+
:url => admin_applicants_url
|
31
|
+
} %>
|
32
|
+
</li>
|
33
|
+
<% end %>
|
34
|
+
<li>
|
35
|
+
<%= link_to t('.create_new'), new_admin_applicant_url,
|
36
|
+
:class => "add_icon" %>
|
37
|
+
</li>
|
38
|
+
<% if !searching? and Admin::ApplicantsController.sortable? and Applicant.count > 1 %>
|
39
|
+
<li>
|
40
|
+
<%= link_to t('.reorder', :what => "Applicants"),
|
41
|
+
admin_applicants_url,
|
42
|
+
:id => "reorder_action",
|
43
|
+
:class => "reorder_icon" %>
|
44
|
+
|
45
|
+
<%= link_to t('.reorder_done', :what => "Applicants"),
|
46
|
+
admin_applicants_url,
|
47
|
+
:id => "reorder_action_done",
|
48
|
+
:style => "display: none;",
|
49
|
+
:class => "reorder_icon" %>
|
50
|
+
</li>
|
51
|
+
<% end %>
|
52
|
+
<li>
|
53
|
+
<%= link_to t('admin.questions.index.title'), admin_questions_url, :class => "edit_icon" %>
|
54
|
+
</li>
|
55
|
+
</ul>
|
56
|
+
</div>
|
57
|
+
<%= render :partial => "/shared/admin/make_sortable",
|
58
|
+
:locals => {
|
59
|
+
:tree => false
|
60
|
+
} if !searching? and Admin::ApplicantsController.sortable? and Applicant.count > 1 %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<h2><%= t('admin.questions.index.title') %></h2>
|
2
|
+
|
3
|
+
<%= form_for [:admin, @question] do |f| -%>
|
4
|
+
<%= render :partial => "/shared/admin/error_messages", :locals => {
|
5
|
+
:object => @question,
|
6
|
+
:include_object_name => true
|
7
|
+
} %>
|
8
|
+
|
9
|
+
<div class='field'>
|
10
|
+
<%= f.label :name -%>
|
11
|
+
<%= f.text_field :name, :class => 'larger widest' -%>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<table width="100%" border="0">
|
15
|
+
<tr>
|
16
|
+
<td>
|
17
|
+
<div class='field'>
|
18
|
+
<%= f.label :answer_required -%>
|
19
|
+
<%= f.check_box :answer_required -%>
|
20
|
+
</div>
|
21
|
+
</td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td>
|
25
|
+
<div class='field'>
|
26
|
+
<%= f.label :answer_type -%>
|
27
|
+
<%= f.select :answer_type, Question::ANSWER_TYPES -%>
|
28
|
+
</div>
|
29
|
+
</td>
|
30
|
+
</tr>
|
31
|
+
<tr>
|
32
|
+
<td>
|
33
|
+
<div class='field'>
|
34
|
+
<%= f.label :character_limit -%>
|
35
|
+
<%= f.text_field :character_limit -%>
|
36
|
+
</div>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
<%= render :partial => "/shared/admin/form_actions",
|
42
|
+
:locals => {
|
43
|
+
:f => f,
|
44
|
+
:continue_editing => false,
|
45
|
+
:delete_title => t('delete', :scope => 'admin.questions.question'),
|
46
|
+
:delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @question.name)
|
47
|
+
} %>
|
48
|
+
<% end -%>
|
49
|
+
<% content_for :javascripts do %>
|
50
|
+
<script>
|
51
|
+
$(document).ready(function(){
|
52
|
+
page_options.init(false, '', '');
|
53
|
+
});
|
54
|
+
</script>
|
55
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(question) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= question.name %>
|
4
|
+
<span class="preview"> </span>
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
<%= link_to refinery_icon_tag("application_edit.png"), edit_admin_question_path(question),
|
8
|
+
:title => t('edit', :scope => 'admin.questions.question') %>
|
9
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_question_path(question),
|
10
|
+
:class => "cancel confirm-delete",
|
11
|
+
:title => t('delete', :scope => 'admin.questions.question'),
|
12
|
+
:confirm => t('message', :scope => 'shared.admin.delete', :title => question.name),
|
13
|
+
:method => :delete %>
|
14
|
+
</span>
|
15
|
+
</li>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<ul id='sortable_list'>
|
2
|
+
<%= render :partial => 'question', :collection => @questions %>
|
3
|
+
</ul>
|
4
|
+
<%= render :partial => "/shared/admin/sortable_list",
|
5
|
+
:locals => {
|
6
|
+
:continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true
|
7
|
+
} %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<div id='records'>
|
2
|
+
<h2>
|
3
|
+
<%= t('admin.questions.index.title') %>
|
4
|
+
<% if searching? %>
|
5
|
+
— <%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %>
|
6
|
+
<% end %>
|
7
|
+
</h2>
|
8
|
+
<% if @questions.any? %>
|
9
|
+
<div class='pagination_container'>
|
10
|
+
<%= render :partial => 'questions' %>
|
11
|
+
</div>
|
12
|
+
<% else %>
|
13
|
+
<p>
|
14
|
+
<% unless searching? %>
|
15
|
+
<strong>
|
16
|
+
<%= t('.no_items_yet') %>
|
17
|
+
</strong>
|
18
|
+
<% else %>
|
19
|
+
<%= t('no_results', :scope => 'shared.admin.search') %>
|
20
|
+
<% end %>
|
21
|
+
</p>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
<div id='actions'>
|
25
|
+
<ul>
|
26
|
+
<% if Admin::QuestionsController.searchable? %>
|
27
|
+
<li>
|
28
|
+
<%= render :partial => "/shared/admin/search",
|
29
|
+
:locals => {
|
30
|
+
:url => admin_questions_url
|
31
|
+
} %>
|
32
|
+
</li>
|
33
|
+
<% end %>
|
34
|
+
<li>
|
35
|
+
<%= link_to t('.create_new'), new_admin_question_url,
|
36
|
+
:class => "add_icon" %>
|
37
|
+
</li>
|
38
|
+
<% if !searching? and Admin::QuestionsController.sortable? and Question.count > 1 %>
|
39
|
+
<li>
|
40
|
+
<%= link_to t('.reorder', :what => "Questions"),
|
41
|
+
admin_questions_url,
|
42
|
+
:id => "reorder_action",
|
43
|
+
:class => "reorder_icon" %>
|
44
|
+
|
45
|
+
<%= link_to t('.reorder_done', :what => "Questions"),
|
46
|
+
admin_questions_url,
|
47
|
+
:id => "reorder_action_done",
|
48
|
+
:style => "display: none;",
|
49
|
+
:class => "reorder_icon" %>
|
50
|
+
</li>
|
51
|
+
<% end %>
|
52
|
+
<li>
|
53
|
+
<%= link_to t('admin.applicants.index.title'), admin_applicants_url, :class => "edit_icon" %>
|
54
|
+
</li>
|
55
|
+
</ul>
|
56
|
+
</div>
|
57
|
+
<%= render :partial => "/shared/admin/make_sortable",
|
58
|
+
:locals => {
|
59
|
+
:tree => false
|
60
|
+
} if !searching? and Admin::QuestionsController.sortable? and Question.count > 1 %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% content_for :body_content_left do %>
|
2
|
+
<ul id="applicants">
|
3
|
+
<% @applicants.each do |applicant| %>
|
4
|
+
<li>
|
5
|
+
<%= link_to applicant.name, applicant_url(applicant) %>
|
6
|
+
</li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<% content_for :body_content_left do %>
|
2
|
+
<div class='applicants'>
|
3
|
+
<%=raw @page[Page.default_parts.first.to_sym] %>
|
4
|
+
|
5
|
+
<%= form_for @applicant do |f| %>
|
6
|
+
<%= render :partial => "/shared/admin/error_messages",
|
7
|
+
:locals => {
|
8
|
+
:object => @applicant,
|
9
|
+
:include_object_name => true
|
10
|
+
} %>
|
11
|
+
<div class='field'>
|
12
|
+
<%= f.required_label :name %>
|
13
|
+
<%= f.text_field :name, :maxlength => 255 %>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<fieldset>
|
17
|
+
<div class='field'>
|
18
|
+
<%= f.required_label :contact_name %>
|
19
|
+
<%= f.text_field :contact_name, :maxlength => 255 %>
|
20
|
+
</div>
|
21
|
+
<div class='field'>
|
22
|
+
<%= f.required_label :contact_email %>
|
23
|
+
<%= f.text_field :contact_email, :maxlength => 255 %>
|
24
|
+
</div>
|
25
|
+
<div class='field'>
|
26
|
+
<%= f.required_label :contact_phone %>
|
27
|
+
<%= f.text_field :contact_phone, :maxlength => 255 %>
|
28
|
+
</div>
|
29
|
+
</fieldset>
|
30
|
+
|
31
|
+
<div style="clear:both;"></div>
|
32
|
+
|
33
|
+
<% @applicant.answers.each do |answer| %>
|
34
|
+
<% f.fields_for(:answers, answer) do |fa| %>
|
35
|
+
<div class='field message_field'>
|
36
|
+
<% if answer.answer_required? %>
|
37
|
+
<%= fa.required_label :body, answer.question.name %>
|
38
|
+
<% else %>
|
39
|
+
<%= fa.label :body, answer.question.name %>
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
<% if answer.character_limit? %>
|
43
|
+
<div class="hint"><span class="chars"><%= answer.character_limit %></span> characters remaining</div>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
<% if answer.answer_type == 'text' %>
|
47
|
+
<%= fa.text_area :body, answer_input_options(answer) %>
|
48
|
+
<% else %>
|
49
|
+
<%= fa.text_field :body, answer_input_options(answer) %>
|
50
|
+
<% end %>
|
51
|
+
|
52
|
+
<%= fa.hidden_field :applicant_question_id, :value => answer.question.id %>
|
53
|
+
</div>
|
54
|
+
<% end %>
|
55
|
+
<% end %>
|
56
|
+
|
57
|
+
<div class='actions'>
|
58
|
+
<%= f.submit t('send'), :class => 'btn btn-primary' %>
|
59
|
+
</div>
|
60
|
+
<% end %>
|
61
|
+
</div>
|
62
|
+
<% end %>
|
63
|
+
|
64
|
+
<%= render :partial => "/shared/content_page" %>
|
65
|
+
|
66
|
+
<script>
|
67
|
+
$('document').ready(function() {
|
68
|
+
$('.field.message_field').keyup(function() {
|
69
|
+
var max = $(':input', this).attr('maxlength');
|
70
|
+
var remaining = parseInt(max) - $(':input', this).val().length;
|
71
|
+
$(this).find('.hint .chars').text(remaining);
|
72
|
+
});
|
73
|
+
});
|
74
|
+
</script>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<% content_for :body_content_title do %>
|
2
|
+
<%= @applicant.name %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :body_content_left do %>
|
6
|
+
<section>
|
7
|
+
<h1>Name</h1>
|
8
|
+
<p>
|
9
|
+
<%=raw @applicant.name %>
|
10
|
+
</p>
|
11
|
+
</section>
|
12
|
+
<section>
|
13
|
+
<h1>Founder1 Name</h1>
|
14
|
+
<p>
|
15
|
+
<%=raw @applicant.contact_name %>
|
16
|
+
</p>
|
17
|
+
</section>
|
18
|
+
<section>
|
19
|
+
<h1>Founder1 Email</h1>
|
20
|
+
<p>
|
21
|
+
<%=raw @applicant.contact_email %>
|
22
|
+
</p>
|
23
|
+
</section>
|
24
|
+
<section>
|
25
|
+
<h1>Founder1 Phone</h1>
|
26
|
+
<p>
|
27
|
+
<%=raw @applicant.contact_phone %>
|
28
|
+
</p>
|
29
|
+
</section>
|
30
|
+
<% (1..10).to_a.each do |q| %>
|
31
|
+
<section>
|
32
|
+
<h1><%= t("activerecord.attributes.applicant.question_#{q}") %></h1>
|
33
|
+
<p>
|
34
|
+
<%= raw @applicant.send("question_#{q}") %>
|
35
|
+
</p>
|
36
|
+
</section>
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
<% content_for :body_content_right do %>
|
41
|
+
<aside>
|
42
|
+
<h2><%= t('other') %></h2>
|
43
|
+
<ul id="applicants">
|
44
|
+
<% @applicants.each do |applicant| %>
|
45
|
+
<li>
|
46
|
+
<%= link_to applicant.name, applicant_url(applicant) %>
|
47
|
+
</li>
|
48
|
+
<% end %>
|
49
|
+
</ul>
|
50
|
+
</aside>
|
51
|
+
<% end %>
|
52
|
+
|
53
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
en:
|
2
|
+
shared:
|
3
|
+
admin:
|
4
|
+
image_picker:
|
5
|
+
image: image
|
6
|
+
plugins:
|
7
|
+
applicants:
|
8
|
+
title: Applicants
|
9
|
+
admin:
|
10
|
+
applicants:
|
11
|
+
index:
|
12
|
+
title: Applicants
|
13
|
+
create_new: Add New Applicant
|
14
|
+
reorder: Reorder Applicants
|
15
|
+
reorder_done: Done Reordering Applicants
|
16
|
+
sorry_no_results: Sorry! There are no results found.
|
17
|
+
no_items_yet: There are no Applicants yet. Click "Add New Applicant" to add your first applicant.
|
18
|
+
applicant:
|
19
|
+
edit: Edit this applicant
|
20
|
+
delete: Remove this applicant forever
|
21
|
+
questions:
|
22
|
+
index:
|
23
|
+
title: Applicant Questions
|
24
|
+
create_new: Add New Applicant Question
|
25
|
+
reorder: Reorder Questions
|
26
|
+
reorder_done: Done Reordering Questions
|
27
|
+
sorry_no_results: Sorry! There are no results found.
|
28
|
+
no_items_yet: There are no Questions yet. Click "Add New Applicant Question" to add your first question.
|
29
|
+
question:
|
30
|
+
edit: Edit this question
|
31
|
+
delete: Remove this question forever
|
32
|
+
applicants:
|
33
|
+
show:
|
34
|
+
other: Other Applicants
|
data/config/routes.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Refinery::Application.routes.draw do
|
2
|
+
get '/apply', :to => 'applicants#new', :as => 'new_applicant'
|
3
|
+
get '/apply/thank-you', :to => 'applicants#thank_you'
|
4
|
+
resources :applicants, :only => :create do
|
5
|
+
collection do
|
6
|
+
get :thank_you
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
11
|
+
resources :questions do
|
12
|
+
collection do
|
13
|
+
post :update_positions
|
14
|
+
end
|
15
|
+
end
|
16
|
+
resources :applicants do
|
17
|
+
collection do
|
18
|
+
post :update_positions
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'refinery'
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Applicants
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
initializer "static assets" do |app|
|
7
|
+
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
8
|
+
end
|
9
|
+
|
10
|
+
config.after_initialize do
|
11
|
+
Refinery::Plugin.register do |plugin|
|
12
|
+
plugin.menu_match = /(refinery|admin)\/(applicants|questions)$/
|
13
|
+
plugin.name = "applicants"
|
14
|
+
plugin.activity = {
|
15
|
+
:class => Applicant,
|
16
|
+
:title => 'name'
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: refinerycms-applicants
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Plante
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: refinerycms
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
description: Ruby on Rails Applicants engine for Refinery CMS
|
28
|
+
email:
|
29
|
+
- nap@zerosum.org
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files:
|
33
|
+
- README.md
|
34
|
+
- LICENSE
|
35
|
+
files:
|
36
|
+
- lib/generators/refinerycms_applicants_generator.rb
|
37
|
+
- lib/refinerycms-applicants.rb
|
38
|
+
- lib/tasks/applicants.rake
|
39
|
+
- lib/version.rb
|
40
|
+
- config/locales/en.yml
|
41
|
+
- config/routes.rb
|
42
|
+
- app/controllers/admin/applicants_controller.rb
|
43
|
+
- app/controllers/admin/questions_controller.rb
|
44
|
+
- app/controllers/applicants_controller.rb
|
45
|
+
- app/helpers/applicants_helper.rb
|
46
|
+
- app/models/answer.rb
|
47
|
+
- app/models/applicant.rb
|
48
|
+
- app/models/question.rb
|
49
|
+
- app/views/admin/applicants/_applicant.html.erb
|
50
|
+
- app/views/admin/applicants/_applicants.html.erb
|
51
|
+
- app/views/admin/applicants/_form.html.erb
|
52
|
+
- app/views/admin/applicants/_sortable_list.html.erb
|
53
|
+
- app/views/admin/applicants/edit.html.erb
|
54
|
+
- app/views/admin/applicants/index.html.erb
|
55
|
+
- app/views/admin/applicants/new.html.erb
|
56
|
+
- app/views/admin/questions/_form.html.erb
|
57
|
+
- app/views/admin/questions/_question.html.erb
|
58
|
+
- app/views/admin/questions/_questions.html.erb
|
59
|
+
- app/views/admin/questions/_sortable_list.html.erb
|
60
|
+
- app/views/admin/questions/edit.html.erb
|
61
|
+
- app/views/admin/questions/index.html.erb
|
62
|
+
- app/views/admin/questions/new.html.erb
|
63
|
+
- app/views/applicants/index.html.erb
|
64
|
+
- app/views/applicants/new.html.erb
|
65
|
+
- app/views/applicants/show.html.erb
|
66
|
+
- app/views/applicants/thank_you.html.erb
|
67
|
+
- README.md
|
68
|
+
- LICENSE
|
69
|
+
homepage:
|
70
|
+
licenses: []
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.0.3
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: Applicants engine for Refinery CMS
|
92
|
+
test_files: []
|
93
|
+
has_rdoc:
|