surveyor 0.19.2 → 0.19.3

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ 0.19.3
2
+
3
+ * add authenticity token into ajax requests. closes #120
4
+ * Adding the custom_class attribute to text answer fields. Fixes #113.
5
+ * reverting some styles
6
+ * Add padding to dependent questions
7
+ * Change colors in surveyor.sass
8
+ * Fix dependent questions css and alternate column color in grid questions
9
+
1
10
  0.19.2
2
11
 
3
12
  * quiz example
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Surveys On Rails
2
2
 
3
- Surveyor is a ruby gem and developer tool that brings surveys into Rails applications. Surveys are written in the Surveyor DSL (Domain Specific Language). Before Rails 2.3, it was implemented as a Rails Engine. It also existed previously as a plugin. Today it is a gem only.
3
+ Surveyor is a ruby gem and developer tool that brings surveys into Rails applications. Surveys are written in the Surveyor DSL (Domain Specific Language).
4
+
5
+ Before Rails 2.3, it was implemented as a Rails Engine. It also existed previously as a plugin. Today it is a gem only.
6
+
7
+ The rails3 branch is functional for use with Rails 3.
4
8
 
5
9
  ## Why you might want to use Surveyor
6
10
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.19.2
1
+ 0.19.3
@@ -63,6 +63,12 @@ module SurveyorHelper
63
63
  else type_sym
64
64
  end
65
65
  end
66
+ def generate_pick_none_input_html(response_class, default_value, css_class)
67
+ html = {}
68
+ html[:class] = css_class unless css_class.blank?
69
+ html[:value] = default_value if response_class.blank?
70
+ html
71
+ end
66
72
 
67
73
  # Responses
68
74
  def response_for(response_set, question, answer = nil, response_group = nil)
@@ -14,6 +14,6 @@
14
14
  - when "none"
15
15
  - if %w(date datetime time float integer string text).include? a.response_class
16
16
  = ff.quiet_input :answer_id, :input_html => {:class => a.css_class, :value => a.id}
17
- = ff.input rc_to_attr(a.response_class), :as => rc_to_as(a.response_class), :label => a.split_or_hidden_text(:pre).blank? ? false : a.split_or_hidden_text(:pre), :hint => a.split_or_hidden_text(:post), :input_html => (r.as(a.response_class).blank? ? {:value => a.default_value} : {})
17
+ = ff.input rc_to_attr(a.response_class), :as => rc_to_as(a.response_class), :label => a.split_or_hidden_text(:pre).blank? ? false : a.split_or_hidden_text(:pre), :hint => a.split_or_hidden_text(:post), :input_html => generate_pick_none_input_html(r.as(a.response_class), a.default_value, a.css_class)
18
18
  - else
19
19
  = a.text
@@ -5,6 +5,10 @@
5
5
  - when :grid
6
6
  %li
7
7
  %table
8
+ %col.pre
9
+ - qs.first.answers.each do |a|
10
+ %col{:class => cycle("odd", "even")}
11
+ %col.post
8
12
  %tbody
9
13
  - qs.each_slice(10) do |ten_questions| # header row every 10
10
14
  %tr
@@ -27,4 +31,4 @@
27
31
  = submit_tag("+ add row", :name => "section[#{@section.id}][g_#{g.id}]", :class => "add_row")
28
32
  - else # :inline
29
33
  - qs.each do |q|
