survey 0.1 → 0.2

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: 88c7e715f08bd4533d85638100a971c263eac2c5
4
- data.tar.gz: e944022847b8b42b9ac60a5e9ceaf3d22bfbc20d
3
+ metadata.gz: c072641e06b2839f2c977eb44e2cd1a5819b4acd
4
+ data.tar.gz: ed1e2c243bb7465912017c8027c40c6aff4f5492
5
5
  SHA512:
6
- metadata.gz: 33b982f786f59f8d90d9f1322d86fa4869dc1d8027a09014b515555c3617fdced414247e30baa55e59168699257695a82e74fb772395110077aa0ce069939736
7
- data.tar.gz: 5c58ab3d53e5969e3dce66ada574cfe2b22dad1ac7217904a289176415162c6e8ff61fff63d7969e465f3c577288082fad68c55b42a140582a26cd42b628a69b
6
+ metadata.gz: d6c45e1252c5aadc60bdcf84343e192430d021efac87ceb557bebe29abf6b5a80b61763635889cf944bdd9348d914b4c710a9dd6f21bcec16d6c77e0c4971a40
7
+ data.tar.gz: c90a817d87d6e264a7899782bbdb86e5615034420918598bf132d0ec1aed116497f346daaec7cf13ff060c728e2a255d0616f97981ad5ed9a614fda21282de2e
data/README.md CHANGED
@@ -26,8 +26,7 @@ http://rubydoc.info/github/runtimerevolution/survey/frames
26
26
 
27
27
  Add survey to your Gemfile:
28
28
  ```ruby
29
- gem 'survey', :git => 'git://github.com/runtimerevolution/survey.git'
30
-
29
+ gem "survey", "~> 0.1"
31
30
  ```
32
31
  Then run bundle to install the Gem:
33
32
  ```sh
@@ -25,7 +25,7 @@ class Survey::Attempt < ActiveRecord::Base
25
25
  scope :for_survey, ->(survey) { where(:survey_id => survey.id) }
26
26
  scope :exclude_survey, ->(survey) { where("NOT survey_id = #{survey.id}") }
27
27
  scope :for_participant, ->(participant) {
28
- where(:participant_id => participant.try(:id), :participant_type => participant.class)
28
+ where(:participant_id => participant.try(:id), :participant_type => participant.class.base_class)
29
29
  }
30
30
 
31
31
  # callbacks
@@ -34,12 +34,17 @@ class Survey::Survey < ActiveRecord::Base
34
34
  return self.questions.map(&:incorrect_options).flatten
35
35
  end
36
36
 
37
- def avaliable_for_participant?(participant)
37
+ def available_for_participant?(participant)
38
38
  current_number_of_attempts = self.attempts.for_participant(participant).size
39
39
  upper_bound = self.attempts_number
40
40
  return !((current_number_of_attempts >= upper_bound) && (upper_bound != 0))
41
41
  end
42
42
 
43
+ def avaliable_for_participant?(participant)
44
+ warn "[DEPRECATION] avaliable_for_participant? is deprecated. Please use available_for_participant? instead"
45
+ available_for_participant?(participant)
46
+ end
47
+
43
48
  private
44
49
 
45
50
  # a surveys only can be activated if has one or more questions
@@ -1,7 +1,7 @@
1
1
  module <%= scope_module %>SurveysHelper
2
2
  def link_to_remove_field(name, f)
3
3
  f.hidden_field(:_destroy) +
4
- link_to_function(raw(name), "removeField(this)", :id =>"remove-attach")
4
+ __link_to_function(raw(name), "removeField(this)", :id =>"remove-attach")
5
5
  end
6
6
 
7
7
  def new_survey
@@ -37,8 +37,14 @@ module <%= scope_module %>SurveysHelper
37
37
  fields = f.fields_for(association, new_object,:child_index => "new_#{association}") do |builder|
38
38
  render(association.to_s.singularize + "_fields", :f => builder)
39
39
  end
40
- link_to_function(name, "addField(this, \"#{association}\", \"#{escape_javascript(fields)}\")",
40
+ __link_to_function(name, "addField(this, \"#{association}\", \"#{escape_javascript(fields)}\")",
41
41
  :id=>"add-attach",
42
42
  :class=>"btn btn-small btn-info")
43
43
  end
44
- end
44
+
45
+ private
46
+
47
+ def __link_to_function(name, on_click_event, opts={})
48
+ link_to(name, '#', opts.merge(onclick: on_click_event))
49
+ end
50
+ end
@@ -1,3 +1,3 @@
1
1
  module Survey
2
- VERSION = "0.1"
3
- end
2
+ VERSION = "0.2"
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: survey
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Runtime Revolution
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-15 00:00:00.000000000 Z
11
+ date: 2015-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails