rapidfire 2.1.0 → 3.0.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 +28 -13
- data/app/controllers/rapidfire/attempts_controller.rb +29 -0
- data/app/controllers/rapidfire/questions_controller.rb +35 -34
- data/app/controllers/rapidfire/surveys_controller.rb +60 -0
- data/app/models/rapidfire/answer.rb +3 -3
- data/app/models/rapidfire/attempt.rb +11 -0
- data/app/models/rapidfire/question.rb +3 -3
- data/app/models/rapidfire/{question_group.rb → survey.rb} +1 -1
- data/app/services/rapidfire/{answer_group_builder.rb → attempt_builder.rb} +12 -12
- data/app/services/rapidfire/base_service.rb +1 -1
- data/app/services/rapidfire/question_form.rb +4 -4
- data/app/services/rapidfire/{question_group_results.rb → survey_results.rb} +3 -3
- data/app/views/rapidfire/{answer_groups → attempts}/new.html.erb +2 -2
- data/app/views/rapidfire/questions/_question.html.erb +2 -2
- data/app/views/rapidfire/questions/edit.html.erb +1 -1
- data/app/views/rapidfire/questions/index.html.erb +1 -1
- data/app/views/rapidfire/questions/new.html.erb +1 -1
- data/app/views/rapidfire/surveys/_form.html.erb +15 -0
- data/app/views/rapidfire/surveys/_survey.html.erb +18 -0
- data/app/views/rapidfire/{question_groups → surveys}/index.html.erb +4 -4
- data/app/views/rapidfire/surveys/new.html.erb +1 -0
- data/app/views/rapidfire/{question_groups → surveys}/results.html.erb +1 -1
- data/config/routes.rb +3 -3
- data/db/migrate/20130502170733_create_rapidfire_question_groups.rb +1 -1
- data/db/migrate/20130502195310_create_rapidfire_questions.rb +2 -2
- data/db/migrate/20130502195415_create_rapidfire_answer_groups.rb +4 -4
- data/db/migrate/20130502195504_create_rapidfire_answers.rb +2 -2
- data/lib/generators/rapidfire/templates/migrations/rename_answer_groups_and_question_groups.rb +9 -0
- data/lib/generators/rapidfire/upgrade_migration_generator.rb +18 -0
- data/lib/generators/rapidfire/views_generator.rb +4 -4
- data/lib/rapidfire/version.rb +1 -1
- data/lib/tasks/rapidfire.rake +10 -0
- data/spec/controllers/rapidfire/attempts_controller_spec.rb +20 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +11 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +61 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +72 -0
- data/spec/dummy/config/environments/test.rb +41 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +8 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +53 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +394 -0
- data/spec/dummy/log/test.log +2380 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/answers_factory.rb +7 -0
- data/spec/factories/attempts_factory.rb +5 -0
- data/spec/factories/questions_factory.rb +30 -0
- data/spec/factories/surveys_factory.rb +5 -0
- data/spec/features/rapidfire/answering_questions_spec.rb +55 -0
- data/spec/features/rapidfire/managing_questions_spec.rb +95 -0
- data/spec/features/rapidfire/managing_surveys_spec.rb +141 -0
- data/spec/models/rapidfire/answer_spec.rb +23 -0
- data/spec/models/rapidfire/attempt_spec.rb +9 -0
- data/spec/models/rapidfire/question_spec.rb +123 -0
- data/spec/models/rapidfire/questions/checkbox_spec.rb +90 -0
- data/spec/models/rapidfire/questions/date_spec.rb +78 -0
- data/spec/models/rapidfire/questions/numeric_spec.rb +114 -0
- data/spec/models/rapidfire/questions/select_spec.rb +90 -0
- data/spec/models/rapidfire/survey_spec.rb +11 -0
- data/spec/serializers/rapidfire/question_result_serializer_spec.rb +44 -0
- data/spec/services/rapidfire/attempt_builder_spec.rb +88 -0
- data/spec/services/rapidfire/question_form_spec.rb +93 -0
- data/spec/services/rapidfire/survey_results_spec.rb +63 -0
- data/spec/spec_helper.rb +68 -0
- data/spec/support/rapidfire/answer_spec_helper.rb +23 -0
- data/spec/support/rapidfire/question_spec_helper.rb +13 -0
- data/spec/tasks/change_delimiter_from_comma_to_srsn_spec.rb +31 -0
- metadata +133 -30
- data/app/controllers/rapidfire/answer_groups_controller.rb +0 -29
- data/app/controllers/rapidfire/question_groups_controller.rb +0 -59
- data/app/models/rapidfire/answer_group.rb +0 -11
- data/app/views/rapidfire/question_groups/_form.html.erb +0 -15
- data/app/views/rapidfire/question_groups/_question_group.html.erb +0 -18
- data/app/views/rapidfire/question_groups/new.html.erb +0 -1
@@ -1,29 +0,0 @@
|
|
1
|
-
module Rapidfire
|
2
|
-
class AnswerGroupsController < Rapidfire::ApplicationController
|
3
|
-
before_filter :find_question_group!
|
4
|
-
|
5
|
-
def new
|
6
|
-
@answer_group_builder = AnswerGroupBuilder.new(answer_group_params)
|
7
|
-
end
|
8
|
-
|
9
|
-
def create
|
10
|
-
@answer_group_builder = AnswerGroupBuilder.new(answer_group_params)
|
11
|
-
|
12
|
-
if @answer_group_builder.save
|
13
|
-
redirect_to question_groups_path
|
14
|
-
else
|
15
|
-
render :new
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
def find_question_group!
|
21
|
-
@question_group = QuestionGroup.find(params[:question_group_id])
|
22
|
-
end
|
23
|
-
|
24
|
-
def answer_group_params
|
25
|
-
answer_params = { params: params[:answer_group] }
|
26
|
-
answer_params.merge(user: current_user, question_group: @question_group)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module Rapidfire
|
2
|
-
class QuestionGroupsController < Rapidfire::ApplicationController
|
3
|
-
before_filter :authenticate_administrator!, except: :index
|
4
|
-
|
5
|
-
def index
|
6
|
-
@question_groups = QuestionGroup.all
|
7
|
-
end
|
8
|
-
|
9
|
-
def new
|
10
|
-
@question_group = QuestionGroup.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def create
|
14
|
-
@question_group = QuestionGroup.new(question_group_params)
|
15
|
-
if @question_group.save
|
16
|
-
respond_to do |format|
|
17
|
-
format.html { redirect_to question_groups_path }
|
18
|
-
format.js
|
19
|
-
end
|
20
|
-
else
|
21
|
-
respond_to do |format|
|
22
|
-
format.html { render :new }
|
23
|
-
format.js
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def destroy
|
29
|
-
@question_group = QuestionGroup.find(params[:id])
|
30
|
-
@question_group.destroy
|
31
|
-
|
32
|
-
respond_to do |format|
|
33
|
-
format.html { redirect_to question_groups_path }
|
34
|
-
format.js
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def results
|
39
|
-
@question_group = QuestionGroup.find(params[:id])
|
40
|
-
@question_group_results =
|
41
|
-
QuestionGroupResults.new(question_group: @question_group).extract
|
42
|
-
|
43
|
-
respond_to do |format|
|
44
|
-
format.json { render json: @question_group_results, root: false }
|
45
|
-
format.html
|
46
|
-
format.js
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
def question_group_params
|
52
|
-
if Rails::VERSION::MAJOR == 4
|
53
|
-
params.require(:question_group).permit(:name)
|
54
|
-
else
|
55
|
-
params[:question_group]
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module Rapidfire
|
2
|
-
class AnswerGroup < ActiveRecord::Base
|
3
|
-
belongs_to :question_group
|
4
|
-
belongs_to :user, polymorphic: true
|
5
|
-
has_many :answers, inverse_of: :answer_group, autosave: true
|
6
|
-
|
7
|
-
if Rails::VERSION::MAJOR == 3
|
8
|
-
attr_accessible :question_group, :user
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<h3><%= question_group.new_record? ? "New Group" : "Edit Group" %></h3>
|
2
|
-
|
3
|
-
<%= form_for question_group do |f| %>
|
4
|
-
<%- if question_group.errors.any? %>
|
5
|
-
<ul>
|
6
|
-
<%- question_group.errors.full_messages.each do |message| %>
|
7
|
-
<li><%= message %></li>
|
8
|
-
<% end %>
|
9
|
-
</ul>
|
10
|
-
<% end %>
|
11
|
-
|
12
|
-
<%= f.label :name %>
|
13
|
-
<%= f.text_field :name %>
|
14
|
-
<%= f.submit %>
|
15
|
-
<% end %>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<tr id= "question_group_<%= question_group.id %>">
|
2
|
-
<td>
|
3
|
-
<% if can_administer? %>
|
4
|
-
<%= link_to question_group.name, question_group_questions_path(question_group) %>
|
5
|
-
<% else %>
|
6
|
-
<%= question_group.name %>
|
7
|
-
<% end %>
|
8
|
-
</td>
|
9
|
-
<td>
|
10
|
-
<ul class="horizontal-list">
|
11
|
-
<li><%= link_to "Answer Questions", new_question_group_answer_group_path(question_group) %></li>
|
12
|
-
<% if can_administer? %>
|
13
|
-
<li><%= link_to "Results", [:results, question_group] %></li>
|
14
|
-
<li><%= link_to "Delete", [question_group], method: :delete %></li>
|
15
|
-
<% end %>
|
16
|
-
</ul>
|
17
|
-
</td>
|
18
|
-
</tr>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render partial: 'form', locals: {question_group: @question_group} %>
|