surveyor 0.12.1 → 0.13.0
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/README.md +8 -76
- data/VERSION +1 -1
- data/app/controllers/surveyor_controller.rb +4 -144
- data/app/helpers/surveyor_helper.rb +1 -9
- data/app/models/answer.rb +0 -3
- data/app/models/dependency.rb +0 -3
- data/app/models/dependency_condition.rb +0 -3
- data/app/models/question.rb +0 -3
- data/app/models/question_group.rb +0 -3
- data/app/models/response.rb +0 -3
- data/app/models/response_set.rb +2 -5
- data/app/models/survey.rb +0 -3
- data/app/models/survey_section.rb +1 -4
- data/app/models/validation.rb +0 -4
- data/app/models/validation_condition.rb +0 -3
- data/app/views/surveyor/new.html.haml +1 -1
- data/config/routes.rb +5 -7
- data/features/surveyor.feature +1 -1
- data/generators/extend_surveyor/extend_surveyor_generator.rb +2 -3
- data/generators/extend_surveyor/templates/EXTENDING_SURVEYOR +32 -12
- data/generators/extend_surveyor/templates/extensions/surveyor_controller.rb +39 -0
- data/generators/extend_surveyor/templates/extensions/surveyor_custom.html.erb +1 -1
- data/generators/surveyor/surveyor_generator.rb +2 -8
- data/lib/surveyor/common.rb +24 -0
- data/lib/surveyor/surveyor_controller_methods.rb +121 -0
- data/lib/tasks/surveyor_tasks.rake +14 -0
- data/surveyor.gemspec +5 -8
- metadata +8 -11
- data/generators/extend_surveyor/templates/extensions/survey_extensions.rb +0 -24
- data/generators/extend_surveyor/templates/extensions/surveyor_controller_extensions.rb +0 -28
- data/generators/extend_surveyor/templates/extensions/surveyor_helper_extensions.rb +0 -17
- data/generators/surveyor/templates/assets/stylesheets/surveyor.css +0 -230
- data/generators/surveyor/templates/initializers/haml.rb +0 -8
- data/generators/surveyor/templates/initializers/surveyor.rb +0 -10
data/README.md
CHANGED
@@ -59,19 +59,19 @@ As a plugin:
|
|
59
59
|
|
60
60
|
gem install haml
|
61
61
|
gem install fastercsv
|
62
|
-
script/plugin install git://github.com/breakpointer/surveyor.git -r 'tag v0.
|
62
|
+
script/plugin install git://github.com/breakpointer/surveyor.git -r 'tag v0.13.0'
|
63
63
|
|
64
64
|
Or as a gem:
|
65
65
|
|
66
66
|
# in environment.rb
|
67
|
-
config.gem "surveyor", :version => '~> 0.
|
67
|
+
config.gem "surveyor", :version => '~> 0.13.0', :source => 'http://gemcutter.org'
|
68
68
|
|
69
69
|
rake gems:install
|
70
70
|
|
71
71
|
Or as a gem (with bundler):
|
72
72
|
|
73
73
|
# in environment.rb
|
74
|
-
gem "surveyor", '~> 0.
|
74
|
+
gem "surveyor", '~> 0.13.0'
|
75
75
|
|
76
76
|
bundle install
|
77
77
|
|
@@ -89,88 +89,21 @@ The rake surveyor task overwrites previous surveys by default, but can append in
|
|
89
89
|
rake surveyor FILE=surveys/kitchen_sink_survey.rb APPEND=true
|
90
90
|
|
91
91
|
The rake tasks above generate surveys in our custom survey DSL (which is a great format for end users and stakeholders to use).
|
92
|
-
After you have run them start up your app:
|
93
|
-
|
94
|
-
script/server
|
95
|
-
|
96
|
-
(or however you normally start your app) and goto:
|
92
|
+
After you have run them start up your app and go to:
|
97
93
|
|
98
94
|
http://localhost:3000/surveys
|
99
95
|
|
100
96
|
Try taking the survey and compare it to the contents of the DSL file kitchen\_sink\_survey.rb. See how each type of
|
101
97
|
DSL question maps to the resulting rendered view of the question.
|
102
98
|
|
103
|
-
#
|
104
|
-
|
105
|
-
The surveyor generator creates config/initializers/surveyor.rb. There, you can specify:
|
106
|
-
|
107
|
-
- your own relative root for surveys ('/' is not recommended as any path will be interpreted as a survey name)
|
108
|
-
- your own custom title (string) for the survey list page
|
109
|
-
- your own custom layout file name, in your app/views/layouts folder
|
110
|
-
- your own custom finish url for all surveys. you can give a string (a path), a symbol (the name of a method in ApplicationController)
|
111
|
-
- if you would like surveys to require authorization via the restful_authentication plugin
|
112
|
-
- if you would like to extend the surveyor_controller (see Extending Surveyor below)
|
113
|
-
|
114
|
-
The initializer runs once, when the app starts. The block style is used to keep multiple options DRY (defaults below):
|
115
|
-
|
116
|
-
Surveyor::Config.run do |config|
|
117
|
-
config['default.relative_url_root'] = nil # "surveys"
|
118
|
-
config['default.title'] = nil # "You can take these surveys:"
|
119
|
-
config['default.layout'] = nil # "surveyor_default"
|
120
|
-
config['default.index'] = nil # "/surveys" # or :index_path_method
|
121
|
-
config['default.finish'] = nil # "/surveys" # or :finish_path_method
|
122
|
-
#config['authentication_method'] = :login_required # set to true to use restful authentication
|
123
|
-
config['extend'] = %w() # %w(survey surveyor_helper surveyor_controller)
|
124
|
-
end
|
125
|
-
|
126
|
-
You can update surveyor's configuration at any time. Use the block style (above), or the individual style:
|
127
|
-
|
128
|
-
Surveyor::Config['default.title'] = "Cheese is great!"
|
129
|
-
|
130
|
-
To look at the current surveyor configuration:
|
131
|
-
|
132
|
-
Surveyor::Config.to_hash.inspect
|
133
|
-
|
134
|
-
# Extending surveyor
|
99
|
+
# Customizing surveyor
|
135
100
|
|
136
|
-
Surveyor's
|
101
|
+
Surveyor's controller, models, and views may be customized via classes in your app/models, app/helpers and app/controllers directories. To generate a sample custom controller and layout, run:
|
137
102
|
|
138
|
-
script/generate
|
103
|
+
script/rails generate surveyor:custom
|
139
104
|
|
140
|
-
|
105
|
+
and check out surveys/README\_FOR\_CUSTOM\_SURVEYOR.md
|
141
106
|
|
142
|
-
require 'models/survey_extensions' # Extended the survey model
|
143
|
-
|
144
|
-
SurveyorHelper class_eval and instance methods can be modified. Include the following in config/initializers/surveyor.rb:
|
145
|
-
|
146
|
-
require 'helpers/surveyor_helper_extensions' # Extend the surveyor helper
|
147
|
-
|
148
|
-
SurveyorController class_eval, class methods, instance methods, and actions can be modified. Action methods should be specified separately in the Actions submodule. Set the following option in config/initializers/surveyor.rb Surveyor::Config block:
|
149
|
-
|
150
|
-
config['extend_controller'] = true
|
151
|
-
|
152
|
-
# Sample layout
|
153
|
-
|
154
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
155
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
156
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
157
|
-
<head>
|
158
|
-
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
159
|
-
<title>Survey: <%= controller.action_name %></title>
|
160
|
-
<%= surveyor_includes %>
|
161
|
-
</head>
|
162
|
-
<body>
|
163
|
-
<div id="flash"><%= flash[:notice] %></div>
|
164
|
-
<%= yield %>
|
165
|
-
</body>
|
166
|
-
</html>
|
167
|
-
|
168
|
-
The <code>surveyor\_includes</code> helper just calls <code>surveyor\_stylsheets + surveyor\_javascripts</code> which in turn call:
|
169
|
-
|
170
|
-
stylesheet_link_tag 'surveyor/reset', 'surveyor/surveyor', 'surveyor/ui.theme.css','surveyor/jquery-ui-slider-additions'
|
171
|
-
|
172
|
-
javascript_include_tag 'surveyor/jquery-1.2.6.js', 'surveyor/jquery-ui-personalized-1.5.3.js', 'surveyor/accessibleUISlider.jQuery.js','surveyor/jquery.form.js', 'surveyor/surveyor.js'
|
173
|
-
|
174
107
|
# Dependencices
|
175
108
|
|
176
109
|
Surveyor depends on Ruby (1.8.7 - 1.9.1), Rails 2.3 and the SASS style sheet language, part of HAML (http://haml.hamptoncatlin.com/download). It also depends on fastercsv for csv exports. For running the test suite you will need rspec and have the rspec plugin installed in your application.
|
@@ -179,7 +112,6 @@ Surveyor depends on Ruby (1.8.7 - 1.9.1), Rails 2.3 and the SASS style sheet lan
|
|
179
112
|
|
180
113
|
To work on the plugin code (for enhancements, and bug fixes, etc...) fork this github project. Then clone the project under the vendor/plugins directory in a Rails app used only for development:
|
181
114
|
|
182
|
-
|
183
115
|
# Changes
|
184
116
|
|
185
117
|
0.12.0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.13.0
|
@@ -1,146 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# Surveyor Controller allows a user to take a survey. It is semi-RESTful since it does not have a concrete representation model.
|
2
2
|
# The "resource" is a survey attempt/session populating a response set.
|
3
|
-
|
4
3
|
class SurveyorController < ApplicationController
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# Extending surveyor
|
10
|
-
include SurveyorControllerExtensions if Surveyor::Config['extend'].include?("surveyor_controller")
|
11
|
-
before_filter :extend_actions
|
12
|
-
|
13
|
-
# RESTful authentication
|
14
|
-
if Surveyor::Config['authentication_method']
|
15
|
-
before_filter Surveyor::Config['authentication_method']
|
16
|
-
end
|
17
|
-
|
18
|
-
# Get the response set or current_user
|
19
|
-
# before_filter :get_response_set, :except => [:new, :create]
|
20
|
-
before_filter :get_current_user, :only => [:new, :create]
|
21
|
-
|
22
|
-
# Actions
|
23
|
-
def new
|
24
|
-
@surveys = Survey.find(:all)
|
25
|
-
redirect_to surveyor_default(:index) unless available_surveys_path == surveyor_default(:index)
|
26
|
-
end
|
27
|
-
|
28
|
-
def create
|
29
|
-
@survey = Survey.find_by_access_code(params[:survey_code])
|
30
|
-
@response_set = ResponseSet.create(:survey => @survey, :user_id => (@current_user.nil? ? @current_user : @current_user.id))
|
31
|
-
if (@survey && @response_set)
|
32
|
-
flash[:notice] = "Survey was successfully started."
|
33
|
-
redirect_to(edit_my_survey_path(:survey_code => @survey.access_code, :response_set_code => @response_set.access_code))
|
34
|
-
else
|
35
|
-
flash[:notice] = "Unable to find that survey"
|
36
|
-
redirect_to(available_surveys_path)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def show
|
41
|
-
@response_set = ResponseSet.find_by_access_code(params[:response_set_code], :include => {:responses => [:question, :answer]})
|
42
|
-
if @response_set
|
43
|
-
respond_to do |format|
|
44
|
-
format.html #{render :action => :show}
|
45
|
-
format.csv {
|
46
|
-
send_data(@response_set.to_csv, :type => 'text/csv; charset=utf-8; header=present',:filename => "#{@response_set.updated_at.strftime('%Y-%m-%d')}_#{@response_set.access_code}.csv")
|
47
|
-
}
|
48
|
-
end
|
49
|
-
else
|
50
|
-
flash[:notice] = "Unable to find your responses to the survey"
|
51
|
-
redirect_to(available_surveys_path)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def edit
|
56
|
-
@response_set = ResponseSet.find_by_access_code(params[:response_set_code], :include => {:responses => [:question, :answer]})
|
57
|
-
if @response_set
|
58
|
-
@survey = Survey.with_sections.find_by_id(@response_set.survey_id)
|
59
|
-
@sections = @survey.sections
|
60
|
-
if params[:section]
|
61
|
-
@section = @sections.with_includes.find(section_id_from(params[:section])) || @sections.with_includes.first
|
62
|
-
else
|
63
|
-
@section = @sections.with_includes.first
|
64
|
-
end
|
65
|
-
@questions = @section.questions
|
66
|
-
@dependents = (@response_set.unanswered_dependencies - @section.questions) || []
|
67
|
-
else
|
68
|
-
flash[:notice] = "Unable to find your responses to the survey"
|
69
|
-
redirect_to(available_surveys_path)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def update
|
74
|
-
saved = nil
|
75
|
-
ActiveRecord::Base.transaction do
|
76
|
-
if @response_set = ResponseSet.find_by_access_code(params[:response_set_code], :include => {:responses => :answer},:lock => true)
|
77
|
-
@response_set.current_section_id = params[:current_section_id]
|
78
|
-
else
|
79
|
-
flash[:notice] = "Unable to find your responses to the survey"
|
80
|
-
redirect_to(available_surveys_path) and return
|
81
|
-
end
|
82
|
-
|
83
|
-
if params[:responses] or params[:response_groups]
|
84
|
-
@response_set.clear_responses
|
85
|
-
saved = @response_set.update_attributes(:response_attributes => (params[:responses] || {}).dup ,
|
86
|
-
:response_group_attributes => (params[:response_groups] || {}).dup) #copy (dup) to preserve params because we manipulate params in the response_set methods
|
87
|
-
if (saved && params[:finish])
|
88
|
-
@response_set.complete!
|
89
|
-
saved = @response_set.save!
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
respond_to do |format|
|
94
|
-
format.html do
|
95
|
-
if saved && params[:finish]
|
96
|
-
flash[:notice] = "Completed survey"
|
97
|
-
redirect_to surveyor_default(:finish)
|
98
|
-
else
|
99
|
-
flash[:notice] = "Unable to update survey" if !saved #and !saved.nil? # saved.nil? is true if there are no questions on the page (i.e. if it only contains a label)
|
100
|
-
redirect_to :action => "edit", :anchor => anchor_from(params[:section]), :params => {:section => section_id_from(params[:section])}
|
101
|
-
end
|
102
|
-
end
|
103
|
-
# No redirect needed if we're talking to the page via json
|
104
|
-
format.js do
|
105
|
-
render :json => @response_set.all_dependencies.to_json
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
private
|
111
|
-
|
112
|
-
# Filters
|
113
|
-
def get_current_user
|
114
|
-
@current_user = self.respond_to?(:current_user) ? self.current_user : nil
|
115
|
-
end
|
116
|
-
|
117
|
-
# Params: the name of some submit buttons store the section we'd like to go to. for repeater questions, an anchor to the repeater group is also stored
|
118
|
-
# e.g. params[:section] = {"1"=>{"question_group_1"=>"<= add row"}}
|
119
|
-
def section_id_from(p)
|
120
|
-
p.respond_to?(:keys) ? p.keys.first : p
|
121
|
-
end
|
122
|
-
|
123
|
-
def anchor_from(p)
|
124
|
-
p.respond_to?(:keys) && p[p.keys.first].respond_to?(:keys) ? p[p.keys.first].keys.first : nil
|
125
|
-
end
|
126
|
-
|
127
|
-
# Extending surveyor
|
128
|
-
def surveyor_default(type = :finish)
|
129
|
-
# http://www.postal-code.com/mrhappy/blog/2007/02/01/ruby-comparing-an-objects-class-in-a-case-statement/
|
130
|
-
# http://www.skorks.com/2009/08/how-a-ruby-case-statement-works-and-what-you-can-do-with-it/
|
131
|
-
case arg = Surveyor::Config["default.#{type.to_s}"]
|
132
|
-
when String
|
133
|
-
return arg
|
134
|
-
when Symbol
|
135
|
-
return self.send(arg)
|
136
|
-
else
|
137
|
-
return available_surveys_path
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def extend_actions
|
142
|
-
# http://blog.mattwynne.net/2009/07/11/rails-tip-use-polymorphism-to-extend-your-controllers-at-runtime/
|
143
|
-
self.extend SurveyorControllerExtensions::Actions if Surveyor::Config['extend'].include?("surveyor_controller") && defined? SurveyorControllerExtensions::Actions
|
144
|
-
end
|
145
|
-
|
146
|
-
end
|
4
|
+
unloadable
|
5
|
+
include Surveyor::SurveyorControllerMethods
|
6
|
+
end
|
@@ -1,19 +1,11 @@
|
|
1
1
|
module SurveyorHelper
|
2
|
-
|
3
|
-
# Extending surveyor
|
4
|
-
include SurveyorHelperExtensions if Surveyor::Config['extend'].include?("surveyor_helper")
|
5
|
-
|
6
|
-
# Configuration
|
7
|
-
def surveyor_config
|
8
|
-
Surveyor::Config
|
9
|
-
end
|
10
2
|
|
11
3
|
# Layout: stylsheets and javascripts
|
12
4
|
def surveyor_includes
|
13
5
|
surveyor_stylsheets + surveyor_javascripts
|
14
6
|
end
|
15
7
|
def surveyor_stylsheets
|
16
|
-
stylesheet_link_tag 'surveyor/reset', 'surveyor
|
8
|
+
stylesheet_link_tag 'surveyor/reset', 'surveyor', 'surveyor/ui.theme.css','surveyor/jquery-ui-slider-additions'
|
17
9
|
end
|
18
10
|
def surveyor_javascripts
|
19
11
|
javascript_include_tag 'surveyor/jquery-1.2.6.js', 'surveyor/jquery-ui-personalized-1.5.3.js', 'surveyor/accessibleUISlider.jQuery.js','surveyor/jquery.form.js', 'surveyor/surveyor.js'
|
data/app/models/answer.rb
CHANGED
data/app/models/dependency.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
class DependencyCondition < ActiveRecord::Base
|
2
2
|
|
3
|
-
# Extending surveyor
|
4
|
-
include "#{self.name}Extensions".constantize if Surveyor::Config['extend'].include?(self.name.underscore)
|
5
|
-
|
6
3
|
# Constants
|
7
4
|
OPERATORS = %w(== != < > <= >=) # CONSTANT or @@class_variable when validations listed before class method
|
8
5
|
|
data/app/models/question.rb
CHANGED
data/app/models/response.rb
CHANGED
data/app/models/response_set.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
class ResponseSet < ActiveRecord::Base
|
2
2
|
|
3
|
-
# Extending surveyor
|
4
|
-
include "#{self.name}Extensions".constantize if Surveyor::Config['extend'].include?(self.name.underscore)
|
5
|
-
|
6
3
|
# Associations
|
7
4
|
belongs_to :survey
|
8
5
|
belongs_to :user
|
@@ -28,12 +25,12 @@ class ResponseSet < ActiveRecord::Base
|
|
28
25
|
|
29
26
|
def default_args
|
30
27
|
self.started_at ||= Time.now
|
31
|
-
self.access_code = Surveyor.make_tiny_code
|
28
|
+
self.access_code = Surveyor::Common.make_tiny_code
|
32
29
|
end
|
33
30
|
|
34
31
|
def access_code=(val)
|
35
32
|
while ResponseSet.find_by_access_code(val)
|
36
|
-
val = Surveyor.make_tiny_code
|
33
|
+
val = Surveyor::Common.make_tiny_code
|
37
34
|
end
|
38
35
|
super
|
39
36
|
end
|
data/app/models/survey.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
class Survey < ActiveRecord::Base
|
2
2
|
|
3
|
-
# Extending surveyor
|
4
|
-
include "#{self.name}Extensions".constantize if Surveyor::Config['extend'].include?(self.name.underscore)
|
5
|
-
|
6
3
|
# Associations
|
7
4
|
has_many :sections, :class_name => "SurveySection", :order => 'display_order'
|
8
5
|
has_many :sections_with_questions, :include => :questions, :class_name => "SurveySection", :order => 'display_order'
|
@@ -1,8 +1,5 @@
|
|
1
1
|
class SurveySection < ActiveRecord::Base
|
2
|
-
|
3
|
-
# Extending surveyor
|
4
|
-
include "#{self.name}Extensions".constantize if Surveyor::Config['extend'].include?(self.name.underscore)
|
5
|
-
|
2
|
+
|
6
3
|
# Associations
|
7
4
|
has_many :questions, :order => "display_order ASC"
|
8
5
|
belongs_to :survey
|
data/app/models/validation.rb
CHANGED
data/config/routes.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
ActionController::Routing::Routes.draw do |map|
|
2
|
-
root = Surveyor::Config['default.relative_url_root'] || "surveys"
|
3
|
-
root = (root << "/").gsub(/\/+/, "/")
|
4
2
|
map.with_options :controller => 'surveyor' do |s|
|
5
|
-
s.available_surveys "
|
6
|
-
s.take_survey "
|
7
|
-
s.view_my_survey "
|
8
|
-
s.edit_my_survey "
|
9
|
-
s.update_my_survey "
|
3
|
+
s.available_surveys "surveys", :conditions => {:method => :get}, :action => "new" # GET survey list
|
4
|
+
s.take_survey "surveys/:survey_code", :conditions => {:method => :post}, :action => "create" # Only POST of survey to create
|
5
|
+
s.view_my_survey "surveys/:survey_code/:response_set_code.:format", :conditions => {:method => :get}, :action => "show", :format => "html" # GET viewable/printable? survey
|
6
|
+
s.edit_my_survey "surveys/:survey_code/:response_set_code/take", :conditions => {:method => :get}, :action => "edit" # GET editable survey
|
7
|
+
s.update_my_survey "surveys/:survey_code/:response_set_code", :conditions => {:method => :put}, :action => "update" # PUT edited survey
|
10
8
|
end
|
11
9
|
end
|
data/features/surveyor.feature
CHANGED
@@ -6,14 +6,13 @@ class ExtendSurveyorGenerator < Rails::Generator::Base
|
|
6
6
|
m.file "EXTENDING_SURVEYOR", "surveys/EXTENDING_SURVEYOR"
|
7
7
|
|
8
8
|
# Custom layout
|
9
|
+
m.directory "app/views/layouts"
|
9
10
|
m.file "extensions/surveyor_custom.html.erb", "app/views/layouts/surveyor_custom.html.erb"
|
10
11
|
|
11
12
|
# Model, helper, and controller extensions
|
12
13
|
# http://www.redmine.org/boards/3/topics/4095#message-4136
|
13
14
|
# http://blog.mattwynne.net/2009/07/11/rails-tip-use-polymorphism-to-extend-your-controllers-at-runtime/
|
14
|
-
m.file "extensions/
|
15
|
-
m.file "extensions/surveyor_helper_extensions.rb", "app/helpers/surveyor_helper_extensions.rb"
|
16
|
-
m.file "extensions/surveyor_controller_extensions.rb", "app/controllers/surveyor_controller_extensions.rb"
|
15
|
+
m.file "extensions/surveyor_controller.rb", "app/controllers/surveyor_controller.rb"
|
17
16
|
|
18
17
|
m.readme "EXTENDING_SURVEYOR"
|
19
18
|
|
@@ -1,17 +1,37 @@
|
|
1
|
+
== SurveyorController
|
1
2
|
|
2
|
-
|
3
|
+
The SurveyorController class just includes actions from Surveyor::SurveyorControllerMethods module. You may include your own module, and overwrite the methods or add to them using "super". A template for this customization is in your app/controllers/surveyor\_controller.rb. SurveyorController is "unloadable", so changes in development (and any environment that does not cache classes) will be reflected immediately without restarting the app.
|
3
4
|
|
4
|
-
|
5
|
-
* SurveyorHelper class_eval and instance methods may be modified.
|
6
|
-
* SurveyorController class_eval, class methods, instance methods, and actions can be modified. Action methods should be specified separately in the Actions submodule.
|
5
|
+
== Models
|
7
6
|
|
8
|
-
|
7
|
+
Surveyor's models can all be customized:
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
- answer
|
10
|
+
- dependency_condition
|
11
|
+
- dependency
|
12
|
+
- question_group
|
13
|
+
- question
|
14
|
+
- response_set
|
15
|
+
- response
|
16
|
+
- survey_section
|
17
|
+
- survey
|
18
|
+
- validation_condition
|
19
|
+
- validation
|
15
20
|
|
16
|
-
|
17
|
-
|
21
|
+
For example, create app/models/survey.rb with the following contents:
|
22
|
+
|
23
|
+
class Survey < ActiveRecord::Base
|
24
|
+
def title
|
25
|
+
"Custom #{super}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
== SurveyorHelper
|
30
|
+
|
31
|
+
== Views
|
32
|
+
|
33
|
+
Surveyor's views can be overwritten by simply creating views in app/views/surveyor
|
34
|
+
|
35
|
+
== Layout
|
36
|
+
|
37
|
+
Create a custom SurveyorController as above, and specify your custom layout in it.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module SurveyorControllerCustomMethods
|
2
|
+
def self.included(base)
|
3
|
+
# base.send :before_filter, :require_user # AuthLogic
|
4
|
+
# base.send :before_filter, :login_required # Restful Authentication
|
5
|
+
# base.send :layout, 'surveyor_custom'
|
6
|
+
end
|
7
|
+
|
8
|
+
# Actions
|
9
|
+
def new
|
10
|
+
super
|
11
|
+
# @title = "You can take these surveys"
|
12
|
+
end
|
13
|
+
def create
|
14
|
+
super
|
15
|
+
end
|
16
|
+
def show
|
17
|
+
super
|
18
|
+
end
|
19
|
+
def edit
|
20
|
+
super
|
21
|
+
end
|
22
|
+
def update
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
# Paths
|
27
|
+
def surveyor_index
|
28
|
+
# most of the above actions redirect to this method
|
29
|
+
super # available_surveys_path
|
30
|
+
end
|
31
|
+
def surveyor_finish
|
32
|
+
# the update action redirects to this method if given params[:finish]
|
33
|
+
super # available_surveys_path
|
34
|
+
end
|
35
|
+
end
|
36
|
+
class SurveyorController < ApplicationController
|
37
|
+
include Surveyor::SurveyorControllerMethods
|
38
|
+
include SurveyorControllerCustomMethods
|
39
|
+
end
|
@@ -16,10 +16,6 @@ class SurveyorGenerator < Rails::Generator::Base
|
|
16
16
|
# http://ggr.com/how-to-include-a-gems-rake-tasks-in-your-rails-app.html
|
17
17
|
logger.appended 'Rakefile'
|
18
18
|
end
|
19
|
-
|
20
|
-
# HAML
|
21
|
-
m.file "initializers/surveyor.rb", "config/initializers/surveyor.rb"
|
22
|
-
m.file "initializers/haml.rb", "config/initializers/haml.rb"
|
23
19
|
|
24
20
|
# Migrate
|
25
21
|
# not using m.migration_template because all migration timestamps end up the same, causing a collision when running rake db:migrate
|
@@ -38,10 +34,6 @@ class SurveyorGenerator < Rails::Generator::Base
|
|
38
34
|
m.template("migrate/#{model}.rb", "db/migrate/#{(prev_migration_timestamp || Time.now.utc.strftime("%Y%m%d%H%M%S").to_i + i).to_s}_#{model}.rb")
|
39
35
|
end
|
40
36
|
|
41
|
-
# Generate CSS
|
42
|
-
css_root = File.join(File.dirname(__FILE__), "templates", "assets", "stylesheets")
|
43
|
-
`sass #{css_root}/sass/surveyor.sass #{css_root}/surveyor.css`
|
44
|
-
|
45
37
|
# Assets
|
46
38
|
["images", "javascripts", "stylesheets"].each do |asset_type|
|
47
39
|
m.directory "public/#{asset_type}/surveyor"
|
@@ -49,6 +41,8 @@ class SurveyorGenerator < Rails::Generator::Base
|
|
49
41
|
m.file "assets/#{asset_type}/#{filename}", "public/#{asset_type}/surveyor/#{filename}"
|
50
42
|
end
|
51
43
|
end
|
44
|
+
m.directory "public/stylesheets/sass"
|
45
|
+
m.file "assets/stylesheets/sass/surveyor.sass", "public/stylesheets/sass/surveyor.sass"
|
52
46
|
|
53
47
|
# Surveys
|
54
48
|
m.directory "surveys/fixtures"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Surveyor
|
2
|
+
class Common
|
3
|
+
RAND_CHARS = [('a'..'z'), ('A'..'Z'), (0..9)].map{|r| r.to_a}.flatten.to_s
|
4
|
+
|
5
|
+
def self.make_tiny_code(len = 10)
|
6
|
+
if RUBY_VERSION < "1.8.7"
|
7
|
+
(1..len).to_a.map{|i| RAND_CHARS[rand(RAND_CHARS.size), 1] }.to_s
|
8
|
+
else
|
9
|
+
len.times.map{|i| RAND_CHARS[rand(RAND_CHARS.size), 1] }.to_s
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.to_normalized_string(text)
|
14
|
+
words_to_omit = %w(a be but has have in is it of on or the to when)
|
15
|
+
col_text = text.gsub(/(<[^>]*>)|\n|\t/s, ' ') # Remove html tags
|
16
|
+
col_text.downcase! # Remove capitalization
|
17
|
+
col_text.gsub!(/\"|\'/, '') # Remove potential problem characters
|
18
|
+
col_text.gsub!(/\(.*?\)/,'') # Remove text inside parens
|
19
|
+
col_text.gsub!(/\W/, ' ') # Remove all other non-word characters
|
20
|
+
cols = (col_text.split(' ') - words_to_omit)
|
21
|
+
(cols.size > 5 ? cols[-5..-1] : cols).join("_")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
module Surveyor
|
2
|
+
module SurveyorControllerMethods
|
3
|
+
def self.included(base)
|
4
|
+
base.send :before_filter, :get_current_user, :only => [:new, :create]
|
5
|
+
base.send :layout, 'surveyor_default'
|
6
|
+
end
|
7
|
+
|
8
|
+
# Actions
|
9
|
+
def new
|
10
|
+
@surveys = Survey.find(:all)
|
11
|
+
@title = "You can take these surveys"
|
12
|
+
redirect_to surveyor_index unless surveyor_index == available_surveys_path
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
@survey = Survey.find_by_access_code(params[:survey_code])
|
17
|
+
@response_set = ResponseSet.create(:survey => @survey, :user_id => (@current_user.nil? ? @current_user : @current_user.id))
|
18
|
+
if (@survey && @response_set)
|
19
|
+
flash[:notice] = "Survey was successfully started."
|
20
|
+
redirect_to(edit_my_survey_path(:survey_code => @survey.access_code, :response_set_code => @response_set.access_code))
|
21
|
+
else
|
22
|
+
flash[:notice] = "Unable to find that survey"
|
23
|
+
redirect_to surveyor_index
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def show
|
28
|
+
@response_set = ResponseSet.find_by_access_code(params[:response_set_code], :include => {:responses => [:question, :answer]})
|
29
|
+
if @response_set
|
30
|
+
respond_to do |format|
|
31
|
+
format.html #{render :action => :show}
|
32
|
+
format.csv {
|
33
|
+
send_data(@response_set.to_csv, :type => 'text/csv; charset=utf-8; header=present',:filename => "#{@response_set.updated_at.strftime('%Y-%m-%d')}_#{@response_set.access_code}.csv")
|
34
|
+
}
|
35
|
+
end
|
36
|
+
else
|
37
|
+
flash[:notice] = "Unable to find your responses to the survey"
|
38
|
+
redirect_to surveyor_index
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def edit
|
43
|
+
@response_set = ResponseSet.find_by_access_code(params[:response_set_code], :include => {:responses => [:question, :answer]})
|
44
|
+
if @response_set
|
45
|
+
@survey = Survey.with_sections.find_by_id(@response_set.survey_id)
|
46
|
+
@sections = @survey.sections
|
47
|
+
if params[:section]
|
48
|
+
@section = @sections.with_includes.find(section_id_from(params[:section])) || @sections.with_includes.first
|
49
|
+
else
|
50
|
+
@section = @sections.with_includes.first
|
51
|
+
end
|
52
|
+
@questions = @section.questions
|
53
|
+
@dependents = (@response_set.unanswered_dependencies - @section.questions) || []
|
54
|
+
else
|
55
|
+
flash[:notice] = "Unable to find your responses to the survey"
|
56
|
+
redirect_to surveyor_index
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def update
|
61
|
+
saved = nil
|
62
|
+
ActiveRecord::Base.transaction do
|
63
|
+
if @response_set = ResponseSet.find_by_access_code(params[:response_set_code], :include => {:responses => :answer},:lock => true)
|
64
|
+
@response_set.current_section_id = params[:current_section_id]
|
65
|
+
else
|
66
|
+
flash[:notice] = "Unable to find your responses to the survey"
|
67
|
+
redirect_to(available_surveys_path) and return
|
68
|
+
end
|
69
|
+
|
70
|
+
if params[:responses] or params[:response_groups]
|
71
|
+
@response_set.clear_responses
|
72
|
+
saved = @response_set.update_attributes(:response_attributes => (params[:responses] || {}).dup ,
|
73
|
+
:response_group_attributes => (params[:response_groups] || {}).dup) #copy (dup) to preserve params because we manipulate params in the response_set methods
|
74
|
+
if (saved && params[:finish])
|
75
|
+
@response_set.complete!
|
76
|
+
saved = @response_set.save!
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
respond_to do |format|
|
81
|
+
format.html do
|
82
|
+
if saved && params[:finish]
|
83
|
+
flash[:notice] = "Completed survey"
|
84
|
+
redirect_to surveyor_finish
|
85
|
+
else
|
86
|
+
flash[:notice] = "Unable to update survey" if !saved #and !saved.nil? # saved.nil? is true if there are no questions on the page (i.e. if it only contains a label)
|
87
|
+
redirect_to :action => "edit", :anchor => anchor_from(params[:section]), :params => {:section => section_id_from(params[:section])}
|
88
|
+
end
|
89
|
+
end
|
90
|
+
# No redirect needed if we're talking to the page via json
|
91
|
+
format.js do
|
92
|
+
render :json => @response_set.all_dependencies.to_json
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
# Filters
|
100
|
+
def get_current_user
|
101
|
+
@current_user = self.respond_to?(:current_user) ? self.current_user : nil
|
102
|
+
end
|
103
|
+
|
104
|
+
# Params: the name of some submit buttons store the section we'd like to go to. for repeater questions, an anchor to the repeater group is also stored
|
105
|
+
# e.g. params[:section] = {"1"=>{"question_group_1"=>"<= add row"}}
|
106
|
+
def section_id_from(p)
|
107
|
+
p.respond_to?(:keys) ? p.keys.first : p
|
108
|
+
end
|
109
|
+
|
110
|
+
def anchor_from(p)
|
111
|
+
p.respond_to?(:keys) && p[p.keys.first].respond_to?(:keys) ? p[p.keys.first].keys.first : nil
|
112
|
+
end
|
113
|
+
|
114
|
+
def surveyor_index
|
115
|
+
available_surveys_path
|
116
|
+
end
|
117
|
+
def surveyor_finish
|
118
|
+
available_surveys_path
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -31,3 +31,17 @@ namespace :surveyor do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
34
|
+
|
35
|
+
namespace :spec do
|
36
|
+
namespace :plugins do
|
37
|
+
begin
|
38
|
+
require 'spec/rake/spectask'
|
39
|
+
desc "Runs the examples for surveyor"
|
40
|
+
Spec::Rake::SpecTask.new(:surveyor) do |t|
|
41
|
+
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
42
|
+
t.spec_files = FileList['vendor/plugins/surveyor/spec/**/*_spec.rb']
|
43
|
+
end
|
44
|
+
rescue MissingSourceFile
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
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.
|
8
|
+
s.version = "0.13.0"
|
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{2010-08-
|
12
|
+
s.date = %q{2010-08-23}
|
13
13
|
s.email = %q{yoon@northwestern.edu}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.md"
|
@@ -49,10 +49,8 @@ Gem::Specification.new do |s|
|
|
49
49
|
"features/surveyor.feature",
|
50
50
|
"generators/extend_surveyor/extend_surveyor_generator.rb",
|
51
51
|
"generators/extend_surveyor/templates/EXTENDING_SURVEYOR",
|
52
|
-
"generators/extend_surveyor/templates/extensions/
|
53
|
-
"generators/extend_surveyor/templates/extensions/surveyor_controller_extensions.rb",
|
52
|
+
"generators/extend_surveyor/templates/extensions/surveyor_controller.rb",
|
54
53
|
"generators/extend_surveyor/templates/extensions/surveyor_custom.html.erb",
|
55
|
-
"generators/extend_surveyor/templates/extensions/surveyor_helper_extensions.rb",
|
56
54
|
"generators/surveyor/surveyor_generator.rb",
|
57
55
|
"generators/surveyor/templates/README",
|
58
56
|
"generators/surveyor/templates/assets/images/222222_11x11_icon_arrows_leftright.gif",
|
@@ -105,10 +103,7 @@ Gem::Specification.new do |s|
|
|
105
103
|
"generators/surveyor/templates/assets/stylesheets/jquery-ui-slider-additions.css",
|
106
104
|
"generators/surveyor/templates/assets/stylesheets/reset.css",
|
107
105
|
"generators/surveyor/templates/assets/stylesheets/sass/surveyor.sass",
|
108
|
-
"generators/surveyor/templates/assets/stylesheets/surveyor.css",
|
109
106
|
"generators/surveyor/templates/assets/stylesheets/ui.theme.css",
|
110
|
-
"generators/surveyor/templates/initializers/haml.rb",
|
111
|
-
"generators/surveyor/templates/initializers/surveyor.rb",
|
112
107
|
"generators/surveyor/templates/migrate/add_correct_answer_id_to_questions.rb",
|
113
108
|
"generators/surveyor/templates/migrate/add_display_order_to_surveys.rb",
|
114
109
|
"generators/surveyor/templates/migrate/add_index_to_response_sets.rb",
|
@@ -135,7 +130,9 @@ Gem::Specification.new do |s|
|
|
135
130
|
"lib/fixtures_extensions.rb",
|
136
131
|
"lib/surveyor.rb",
|
137
132
|
"lib/surveyor/acts_as_response.rb",
|
133
|
+
"lib/surveyor/common.rb",
|
138
134
|
"lib/surveyor/config.rb",
|
135
|
+
"lib/surveyor/surveyor_controller_methods.rb",
|
139
136
|
"lib/tasks/surveyor_tasks.rake",
|
140
137
|
"lib/xml_formatter.rb",
|
141
138
|
"rails/init.rb",
|
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:
|
4
|
+
hash: 43
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 13
|
9
|
+
- 0
|
10
|
+
version: 0.13.0
|
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: 2010-08-
|
19
|
+
date: 2010-08-23 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -90,10 +90,8 @@ files:
|
|
90
90
|
- features/surveyor.feature
|
91
91
|
- generators/extend_surveyor/extend_surveyor_generator.rb
|
92
92
|
- generators/extend_surveyor/templates/EXTENDING_SURVEYOR
|
93
|
-
- generators/extend_surveyor/templates/extensions/
|
94
|
-
- generators/extend_surveyor/templates/extensions/surveyor_controller_extensions.rb
|
93
|
+
- generators/extend_surveyor/templates/extensions/surveyor_controller.rb
|
95
94
|
- generators/extend_surveyor/templates/extensions/surveyor_custom.html.erb
|
96
|
-
- generators/extend_surveyor/templates/extensions/surveyor_helper_extensions.rb
|
97
95
|
- generators/surveyor/surveyor_generator.rb
|
98
96
|
- generators/surveyor/templates/README
|
99
97
|
- generators/surveyor/templates/assets/images/222222_11x11_icon_arrows_leftright.gif
|
@@ -146,10 +144,7 @@ files:
|
|
146
144
|
- generators/surveyor/templates/assets/stylesheets/jquery-ui-slider-additions.css
|
147
145
|
- generators/surveyor/templates/assets/stylesheets/reset.css
|
148
146
|
- generators/surveyor/templates/assets/stylesheets/sass/surveyor.sass
|
149
|
-
- generators/surveyor/templates/assets/stylesheets/surveyor.css
|
150
147
|
- generators/surveyor/templates/assets/stylesheets/ui.theme.css
|
151
|
-
- generators/surveyor/templates/initializers/haml.rb
|
152
|
-
- generators/surveyor/templates/initializers/surveyor.rb
|
153
148
|
- generators/surveyor/templates/migrate/add_correct_answer_id_to_questions.rb
|
154
149
|
- generators/surveyor/templates/migrate/add_display_order_to_surveys.rb
|
155
150
|
- generators/surveyor/templates/migrate/add_index_to_response_sets.rb
|
@@ -176,7 +171,9 @@ files:
|
|
176
171
|
- lib/fixtures_extensions.rb
|
177
172
|
- lib/surveyor.rb
|
178
173
|
- lib/surveyor/acts_as_response.rb
|
174
|
+
- lib/surveyor/common.rb
|
179
175
|
- lib/surveyor/config.rb
|
176
|
+
- lib/surveyor/surveyor_controller_methods.rb
|
180
177
|
- lib/tasks/surveyor_tasks.rake
|
181
178
|
- lib/xml_formatter.rb
|
182
179
|
- rails/init.rb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module SurveyExtensions
|
2
|
-
def self.included(base)
|
3
|
-
base.extend(ClassMethods)
|
4
|
-
base.send(:include, InstanceMethods)
|
5
|
-
base.class_eval do
|
6
|
-
# Same as typing in the class
|
7
|
-
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
module ClassMethods
|
12
|
-
end
|
13
|
-
|
14
|
-
module InstanceMethods
|
15
|
-
# def title
|
16
|
-
# foo
|
17
|
-
# end
|
18
|
-
# def foo
|
19
|
-
# "bar"
|
20
|
-
# end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# Add "survey" to config['extend'] array in config/initializers/surveyor.rb to activate these extensions
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module SurveyorControllerExtensions
|
2
|
-
def self.included(base)
|
3
|
-
base.extend(ClassMethods)
|
4
|
-
base.send(:include, InstanceMethods)
|
5
|
-
base.class_eval do
|
6
|
-
# Same as typing in the class
|
7
|
-
# before_filter :pimp_my_ride
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
module ClassMethods
|
12
|
-
end
|
13
|
-
|
14
|
-
module InstanceMethods
|
15
|
-
# def pimp_my_ride
|
16
|
-
# flash[:notice] = "pimped!"
|
17
|
-
# end
|
18
|
-
end
|
19
|
-
|
20
|
-
module Actions
|
21
|
-
# Redefine the controller actions [index, new, create, show, update] here
|
22
|
-
# def new
|
23
|
-
# render :text =>"surveys are down"
|
24
|
-
# end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# Add "surveyor_controller" to config['extend'] array in config/initializers/surveyor.rb to activate these extensions
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module SurveyorHelperExtensions
|
2
|
-
def self.included(base) # :nodoc:
|
3
|
-
base.send(:include, InstanceMethods)
|
4
|
-
base.class_eval do
|
5
|
-
# Same as typing in the module
|
6
|
-
# alias_method_chain :question_number_helper, :sauce
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
module InstanceMethods
|
11
|
-
# def question_number_helper_with_sauce(number)
|
12
|
-
# question_number_helper_without_sauce(number) + "Extra sauce"
|
13
|
-
# end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
# Add "surveyor_helper" to config['extend'] array in config/initializers/surveyor.rb to activate these extensions
|
@@ -1,230 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
background-color: #dcdcdc;
|
3
|
-
font-family: Helvetica;
|
4
|
-
word-spacing: normal;
|
5
|
-
text-align: left;
|
6
|
-
letter-spacing: 0;
|
7
|
-
line-height: 1.1em;
|
8
|
-
font-size: 1em; }
|
9
|
-
|
10
|
-
#flash {
|
11
|
-
background-color: transparent;
|
12
|
-
color: red;
|
13
|
-
width: 98%;
|
14
|
-
position: absolute;
|
15
|
-
top: 0;
|
16
|
-
left: 0;
|
17
|
-
z-index: 1000;
|
18
|
-
text-align: center; }
|
19
|
-
|
20
|
-
#surveyor {
|
21
|
-
width: 960px;
|
22
|
-
padding: 1em;
|
23
|
-
margin: 0 auto;
|
24
|
-
background-color: #fffff4;
|
25
|
-
color: #213e00; }
|
26
|
-
#surveyor #survey_list ul {
|
27
|
-
padding-left: 2em;
|
28
|
-
margin-top: -2em; }
|
29
|
-
#surveyor #menu {
|
30
|
-
width: 11.9em;
|
31
|
-
margin: 0.65em -1em 0 0;
|
32
|
-
float: right; }
|
33
|
-
#surveyor #menu ul {
|
34
|
-
padding: 0;
|
35
|
-
margin: 0;
|
36
|
-
list-style-type: none;
|
37
|
-
border-style: solid;
|
38
|
-
border-width: 1px;
|
39
|
-
border-color: #bcbcbc;
|
40
|
-
border-bottom-width: 0;
|
41
|
-
border-right-width: 0;
|
42
|
-
background-color: #dcdcdc;
|
43
|
-
color: #666666; }
|
44
|
-
#surveyor #menu ul li {
|
45
|
-
border-bottom-style: solid;
|
46
|
-
border-bottom-width: 1px;
|
47
|
-
border-color: #bcbcbc; }
|
48
|
-
#surveyor #menu ul li.active, #surveyor #menu ul li.active input[type="submit"] {
|
49
|
-
background-color: #ebebcc;
|
50
|
-
color: #262626; }
|
51
|
-
#surveyor #header {
|
52
|
-
font-family: "Century Gothic";
|
53
|
-
padding: 0.5em 1em 1em 0.3em;
|
54
|
-
margin: 0;
|
55
|
-
font-size: 2em;
|
56
|
-
font-weight: bolid; }
|
57
|
-
#surveyor .previous_section {
|
58
|
-
font-size: 0.8em;
|
59
|
-
margin: -0.6em 0 0.5em -1em;
|
60
|
-
padding: 0; }
|
61
|
-
#surveyor .previous_section input {
|
62
|
-
background-color: #fffff4; }
|
63
|
-
#surveyor .next_section {
|
64
|
-
float: right;
|
65
|
-
margin: -2em 1em 0 0; }
|
66
|
-
#surveyor .survey_section {
|
67
|
-
margin: 0.5em 0.5em 0.5em -1em;
|
68
|
-
padding: 0.5em 0 0 0; }
|
69
|
-
#surveyor .survey_section .title {
|
70
|
-
font-weight: bold;
|
71
|
-
font-size: 1.2em;
|
72
|
-
margin: 0;
|
73
|
-
padding: 0.3em 0.5em 0.1em 1.4em;
|
74
|
-
background-color: #ebebcc; }
|
75
|
-
#surveyor p {
|
76
|
-
padding: 0.3em;
|
77
|
-
margin: 0.5em;
|
78
|
-
margin: 0.55em; }
|
79
|
-
#surveyor input[type="submit"] {
|
80
|
-
font-size: 1.0em;
|
81
|
-
border: 0px;
|
82
|
-
padding: 0.2em;
|
83
|
-
margin: 0.2em;
|
84
|
-
cursor: pointer;
|
85
|
-
background-color: #dcdcdc;
|
86
|
-
color: #464646; }
|
87
|
-
#surveyor input[type="text"], #surveyor textarea {
|
88
|
-
border: 2px inset #333;
|
89
|
-
border-color: #bcbcbc;
|
90
|
-
background-color: #fafafa;
|
91
|
-
padding: 0.1em;
|
92
|
-
margin: 0.1em;
|
93
|
-
font-size: 0.8em; }
|
94
|
-
#surveyor .disabled {
|
95
|
-
color: #dfdfd4; }
|
96
|
-
#surveyor .disabled input[type="text"], #surveyor .disabled textarea {
|
97
|
-
background-color: #efefe4; }
|
98
|
-
#surveyor input[type="submit"].add_row {
|
99
|
-
padding: 0.1em;
|
100
|
-
margin: 0em;
|
101
|
-
margin-left: -1em;
|
102
|
-
font-size: 0.7em;
|
103
|
-
border: 1px solid #333;
|
104
|
-
border-color: #bcbcbc; }
|
105
|
-
#surveyor .questions {
|
106
|
-
margin: 0;
|
107
|
-
padding: 1em 0.3em; }
|
108
|
-
#surveyor .question {
|
109
|
-
margin: 0 0 0.6em 0;
|
110
|
-
padding: 0.2em; }
|
111
|
-
#surveyor .question legend {
|
112
|
-
width: 940px;
|
113
|
-
white-space: normal; }
|
114
|
-
#surveyor .question legend span {
|
115
|
-
display: block; }
|
116
|
-
#surveyor .question .number {
|
117
|
-
padding: 0.2em;
|
118
|
-
font-weight: bold;
|
119
|
-
font-size: 1.2em;
|
120
|
-
letter-spacing: 0;
|
121
|
-
float: left; }
|
122
|
-
#surveyor .question .text {
|
123
|
-
padding-top: 0.2em;
|
124
|
-
font-size: 1.1em;
|
125
|
-
line-height: 1.2em; }
|
126
|
-
#surveyor .question .help {
|
127
|
-
font-size: 0.8em;
|
128
|
-
font-style: italic;
|
129
|
-
color: black;
|
130
|
-
display: none; }
|
131
|
-
#surveyor ol.answers {
|
132
|
-
list-style-type: none;
|
133
|
-
padding: 0.2em;
|
134
|
-
margin: 0 0 0.3em 1.5em; }
|
135
|
-
#surveyor ol.answers li.answer {
|
136
|
-
margin: 0.2em; }
|
137
|
-
#surveyor ol.answers_inline {
|
138
|
-
margin-left: 1.8em;
|
139
|
-
list-style-type: none; }
|
140
|
-
#surveyor ol.answers_inline li {
|
141
|
-
display: inline;
|
142
|
-
padding-right: 1.5em; }
|
143
|
-
#surveyor .label {
|
144
|
-
padding: 0.5em 1em;
|
145
|
-
margin: 0.5em 1em;
|
146
|
-
line-height: 1.4em; }
|
147
|
-
#surveyor #dependents {
|
148
|
-
background-color: #dfdfd4; }
|
149
|
-
#surveyor #dependents .title {
|
150
|
-
padding: 0.5em;
|
151
|
-
font-weight: bold; }
|
152
|
-
#surveyor .dependent {
|
153
|
-
background-color: #dfdfd4;
|
154
|
-
margin-left: 1.2em; }
|
155
|
-
#surveyor .hidden {
|
156
|
-
display: none; }
|
157
|
-
#surveyor .column_highlight {
|
158
|
-
background-color: #efefe4; }
|
159
|
-
#surveyor table.grid {
|
160
|
-
margin: 0.5em 0.2em 0.5em 1em; }
|
161
|
-
#surveyor table.grid th, #surveyor table.grid td {
|
162
|
-
padding: 0.2em 0.5em;
|
163
|
-
text-align: center; }
|
164
|
-
#surveyor table.grid td {
|
165
|
-
border-bottom: 2px dotted #999;
|
166
|
-
border-color: #bfbfb4; }
|
167
|
-
#surveyor table.grid th.question_prefix, #surveyor table.grid th.question_postfix {
|
168
|
-
padding: 0.2em 0.5em;
|
169
|
-
text-align: left;
|
170
|
-
padding: 0.2em; }
|
171
|
-
#surveyor .question_group {
|
172
|
-
margin: 0 0 0.6em 0;
|
173
|
-
padding: 0.2em 0.2em 1em 0.2em; }
|
174
|
-
#surveyor .question_group .head {
|
175
|
-
padding-bottom: 0.5em; }
|
176
|
-
#surveyor .question_group .head .number {
|
177
|
-
padding: 0.2em;
|
178
|
-
font-weight: bold;
|
179
|
-
font-size: 1.2em;
|
180
|
-
letter-spacing: 0;
|
181
|
-
float: left; }
|
182
|
-
#surveyor .question_group .head .text {
|
183
|
-
padding-top: 0.2em;
|
184
|
-
font-size: 1.1em;
|
185
|
-
line-height: 1.2em; }
|
186
|
-
#surveyor .question_group .head .help {
|
187
|
-
font-size: 0.8em;
|
188
|
-
font-style: italic;
|
189
|
-
color: black; }
|
190
|
-
#surveyor .question_group ul {
|
191
|
-
padding: 0.3em;
|
192
|
-
list-style-type: none; }
|
193
|
-
#surveyor .question_group ul li {
|
194
|
-
display: inline; }
|
195
|
-
#surveyor .question_group ul li .question {
|
196
|
-
display: inline; }
|
197
|
-
#surveyor .question_group ul li .question ol.answers {
|
198
|
-
display: inline;
|
199
|
-
margin: 0.2em; }
|
200
|
-
#surveyor .question_group ul.repeater {
|
201
|
-
list-style-type: none; }
|
202
|
-
#surveyor .question_group li.repeater {
|
203
|
-
display: block;
|
204
|
-
clear: left; }
|
205
|
-
#surveyor .question_group li.repeater .question {
|
206
|
-
float: left; }
|
207
|
-
#surveyor .question_group li.repeater ol {
|
208
|
-
margin: 0;
|
209
|
-
padding: 0; }
|
210
|
-
#surveyor .question_group li.repeater .question {
|
211
|
-
padding-left: 1.2em; }
|
212
|
-
#surveyor .inline {
|
213
|
-
display: inline; }
|
214
|
-
#surveyor .group_questions {
|
215
|
-
margin: 0.5em 0.2em 0.5em 1em; }
|
216
|
-
#surveyor .group_questions .question {
|
217
|
-
margin: 0;
|
218
|
-
padding: 0em 0.3em; }
|
219
|
-
#surveyor .group_questions .text {
|
220
|
-
font-size: 0.9em; }
|
221
|
-
#surveyor .group_questions .help {
|
222
|
-
font-size: 0.7em;
|
223
|
-
font-style: italic;
|
224
|
-
color: black; }
|
225
|
-
#surveyor .group_questions .number {
|
226
|
-
padding: 0.2em;
|
227
|
-
margin: 0 0 0.3em 0;
|
228
|
-
font-weight: bold;
|
229
|
-
font-size: 1em;
|
230
|
-
letter-spacing: 0; }
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Loaded once. Restart your app (even in development) to apply changes made here
|
2
|
-
Surveyor::Config.run do |config|
|
3
|
-
config['default.relative_url_root'] = nil # "surveys"
|
4
|
-
config['default.title'] = nil # "You can take these surveys:"
|
5
|
-
config['default.layout'] = nil # "surveyor_default"
|
6
|
-
config['default.index'] = nil # "/surveys" # or :index_path_method
|
7
|
-
config['default.finish'] = nil # "/surveys" # or :finish_path_method
|
8
|
-
config['use_restful_authentication'] = false # set to true to use restful authentication
|
9
|
-
config['extend'] = %w() # %w(survey surveyor_helper surveyor_controller)
|
10
|
-
end
|