rapidfire 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98a860721e84efa9238468ab8d4de455acfc1004
4
- data.tar.gz: d4a2bbade0997c99ac53d8344dc07a7f56e67b80
3
+ metadata.gz: c5931093a48962d9159db2f33f779444a64ebec1
4
+ data.tar.gz: 91f3a91079f2e3588373f6c6056fcf79275b8e57
5
5
  SHA512:
6
- metadata.gz: 859a4f282ae1505193d540ef46137d229a5efc4d2797d2640cc47fcea265151145071617b404a7fbcf4c48a2eec5e2acb1e02ed54127b546894406b48badf545
7
- data.tar.gz: d8f1a0e3645f7ceb8e84e11e407d0d75dbb6763dfbb827e7c27965e9364745324e968f8ef1883a9339636b6929da4ee8c1381842b79b32f31d2d1ef84165c44a
6
+ metadata.gz: 58aa967e0dd9018371d7acdc8158457aecc6941f9489e80a9fd04e198dad2db050d5cd25d2aba0bfedd94bdf9f43ce60f0e29ff4b3bf068309070f2b96eaee37
7
+ data.tar.gz: b5d67e8d5c7a7bf06286641f188cc3e7543e2fd88ccb7a14c0cfa46cac090b72e3c982c9d785aed4e2d8beea2803de5837069660d1f994888d2a35909b671376
@@ -1,31 +1,38 @@
1
1
  module Rapidfire
2
2
  class QuestionGroupsController < Rapidfire::ApplicationController
3
3
  before_filter :authenticate_administrator!, except: :index
4
- respond_to :html, :js
5
- respond_to :json, only: :results
6
4
 
7
5
  def index
8
6
  @question_groups = QuestionGroup.all
9
- respond_with(@question_groups)
10
7
  end
11
8
 
12
9
  def new
13
10
  @question_group = QuestionGroup.new
14
- respond_with(@question_group)
15
11
  end
16
12
 
17
13
  def create
18
14
  @question_group = QuestionGroup.new(question_group_params)
19
- @question_group.save
20
-
21
- respond_with(@question_group, location: rapidfire.question_groups_url)
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
22
26
  end
23
27
 
24
28
  def destroy
25
29
  @question_group = QuestionGroup.find(params[:id])
26
30
  @question_group.destroy
27
31
 
28
- respond_with(@question_group)
32
+ respond_to do |format|
33
+ format.html { redirect_to question_groups_path }
34
+ format.js
35
+ end
29
36
  end
30
37
 
31
38
  def results
@@ -33,7 +40,11 @@ module Rapidfire
33
40
  @question_group_results =
34
41
  QuestionGroupResults.new(question_group: @question_group).extract
35
42
 
36
- respond_with(@question_group_results, root: false)
43
+ respond_to do |format|
44
+ format.json { render json: @question_group_results, root: false }
45
+ format.html
46
+ format.js
47
+ end
37
48
  end
38
49
 
39
50
  private
@@ -1,48 +1,68 @@
1
1
  module Rapidfire
2
2
  class QuestionsController < Rapidfire::ApplicationController
3
3
  before_filter :authenticate_administrator!
4
- respond_to :html, :js
5
4
 
6
5
  before_filter :find_question_group!
7
6
  before_filter :find_question!, :only => [:edit, :update, :destroy]
8
7
 
9
8
  def index
10
9
  @questions = @question_group.questions
11
- respond_with(@questions)
12
10
  end
13
11
 
14
12
  def new
15
- @question = QuestionForm.new(:question_group => @question_group)
16
- respond_with(@question)
13
+ @question_form = QuestionForm.new(:question_group => @question_group)
17
14
  end
18
15
 
19
16
  def create
20
17
  form_params = params[:question].merge(:question_group => @question_group)
21
- @question = QuestionForm.new(form_params)
22
- @question.save
18
+ @question_form = QuestionForm.new(form_params)
19
+ @question_form.save
23
20
 
24
- respond_with(@question, location: index_location)
21
+ if @question_form.errors.empty?
22
+ respond_to do |format|
23
+ format.html { redirect_to index_location }
24
+ format.js
25
+ end
26
+ else
27
+ respond_to do |format|
28
+ format.html { render :new }
29
+ format.js
30
+ end
31
+ end
25
32
  end