30
- = render q.custom_renderer || "/partials/question", :g => g, :q => q, :f => f
34
+ = render q.custom_renderer || "/partials/question", :g => g, :q => q, :f => f
@@ -32,3 +32,7 @@ Then /^question "([^"]*)" should have a dependency with rule "([^"]*)"$/ do |qr,
32
32
  q.dependency.should_not be_nil
33
33
  q.dependency.rule.should == rule
34
34
  end
35
+
36
+ Then /^the element "([^"]*)" should have the class "([^"]*)"$/ do |selector, css_class|
37
+ response.should have_selector(selector, :class => css_class)
38
+ end
@@ -79,4 +79,23 @@ Feature: Survey creation
79
79
  end
80
80
  end
81
81
  """
82
- Then question "1" should have correct answer "oink"
82
+ Then question "1" should have correct answer "oink"
83
+
84
+ Scenario: Custom css class
85
+ Given the survey
86
+ """
87
+ survey "Movies" do
88
+ section "First" do
89
+ q "What is your favorite movie?"
90
+ a :string, :custom_class => "my_custom_class"
91
+ q "What is your favorite state?"
92
+ a :string
93
+ end
94
+ end
95
+ """
96
+ When I start the "Movies" survey
97
+ Then the element "input[type='text']:first" should have the class "my_custom_class"
98
+ # Then the element "input[type='text']:last" should not contain the class attribute
99
+
100
+
101
+
@@ -12,7 +12,7 @@ jQuery(document).ready(function(){
12
12
  // }else{
13
13
  // // Other browsers just use the change event on the form
14
14
  jQuery("form#survey_form input, form#survey_form select, form#survey_form textarea").change(function(){
15
- question_data = $(this).parents('fieldset[id^="q_"]').find("input, select, textarea").serialize();
15
+ question_data = $(this).parents('fieldset[id^="q_"]').find("input, select, textarea").add($("form#survey_form input[name='authenticity_token']")).serialize();
16
16
  // console.log(unescape(question_data));
17
17
  $.ajax({ type: "PUT", url: $(this).parents('form#survey_form').attr("action"), data: question_data, dataType: 'json', success: successfulSave })
18
18
  });
@@ -2,7 +2,7 @@
2
2
  !surveyor_flash_background_color = #FFF1A8
3
3
  !surveyor_color = #FFFFF1
4
4
  !surveyor_text_color = #333333
5
-
5
+ !surveyor_dependent_color = #FFFFDF
6
6
  !surveyor_menus_active_color = #EBEBCC
7
7
  !surveyor_menus_border_color = #ccc
8
8
 
@@ -54,10 +54,13 @@ body
54
54
  // question groups
55
55
  fieldset.g_inline fieldset
56
56
  :display inline
57
- fieldset.g_grid li.surveyor_radio label
58
- :visibility hidden
59
- input
60
- :visibility visible
57
+ fieldset.g_grid
58
+ table
59
+ :border-collapse collapse
60
+ li.surveyor_radio label
61
+ :visibility hidden
62
+ input
63
+ :visibility visible
61
64
  fieldset.g_repeater
62
65
  ol fieldset
63
66
  :display inline
@@ -68,7 +71,8 @@ body
68
71
  .survey_section>fieldset>ol
69
72
  :padding-left 1em
70
73
  fieldset
71
- :padding 5px 0 10px 0
74
+ :padding-top 5px
75
+ :margin-bottom 10px
72
76
  ol
73
77
  fieldset
74
78
  :vertical-align top
@@ -91,11 +95,21 @@ body
91
95
  :margin 0 3px
92
96
  input[type="text"], textarea
93
97
  :font-size 0.8em
98
+
99
+ fieldset.q_hidden
100
+ :display none
101
+ fieldset.q_dependent
102
+ :background-color= !surveyor_dependent_color
103
+ legend
104
+ :background-color= !surveyor_dependent_color
105
+ :padding 3px 3px 3px 0
106
+
107
+
94
108
 
95
109
  // buttons
96
110
  input[type="submit"]
97
111
  :font-size 1em
98
- :border 0px
112
+ :border 1px
99
113
  :padding 5px
100
114
  :cursor pointer
101
115
  :background-color= !background_color
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.19.2"
8
+ s.version = "0.19.3"
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{2011-02-09}
12
+ s.date = %q{2011-03-18}
13
13
  s.email = %q{yoon@northwestern.edu}
14
14
  s.extra_rdoc_files = [
15
15
  "README.md"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surveyor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 87
4
+ hash: 85
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 19
9
- - 2
10
- version: 0.19.2
9
+ - 3
10
+ version: 0.19.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Chamberlain
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-09 00:00:00 -06:00
19
+ date: 2011-03-18 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency