surveyor 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,12 +7,12 @@ Surveyor is a rails (gem) plugin, that brings surveys to your rails app. Before
7
7
  As a plugin:
8
8
 
9
9
  sudo gem install haml
10
- script/plugin install git://github.com/breakpointer/surveyor.git -r 'tag v0.6.8'
10
+ script/plugin install git://github.com/breakpointer/surveyor.git -r 'tag v0.6.9'
11
11
 
12
12
  Or as a gem plugin:
13
13
 
14
14
  # in environment.rb
15
- config.gem "surveyor", :version => '>=0.6.8', :source => 'http://gemcutter.org'
15
+ config.gem "surveyor", :version => '>=0.6.9', :source => 'http://gemcutter.org'
16
16
 
17
17
  sudo gem install gemcutter
18
18
  gem tumble
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.8
1
+ 0.6.9
@@ -9,31 +9,23 @@ class CreateAnswers < ActiveRecord::Migration
9
9
  t.text :short_text #Used for presenting responses to experts (ie non-survey takers). Just a shorted version of the string
10
10
  t.text :help_text
11
11
  t.integer :weight # Used to assign a weight to an answer object (used for computing surveys that have numerical results) (I added this to support the Urology questionnaire -BLC)
12
+ t.string :response_class # What kind of additional data does this answer accept?
12
13
 
14
+ # Reference
15
+ t.string :reference_identifier # from paper
16
+ t.string :data_export_identifier # data export
17
+ t.string :common_namespace # maping to a common vocab
18
+ t.string :common_identitier # maping to a common vocab
19
+
13
20
  # Display
14
- t.string :response_class # What kind of additional data does this answer accept?
15
21
  t.integer :display_order
16
22
  t.boolean :is_exclusive # If set it causes some UI trigger to remove (and disable) all the other answer choices selected for a question (needed for the WHR)
17
- t.boolean :hide_label
18
-
19
- # Reference
20
- t.string :reference_identifier # Used to relate this question object to questions imported from a paper questionnaire
21
- t.string :data_export_identifier # Used when referencing this quesiton in data export. Usually a shortend/cryptic version of the question text
22
- t.string :common_data_identitier # Used to share data across surveys (or perhaps map to a common vocab.)
23
-
24
- # Validations
25
- # the response_class attr also has validation implications (int, string, float,etc..) but these attrs below give fine grain control over responses
26
- t.integer :max_value
27
- t.integer :min_value
28
- t.integer :length # number of chars/ints accepted
29
- t.integer :decimal_precision # only for floats
30
- t.boolean :allow_negative # only for numeric values
31
- t.boolean :allow_blank
32
- t.string :unit # a string representation of the unit (lbs. USD, oz.) - Context is from the survey domain and question
33
-
34
- # Display property
23
+ t.boolean :hide_label
35
24
  t.integer :display_length # if smaller than answer.length the html input length will be this value
36
25
 
26
+ t.string :custom_class
27
+ t.string :custom_renderer
28
+
37
29
  t.timestamps
38
30
 
39
31
  end
@@ -5,9 +5,18 @@ class CreateQuestionGroups < ActiveRecord::Migration
5
5
  t.text :text
6
6
  t.text :help_text
7
7
 
8
+ # Reference
9
+ t.string :reference_identifier # from paper
10
+ t.string :data_export_identifier # data export
11
+ t.string :common_namespace # maping to a common vocab
12
+ t.string :common_identitier # maping to a common vocab
13
+
8
14
  # Display
9
15
  t.string :display_type
10
-
16
+
17
+ t.string :custom_class
18
+ t.string :custom_renderer
19
+
11
20
  t.timestamps
12
21
  end
13
22
  end
@@ -3,26 +3,29 @@ class CreateQuestions < ActiveRecord::Migration
3
3
  create_table :questions do |t|
4
4
  # Context
5
5
  t.integer :survey_section_id
6
+ t.integer :question_group_id
6
7
 
7
8
  # Content
8
9
  t.text :text
9
10
  t.text :short_text # For experts (ie non-survey takers). Short version of text
10
11
  t.text :help_text
11
-
12
- # Display
13
12
  t.string :pick
14
- t.string :display_type
15
- t.integer :display_order
16
- t.integer :question_group_id
17
- t.boolean :is_mandatory
18
13
 
19
14
  # Reference