26
33
 
27
34
  def edit
28
- @question = QuestionForm.new(:question => @question)
29
- respond_with(@question)
35
+ @question_form = QuestionForm.new(:question => @question)
30
36
  end
31
37
 
32
38
  def update
33
39
  form_params = params[:question].merge(:question => @question)
34
- @question = QuestionForm.new(form_params)
35
- @question.save
40
+ @question_form = QuestionForm.new(form_params)
41
+ @question_form.save
36
42
 
37
- respond_with(@question, location: index_location)
43
+ if @question_form.errors.empty?
44
+ respond_to do |format|
45
+ format.html { redirect_to index_location }
46
+ format.js
47
+ end
48
+ else
49
+ respond_to do |format|
50
+ format.html { render :edit }
51
+ format.js
52
+ end
53
+ end
38
54
  end
39
55
 
40
56
  def destroy
41
57
  @question.destroy
42
- respond_with(@question, location: index_location)
58
+ respond_to do |format|
59
+ format.html { redirect_to index_location }
60
+ format.js
61
+ end
43
62
  end
44
63
 
45
64
  private
65
+
46
66
  def find_question_group!
47
67
  @question_group = QuestionGroup.find(params[:question_group_id])
48
68
  end
@@ -22,11 +22,7 @@ module Rapidfire
22
22
  :answer_minimum_length, :answer_maximum_length,
23
23
  :answer_greater_than_or_equal_to, :answer_less_than_or_equal_to
24
24
 
25
- delegate :valid?, :errors, :id, :to => :question
26
-
27
- def to_model
28
- question
29
- end
25
+ delegate :valid?, :errors, :to => :question
30
26
 
31
27
  def initialize(params = {})
32
28
  from_question_to_attributes(params[:question]) if params[:question]
@@ -1,9 +1,9 @@
1
1
  <h3>Question</h3>
2
2
 
3
- <%= form_for [@question_group, question] do |f| %>
4
- <%- unless question.errors.empty? %>
3
+ <%= form_for form, as: :question, url: url, method: method do |f| %>
4
+ <%- unless form.errors.empty? %>
5
5
  <ul>
6
- <%- question.errors.full_messages.each do |message| %>
6
+ <%- form.errors.full_messages.each do |message| %>
7
7
  <li><%= message %></li>
8
8
  <% end %>
9
9
  </ul>
@@ -36,5 +36,5 @@
36
36
  <%= f.label :answer_less_than_or_equal_to %>
37
37
  <%= f.text_field :answer_less_than_or_equal_to %>
38
38
 
39
- <%= f.submit %>
39
+ <%= f.submit submit_text %>
40
40
  <% end %>
@@ -1 +1 @@
1
- <%= render partial: 'form', locals: {question: @question} %>
1
+ <%= render partial: 'form', locals: { form: @question_form, url: question_group_question_path(@question_group, @question), method: :put, submit_text: 'Update Question' } %>
@@ -1 +1 @@
1
- <%= render partial: 'form', locals: {question: @question} %>
1
+ <%= render partial: 'form', locals: { form: @question_form, url: question_group_questions_path(@question_group), method: :post, submit_text: 'Create Question' } %>
@@ -1,3 +1,3 @@
1
1
  module Rapidfire
2
- VERSION = '2.0.0'
2
+ VERSION = '2.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapidfire
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuva Kumar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-12 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: rspec-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 2.14.0
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 2.14.0
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: shoulda
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: capybara
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 2.0.3
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: 2.0.3
138
+ version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: capybara-webkit
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: minitest
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: One stop solution for all survey related requirements! Its tad easy!.
168
182
  email:
169
183
  - yuva@codemancers.com
@@ -250,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
264
  version: '0'
251
265
  requirements: []
252
266
  rubyforge_project:
253
- rubygems_version: 2.4.2
267
+ rubygems_version: 2.4.3
254
268
  signing_key:
255
269
  specification_version: 4
256
270
  summary: Surveys made easy.