20
- t.string :reference_identifier # For questions imported from a paper questionnaire
21
- t.string :data_export_identifier # For data export. Usually a short/cryptic version of text
15
+ t.string :reference_identifier # from paper
16
+ t.string :data_export_identifier # data export
17
+ t.string :common_namespace # maping to a common vocab
18
+ t.string :common_identitier # maping to a common vocab
22
19
 
23
- # styling
20
+ # Display
21
+ t.integer :display_order
22
+ t.string :display_type
23
+ t.boolean :is_mandatory
24
24
  t.integer :display_width # used only for slider component (if needed)
25
25
 
26
+ t.string :custom_class
27
+ t.string :custom_renderer
28
+
26
29
  t.timestamps
27
30
  end
28
31
  end
@@ -7,13 +7,17 @@ class CreateSurveySections < ActiveRecord::Migration
7
7
  # Content
8
8
  t.string :title
9
9
  t.text :description
10
-
10
+
11
+ # Reference
12
+ t.string :reference_identifier # from paper
13
+ t.string :data_export_identifier # data export
14
+ t.string :common_namespace # maping to a common vocab
15
+ t.string :common_identitier # maping to a common vocab
16
+
11
17
  # Display
12
18
  t.integer :display_order
13
-
14
- # Reference
15
- t.string :reference_identifier # Used to relate this question object to questions imported from a paper questionnaire
16
- t.string :data_export_identifier # Used when referencing this quesiton in data export. Usually a shortend/cryptic version of the question text
19
+
20
+ t.string :custom_class
17
21
 
18
22
  t.timestamps
19
23
  end
@@ -7,14 +7,20 @@ class CreateSurveys < ActiveRecord::Migration
7
7
 
8
8
  # Reference
9
9
  t.string :access_code
10
+ t.string :reference_identifier # from paper
11
+ t.string :data_export_identifier # data export
12
+ t.string :common_namespace # maping to a common vocab
13
+ t.string :common_identitier # maping to a common vocab
10
14
 
11
15
  # Expiry
12
16
  t.datetime :active_at
13
17
  t.datetime :inactive_at
14
18
 
15
- # Styling
19
+ # Display
16
20
  t.string :css_url
17
-
21
+
22
+ t.string :custom_class
23
+
18
24
  t.timestamps
19
25
  end
20
26
  end
@@ -3,11 +3,11 @@ require File.dirname(__FILE__) + '/columnizer'
3
3
  class Answer
4
4
  include Columnizer
5
5
 
6
- # Context, Content, Display, Reference
7
- attr_accessor :id, :question_id, :parser
8
- attr_accessor :text, :short_text, :help_text, :numerical_value
9
- attr_accessor :response_class, :display_order, :is_exclusive, :is_a_disabler, :hide_label
10
- attr_accessor :reference_identifier, :data_export_identifier
6
+ # Context, Content, Reference, Display
7
+ attr_accessor :id, :parser, :question_id
8
+ attr_accessor :text, :short_text, :help_text, :weight, :response_class
9
+ attr_accessor :reference_identifier, :data_export_identifier, :common_namespace, :common_identitier
10
+ attr_accessor :display_order, :is_exclusive, :hide_label, :display_length, :custom_class, :custom_renderer
11
11
 
12
12
  def initialize(question, args, options)
13
13
  self.parser = question ? question.parser : nil
@@ -69,11 +69,16 @@ class Answer
69
69
  out << %( help_text: "#{@help_text}")
70
70
  out << %( weight: #{@weight})
71
71
  out << %( response_class: "#{@response_class}")
72
- out << %( display_order: #{display_order} )
72
+ out << %( reference_identifier: "#{@reference_identifier}")
73
+ out << %( data_export_identifier: "#{@data_export_identifier}")
74
+ out << %( common_namespace: "#{@common_namespace}")
75
+ out << %( common_identitier: "#{@common_identitier}")
76
+ out << %( display_order: #{@display_order} )
73
77
  out << %( is_exclusive: #{@is_exclusive})
74
78
  out << %( hide_label: #{@hide_label})
75
- out << %( reference_identifier: #{@reference_identifier})
76
- out << %( data_export_identifier: "#{@data_export_identifier}")
79
+ out << %( display_length: #{@display_length} )
80
+ out << %( custom_class: "#{@custom_class}")
81
+ out << %( custom_renderer: "#{@custom_renderer}")
77
82
  (out << nil ).join("\r\n")
78
83
  end
79
84
 
@@ -3,11 +3,11 @@ require File.dirname(__FILE__) + '/columnizer'
3
3
  class Question
4
4
  include Columnizer
5
5
 
6
- # Context, Content, Display, Reference, Children
7
- attr_accessor :id, :survey_section_id, :parser
8
- attr_accessor :text, :short_text, :help_text
9
- attr_accessor :pick, :display_type, :display_order, :question_group_id, :is_mandatory
10
- attr_accessor :reference_identifier, :data_export_identifier
6
+ # Context, Content, Reference, Display, Children
7
+ attr_accessor :id, :parser, :survey_section_id, :question_group_id
8
+ attr_accessor :text, :short_text, :help_text, :pick
9
+ attr_accessor :reference_identifier, :data_export_identifier, :common_namespace, :common_identitier
10
+ attr_accessor :display_order, :display_type, :is_mandatory, :display_width, :custom_class, :custom_renderer
11
11
  attr_accessor :answers, :dependency
12
12
 
13
13
  def initialize(section, args, options)
@@ -54,16 +54,21 @@ class Question
54
54
  out =[ %(#{@data_export_identifier}_#{@id}:) ]
55
55
  out << %( id: #{@id})
56
56
  out << %( survey_section_id: #{@survey_section_id})
57
+ out << %( question_group_id: #{@question_group_id})
57
58
  out << %( text: "#{@text}")
58
59
  out << %( short_text: "#{@short_text}")
59
60
  out << %( help_text: "#{@help_text}")
60
- out << %( pick: #{pick})
61
- out << %( display_type: #{display_type})
62
- out << %( display_order: #{display_order})
63
- out << %( question_group_id: #{question_group_id})
64
- out << %( is_mandatory: #{@is_mandatory})
65
- out << %( reference_identifier: #{@reference_identifier})
61
+ out << %( pick: "#{pick}")
62
+ out << %( reference_identifier: "#{@reference_identifier}")
66
63
  out << %( data_export_identifier: "#{@data_export_identifier}")
64
+ out << %( common_namespace: "#{@common_namespace}")
65
+ out << %( common_identitier: "#{@common_identitier}")
66
+ out << %( display_order: #{@display_order})
67
+ out << %( display_type: "#{@display_type}")
68
+ out << %( is_mandatory: #{@is_mandatory})
69
+ out << %( display_width: #{@display_width})
70
+ out << %( custom_class: "#{@custom_class}")
71
+ out << %( custom_renderer: "#{@custom_renderer}")
67
72
  (out << nil ).join("\r\n")
68
73
  end
69
74
 
@@ -1,9 +1,10 @@
1
1
  class QuestionGroup
2
-
2
+
3
3
  # Context, Content, Display
4
4
  attr_accessor :id, :section_id, :section, :parser
5
5
  attr_accessor :text, :help_text
6
- attr_accessor :display_type
6
+ attr_accessor :reference_identifier, :data_export_identifier, :common_namespace, :common_identitier
7
+ attr_accessor :display_type, :custom_class, :custom_renderer
7
8
 
8
9
  # id, section and text required
9
10
  def initialize(section, args, options)
@@ -16,13 +17,19 @@ class QuestionGroup
16
17
  def default_options()
17
18
  {:display_type => "default"}
18
19
  end
19
-
20
+
20
21
  def to_yml
21
22
  out =[ %(#{@id}:) ]
22
23
  out << %( id: #{@id})
23
24
  out << %( text: "#{@text}")
24
25
  out << %( help_text: "#{@help_text}")
26
+ out << %( reference_identifier: "#{@reference_identifier}")
27
+ out << %( data_export_identifier: "#{@data_export_identifier}")
28
+ out << %( common_namespace: "#{@common_namespace}")
29
+ out << %( common_identitier: "#{@common_identitier}")
25
30
  out << %( display_type: "#{@display_type}")
31
+ out << %( custom_class: "#{@custom_class}")
32
+ out << %( custom_renderer: "#{@custom_renderer}")
26
33
  (out << nil ).join("\r\n")
27
34
  end
28
35
 
@@ -1,12 +1,13 @@
1
1
  require File.dirname(__FILE__) + '/survey_section'
2
2
 
3
3
  class Survey
4
- include Columnizer
5
- # Content, Reference, Expiry, Children
4
+ include Columnizer
5
+ # Context, Content, Reference, Expiry, Display, Children
6
6
  attr_accessor :id, :parser
7
7
  attr_accessor :title, :description
8
- attr_accessor :access_code
8
+ attr_accessor :access_code, :reference_identifier, :data_export_identifier, :common_namespace, :common_identitier
9
9
  attr_accessor :active_at, :inactive_at
10
+ attr_accessor :css_url, :custom_class
10
11
  attr_accessor :survey_sections
11
12
 
12
13
  @@current_survey = nil
@@ -78,24 +79,27 @@ class Survey
78
79
 
79
80
 
80
81
  def reconcile_dependencies
81
-
82
82
  @survey_sections.each do |section|
83
83
  section.questions.each do |question|
84
84
  question.dependency.dependency_conditions.each { |con| con.reconcile_dependencies} unless question.dependency.nil?
85
-
86
85
  end
87
- end
88
-
86
+ end
89
87
  end
90
-
88
+
91
89
  def to_yml
92
90
  out =[ %(survey_#{@id}:) ]
93
91
  out << %( id: #{@id})
94
92
  out << %( title: "#{@title}")
95
93
  out << %( description: "#{@description}")
96
- out << %( access_code: #{@access_code})
94
+ out << %( access_code: "#{@access_code}")
95
+ out << %( reference_identifier: "#{@reference_identifier}")
96
+ out << %( data_export_identifier: "#{@data_export_identifier}")
97
+ out << %( common_namespace: "#{@common_namespace}")
98
+ out << %( common_identitier: "#{@common_identitier}")
97
99
  out << %( active_at: #{@active_at})
98
100
  out << %( inactive_at: #{@inactive_at})
101
+ out << %( css_url: "#{@css_url}")
102
+ out << %( custom_class: "#{@custom_class}")
99
103
  (out << nil ).join("\r\n")
100
104
  end
101
105
 
@@ -11,14 +11,13 @@ class SurveySection
11
11
  include Columnizer
12
12
 
13
13
  # Context, Content, Display, Reference, Children, Placeholders
14
- attr_accessor :id, :survey_id, :parser
14
+ attr_accessor :id, :parser, :survey_id
15
15
  attr_accessor :title, :description
16
- attr_accessor :display_order
17
- attr_accessor :reference_identifier, :data_export_identifier
16
+ attr_accessor :reference_identifier, :data_export_identifier, :common_namespace, :common_identitier
17
+ attr_accessor :display_order, :custom_class
18
18
  attr_accessor :question_groups, :questions, :grid_answers
19
19
  attr_accessor :current_question_group, :current_question, :current_dependency
20
20
 
21
-
22
21
  # id, survey, and title required
23
22
  def initialize(id, survey, title, options = {})
24
23
  self.id = id
@@ -131,16 +130,19 @@ class SurveySection
131
130
  question
132
131
  end
133
132
 
134
-
135
133
  def to_yml
136
134
  out =[ %(#{@data_export_identifier}_#{@id}:) ]
137
135
  out << %( id: #{@id})
138
136
  out << %( survey_id: #{@survey_id})
139
137
  out << %( title: "#{@title}")
140
138
  out << %( description: "#{@description}")
141
- out << %( display_order: #{display_order})
142
- out << %( reference_identifier: #{@reference_identifier})
139
+ out << %( reference_identifier: "#{@reference_identifier}")
143
140
  out << %( data_export_identifier: "#{@data_export_identifier}")
141
+ out << %( common_namespace: "#{@common_namespace}")
142
+ out << %( common_identitier: "#{@common_identitier}")
143
+ out << %( display_order: #{@display_order})
144
+ out << %( custom_class: "#{@custom_class}")
145
+
144
146
  (out << nil ).join("\r\n")
145
147
  end
146
148
 
data/surveyor.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{surveyor}
8
- s.version = "0.6.8"
8
+ s.version = "0.6.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Chamberlain", "Mark Yoon"]
12
- s.date = %q{2009-10-15}
12
+ s.date = %q{2009-10-16}
13
13
  s.email = %q{yoon@northwestern.edu}
14
14
  s.extra_rdoc_files = [
15
15
  "README.md"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surveyor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Chamberlain
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-10-15 00:00:00 -05:00
13
+ date: 2009-10-16 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency