surveyor 0.14.1 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -0
- data/VERSION +1 -1
- data/app/controllers/results_controller.rb +12 -0
- data/app/helpers/results_helper.rb +20 -0
- data/app/views/layouts/results.html.erb +13 -0
- data/app/views/partials/_question.html.haml +2 -0
- data/app/views/results/index.html.erb +17 -0
- data/app/views/results/show.html.erb +25 -0
- data/config/routes.rb +5 -0
- data/features/surveyor.feature +1 -1
- data/generators/surveyor/templates/assets/stylesheets/results.css +125 -0
- data/generators/surveyor/templates/locales/surveyor_en.yml +5 -4
- data/generators/surveyor/templates/locales/surveyor_he.yml +4 -3
- data/lib/surveyor/surveyor_controller_methods.rb +5 -5
- data/surveyor.gemspec +7 -1
- metadata +9 -3
data/README.md
CHANGED
@@ -114,6 +114,13 @@ To work on the plugin code (for enhancements, and bug fixes, etc...) fork this g
|
|
114
114
|
|
115
115
|
# Changes
|
116
116
|
|
117
|
+
0.14.2
|
118
|
+
|
119
|
+
* lowercase localization. feature instead of story in cucumber feature
|
120
|
+
* add results section
|
121
|
+
* add simple admin section for displaying survey result set
|
122
|
+
* Added manual numbering to labels as well
|
123
|
+
|
117
124
|
0.14.1
|
118
125
|
|
119
126
|
* typo in repeaters - use survey\_section\_id instead of section\_id
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.14.
|
1
|
+
0.14.2
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class ResultsController < ApplicationController
|
2
|
+
layout 'results'
|
3
|
+
def index
|
4
|
+
@surveys = Survey.all
|
5
|
+
end
|
6
|
+
|
7
|
+
def show
|
8
|
+
@survey = Survey.find(params[:id])
|
9
|
+
@response_sets = @survey.response_sets
|
10
|
+
@questions = SurveySection.find_by_survey_id(params[:id]).questions
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ResultsHelper
|
2
|
+
def display_response(r_set,question)
|
3
|
+
sets = r_set.responses.select{|r| r.question.display_order == question.display_order}
|
4
|
+
if sets.size == 0
|
5
|
+
return "-"
|
6
|
+
elsif sets.size == 1
|
7
|
+
return (sets.first.string_value || sets.first.text_value || show_answer(sets.first))
|
8
|
+
else
|
9
|
+
txt = ""
|
10
|
+
sets.each do |set|
|
11
|
+
txt << show_answer(set) + "<br/>"
|
12
|
+
end
|
13
|
+
return txt
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def show_answer(set)
|
18
|
+
set.answer.text
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
6
|
+
<title>Survey: Result Sets</title>
|
7
|
+
<%= surveyor_includes %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id="flash"><%= flash[:notice] %></div>
|
11
|
+
<%= yield %>
|
12
|
+
</body>
|
13
|
+
</html>
|
@@ -2,6 +2,8 @@
|
|
2
2
|
- case renderer
|
3
3
|
- when :label
|
4
4
|
- div_for question, :class => "label #{question.css_class(response_set)}" do
|
5
|
+
- if question.survey_section.survey.manual_numbering
|
6
|
+
.number= question.number||' '
|
5
7
|
%span.text= question.text
|
6
8
|
%span.help= question.help_text
|
7
9
|
- when :image
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h1>Listing Surveys</h1>
|
2
|
+
|
3
|
+
<table class="list_table">
|
4
|
+
<tr>
|
5
|
+
<th>ID</th>
|
6
|
+
<th>Name</th>
|
7
|
+
<th>Operation</th>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<% @surveys.each do |survey| -%>
|
11
|
+
<tr>
|
12
|
+
<td><%=h survey.id %></td>
|
13
|
+
<td><%=h survey.title %></td>
|
14
|
+
<td><%= link_to "show results list(#{survey.response_sets.count})", show_one_survey_results_path(survey) %></td>
|
15
|
+
</tr>
|
16
|
+
<% end %>
|
17
|
+
</table>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<table class="list_table">
|
2
|
+
<tr>
|
3
|
+
<th>ID</th>
|
4
|
+
<th>Code</th>
|
5
|
+
<% @questions.each do |question| %>
|
6
|
+
<% next if question.display_order == 1 %>
|
7
|
+
<th><%= "[" +question.display_order.to_s + "]" + question.text %></th>
|
8
|
+
<% end %>
|
9
|
+
</tr>
|
10
|
+
|
11
|
+
<% @response_sets.each do |r_set| %>
|
12
|
+
<tr>
|
13
|
+
<td><%=h r_set.id %></td>
|
14
|
+
<td><%=h r_set.access_code %></td>
|
15
|
+
<% @questions.each do |question| %>
|
16
|
+
<% next if question.display_order == 1 %>
|
17
|
+
<td><%= display_response(r_set,question) %></td>
|
18
|
+
<% end %>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
22
|
+
|
23
|
+
<br />
|
24
|
+
|
25
|
+
<%= link_to "Back", admin_results_path %>
|
data/config/routes.rb
CHANGED
@@ -5,5 +5,10 @@ ActionController::Routing::Routes.draw do |map|
|
|
5
5
|
s.view_my_survey "surveys/:survey_code/:response_set_code.:format", :conditions => {:method => :get}, :action => "show", :format => "html" # GET viewable/printable? survey
|
6
6
|
s.edit_my_survey "surveys/:survey_code/:response_set_code/take", :conditions => {:method => :get}, :action => "edit" # GET editable survey
|
7
7
|
s.update_my_survey "surveys/:survey_code/:response_set_code", :conditions => {:method => :put}, :action => "update" # PUT edited survey
|
8
|
+
end
|
9
|
+
|
10
|
+
map.with_options :controller => 'results' do |r|
|
11
|
+
r.show_surveys_result_lists "surveys/results", :conditions => {:method => :get}, :action => "index"
|
12
|
+
r.show_one_survey_results "surveys/:id/result", :conditions => {:method => :get}, :action => "show"
|
8
13
|
end
|
9
14
|
end
|
data/features/surveyor.feature
CHANGED
@@ -0,0 +1,125 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
.fieldWithErrors {
|
20
|
+
padding: 2px;
|
21
|
+
background-color: red;
|
22
|
+
display: table;
|
23
|
+
}
|
24
|
+
|
25
|
+
#errorExplanation {
|
26
|
+
width: 400px;
|
27
|
+
border: 2px solid red;
|
28
|
+
padding: 7px;
|
29
|
+
padding-bottom: 12px;
|
30
|
+
margin-bottom: 20px;
|
31
|
+
background-color: #f0f0f0;
|
32
|
+
}
|
33
|
+
|
34
|
+
#errorExplanation h2 {
|
35
|
+
text-align: left;
|
36
|
+
font-weight: bold;
|
37
|
+
padding: 5px 5px 5px 15px;
|
38
|
+
font-size: 12px;
|
39
|
+
margin: -7px;
|
40
|
+
background-color: #c00;
|
41
|
+
color: #fff;
|
42
|
+
}
|
43
|
+
|
44
|
+
#errorExplanation p {
|
45
|
+
color: #333;
|
46
|
+
margin-bottom: 0;
|
47
|
+
padding: 5px;
|
48
|
+
}
|
49
|
+
|
50
|
+
#errorExplanation ul li {
|
51
|
+
font-size: 12px;
|
52
|
+
list-style: square;
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
textarea, .preview {
|
58
|
+
width: 310px;
|
59
|
+
height: 360px;
|
60
|
+
}
|
61
|
+
.preview {
|
62
|
+
border: #abc 1px dotted;
|
63
|
+
padding: 3px;
|
64
|
+
}
|
65
|
+
|
66
|
+
.bluebox { padding:10px; border:1px solid #577BBF; background-color:#E6EDFF; }
|
67
|
+
input[type=submit] {
|
68
|
+
padding: 3px 7px;
|
69
|
+
font-weight: bold;
|
70
|
+
}
|
71
|
+
|
72
|
+
.list_table{width:100%;border-collapse: collapse;empty-cells: show;}
|
73
|
+
.list_table th{font: bold 12px Verdana, sans-serif; color: #fff;padding: 5px 15px 5px 5px;border: solid 1px #A0BDE4;background-color: #577BBF;}
|
74
|
+
.list_table tr td {border-collapse: collapse;padding: 5px 4px;color: #333;font-family: Verdana, sans-serif;font-size: 12px;border: 1px solid #DCE7F1;}
|
75
|
+
.list_table tr { background-color: #FFF; }
|
76
|
+
.list_table tr.even { background-color:#F2F5FB;}
|
77
|
+
.list_table tr:hover { background-color: #FDFCEA;}
|
78
|
+
.list_table tr.group td {background-color: #eee;font-weight:bold;font-size:13px;}
|
79
|
+
.list_table .border2px{border-left:2px solid #DCE7F1;}
|
80
|
+
.list_table a{padding:0 5px;}
|
81
|
+
.list_table th.asc{background:#577BBF url(../images/idp_views/arrow_down.gif) no-repeat right;}
|
82
|
+
.list_table th.desc{background:#577BBF url(../images/idp_views/arrow_up.gif) no-repeat right;}
|
83
|
+
.list_table th a{color:white;text-decoration:underline;}
|
84
|
+
.list_table .group{text-align:center;background:#f3f3f3;border-top:1px dotted #586A7E;border-bottom:1px dotted #586A7E;}
|
85
|
+
.list_table .group_top{border-top:1px dotted #586A7E;}
|
86
|
+
.list_table .group_bottom{border-bottom:1px dotted #586A7E;}
|
87
|
+
.list_table_page{padding:5px;text-align:center;}
|
88
|
+
.list_table_page form{display:inline}
|
89
|
+
|
90
|
+
.list_table1 {width:100%;border-collapse: collapse;empty-cells: show;}
|
91
|
+
.list_table1 th{ font: bold 12px Verdana, sans-serif; color: #577BBF; padding:3px 5px; background-color:#F2F5FB; border: 1px solid #DCE7F1; }
|
92
|
+
.list_table1 tr td {border-collapse: collapse;padding: 2px;color: #333;font-family: Verdana, sans-serif;font-size: 10px;border: 1px solid #DCE7F1;}
|
93
|
+
.list_table1 tr { background-color: #FFF; }
|
94
|
+
.list_table1 tr:hover { background-color: #FDFCEA;}
|
95
|
+
|
96
|
+
.legend_table { border-top: 1px solid #DCE7F1; border-bottom: 1px solid #DCE7F1; padding:1px 0; }
|
97
|
+
|
98
|
+
.list_table2 { width:100%; empty-cells: show; border-collapse:collapse;}
|
99
|
+
.list_table2 th{ font: bold 12px Verdana; padding:5px; text-align:left; background-color:#FFF;}
|
100
|
+
.list_table2 tr td { border-collapse:collapse; padding: 0px 3px; font-family: Verdana, sans-serif;font-size: 10px; border:1px solid #FFF; }
|
101
|
+
.list_table2 a:link { text-decoration:underline; color:#03F;}
|
102
|
+
.list_table2 a:visited { text-decoration:underline; color:#03F; }
|
103
|
+
.list_table2 a:hover { text-decoration:none; color:#03F; }
|
104
|
+
|
105
|
+
.list_table3{width:100%;border-collapse: collapse;empty-cells: show; margin:5px 0;}
|
106
|
+
.list_table3 th{font: bold 12px Arial; color: #fff;padding: 3px;border: solid 1px #A0BDE4;background-color: #577BBF;}
|
107
|
+
.list_table3 tr td { border-collapse: collapse;padding: 5px 2px; font-family: Arial;font-size: 11px;border: 1px solid #DCE7F1; line-height:1.2em;}
|
108
|
+
.list_table3 tr { background-color: #FFF;}
|
109
|
+
.list_table3 tr.even { background-color:#F2F5FB;}
|
110
|
+
.list_table3 tr:hover { background-color: #FDFCEA;}
|
111
|
+
|
112
|
+
.list_table4{ border-collapse: collapse;empty-cells: show;}
|
113
|
+
.list_table4 th{font: bold 11px Arial; padding: 3px; text-align:left; background-color:#F2F5FB; border: 1px solid #DCE7F1; color:#577BBF;}
|
114
|
+
.list_table4 tr td { border-collapse: collapse;padding: 0px 3px; font-family: Arial;font-size: 10px;border: 1px solid #DCE7F1;}
|
115
|
+
.list_table4 tr { background-color: #FFF; }
|
116
|
+
.list_table4 tr.even { background-color:#F2F5FB;}
|
117
|
+
.list_table4 tr:hover { background-color: #FDFCEA;}
|
118
|
+
|
119
|
+
.list_table5 { width:100%; empty-cells: show; border-collapse:collapse; margin:5px 0;}
|
120
|
+
.list_table5 th{ font: bold 12px Verdana; padding:5px; text-align:left; background-color:#FFF;}
|
121
|
+
.list_table5 tr td { border-collapse:collapse; padding: 5px; font-family: Verdana, sans-serif;font-size: 12px; }
|
122
|
+
.list_table5 a:link { text-decoration:underline; color:#03F;}
|
123
|
+
.list_table5 a:visited { text-decoration:underline; color:#03F; }
|
124
|
+
.list_table5 a:hover { text-decoration:none; color:#03F; }
|
125
|
+
|
@@ -5,11 +5,12 @@ en:
|
|
5
5
|
surveyor:
|
6
6
|
take_these_surveys: "You may take these surveys"
|
7
7
|
take_it: "Take it"
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
completed_survey: "Completed survey"
|
9
|
+
unable_to_find_your_responses: "Unable to find your responses to the survey"
|
10
|
+
unable_to_update_survey: "Unable to update survey"
|
11
|
+
unable_to_find_that_survey: "Unable to find that survey"
|
11
12
|
survey_started_success: "Survey started successfully"
|
12
13
|
click_here_to_finish: "Click here to finish"
|
13
14
|
previous_section: "« Previous section"
|
14
15
|
next_section: "Next section »"
|
15
|
-
|
16
|
+
select_one: "Select one ..."
|
@@ -5,9 +5,10 @@ he:
|
|
5
5
|
surveyor:
|
6
6
|
take_these_surveys: "תוכלו לבצע סקרים אלו"
|
7
7
|
take_it: "בצע"
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
completed_survey: "סיום הסקר"
|
9
|
+
unable_to_find_your_responses: "לא נמצאו תשובותיך לסקר"
|
10
|
+
unable_to_update_survey: ""
|
11
|
+
unable_to_find_that_survey: "לא ניתן לאתר את הסקר המבוקש"
|
11
12
|
survey_started_success: "הסקר הוחל בהצלחה"
|
12
13
|
click_here_to_finish: "לסיום"
|
13
14
|
previous_section: "חזרה »"
|
@@ -35,7 +35,7 @@ module Surveyor
|
|
35
35
|
}
|
36
36
|
end
|
37
37
|
else
|
38
|
-
flash[:notice] = t('surveyor.
|
38
|
+
flash[:notice] = t('surveyor.unable_to_find_your_responses')
|
39
39
|
redirect_to surveyor_index
|
40
40
|
end
|
41
41
|
end
|
@@ -53,7 +53,7 @@ module Surveyor
|
|
53
53
|
@questions = @section.questions
|
54
54
|
@dependents = (@response_set.unanswered_dependencies - @section.questions) || []
|
55
55
|
else
|
56
|
-
flash[:notice] = t('surveyor.
|
56
|
+
flash[:notice] = t('surveyor.unable_to_find_your_responses')
|
57
57
|
redirect_to surveyor_index
|
58
58
|
end
|
59
59
|
end
|
@@ -64,7 +64,7 @@ module Surveyor
|
|
64
64
|
if @response_set = ResponseSet.find_by_access_code(params[:response_set_code], :include => {:responses => :answer},:lock => true)
|
65
65
|
@response_set.current_section_id = params[:current_section_id]
|
66
66
|
else
|
67
|
-
flash[:notice] = t('surveyor.
|
67
|
+
flash[:notice] = t('surveyor.unable_to_find_your_responses')
|
68
68
|
redirect_to(available_surveys_path) and return
|
69
69
|
end
|
70
70
|
|
@@ -81,10 +81,10 @@ module Surveyor
|
|
81
81
|
respond_to do |format|
|
82
82
|
format.html do
|
83
83
|
if saved && params[:finish]
|
84
|
-
flash[:notice] = t('surveyor.
|
84
|
+
flash[:notice] = t('surveyor.completed_survey')
|
85
85
|
redirect_to surveyor_finish
|
86
86
|
else
|
87
|
-
flash[:notice] = t('surveyor.
|
87
|
+
flash[:notice] = t('surveyor.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)
|
88
88
|
redirect_to :action => "edit", :anchor => anchor_from(params[:section]), :params => {:section => section_id_from(params[:section])}
|
89
89
|
end
|
90
90
|
end
|
data/surveyor.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{surveyor}
|
8
|
-
s.version = "0.14.
|
8
|
+
s.version = "0.14.2"
|
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"]
|
@@ -20,7 +20,9 @@ Gem::Specification.new do |s|
|
|
20
20
|
"README.md",
|
21
21
|
"Rakefile",
|
22
22
|
"VERSION",
|
23
|
+
"app/controllers/results_controller.rb",
|
23
24
|
"app/controllers/surveyor_controller.rb",
|
25
|
+
"app/helpers/results_helper.rb",
|
24
26
|
"app/helpers/survey_form_builder.rb",
|
25
27
|
"app/helpers/surveyor_helper.rb",
|
26
28
|
"app/models/answer.rb",
|
@@ -35,11 +37,14 @@ Gem::Specification.new do |s|
|
|
35
37
|
"app/models/survey_section_sweeper.rb",
|
36
38
|
"app/models/validation.rb",
|
37
39
|
"app/models/validation_condition.rb",
|
40
|
+
"app/views/layouts/results.html.erb",
|
38
41
|
"app/views/layouts/surveyor_default.html.erb",
|
39
42
|
"app/views/partials/_answer.html.haml",
|
40
43
|
"app/views/partials/_question.html.haml",
|
41
44
|
"app/views/partials/_question_group.html.haml",
|
42
45
|
"app/views/partials/_section.html.haml",
|
46
|
+
"app/views/results/index.html.erb",
|
47
|
+
"app/views/results/show.html.erb",
|
43
48
|
"app/views/surveyor/edit.html.haml",
|
44
49
|
"app/views/surveyor/new.html.haml",
|
45
50
|
"app/views/surveyor/show.html.haml",
|
@@ -107,6 +112,7 @@ Gem::Specification.new do |s|
|
|
107
112
|
"generators/surveyor/templates/assets/javascripts/surveyor.js",
|
108
113
|
"generators/surveyor/templates/assets/stylesheets/jquery-ui-slider-additions.css",
|
109
114
|
"generators/surveyor/templates/assets/stylesheets/reset.css",
|
115
|
+
"generators/surveyor/templates/assets/stylesheets/results.css",
|
110
116
|
"generators/surveyor/templates/assets/stylesheets/sass/surveyor.sass",
|
111
117
|
"generators/surveyor/templates/assets/stylesheets/ui.theme.css",
|
112
118
|
"generators/surveyor/templates/locales/surveyor_en.yml",
|
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: 35
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 14
|
9
|
-
-
|
10
|
-
version: 0.14.
|
9
|
+
- 2
|
10
|
+
version: 0.14.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Chamberlain
|
@@ -61,7 +61,9 @@ files:
|
|
61
61
|
- README.md
|
62
62
|
- Rakefile
|
63
63
|
- VERSION
|
64
|
+
- app/controllers/results_controller.rb
|
64
65
|
- app/controllers/surveyor_controller.rb
|
66
|
+
- app/helpers/results_helper.rb
|
65
67
|
- app/helpers/survey_form_builder.rb
|
66
68
|
- app/helpers/surveyor_helper.rb
|
67
69
|
- app/models/answer.rb
|
@@ -76,11 +78,14 @@ files:
|
|
76
78
|
- app/models/survey_section_sweeper.rb
|
77
79
|
- app/models/validation.rb
|
78
80
|
- app/models/validation_condition.rb
|
81
|
+
- app/views/layouts/results.html.erb
|
79
82
|
- app/views/layouts/surveyor_default.html.erb
|
80
83
|
- app/views/partials/_answer.html.haml
|
81
84
|
- app/views/partials/_question.html.haml
|
82
85
|
- app/views/partials/_question_group.html.haml
|
83
86
|
- app/views/partials/_section.html.haml
|
87
|
+
- app/views/results/index.html.erb
|
88
|
+
- app/views/results/show.html.erb
|
84
89
|
- app/views/surveyor/edit.html.haml
|
85
90
|
- app/views/surveyor/new.html.haml
|
86
91
|
- app/views/surveyor/show.html.haml
|
@@ -148,6 +153,7 @@ files:
|
|
148
153
|
- generators/surveyor/templates/assets/javascripts/surveyor.js
|
149
154
|
- generators/surveyor/templates/assets/stylesheets/jquery-ui-slider-additions.css
|
150
155
|
- generators/surveyor/templates/assets/stylesheets/reset.css
|
156
|
+
- generators/surveyor/templates/assets/stylesheets/results.css
|
151
157
|
- generators/surveyor/templates/assets/stylesheets/sass/surveyor.sass
|
152
158
|
- generators/surveyor/templates/assets/stylesheets/ui.theme.css
|
153
159
|
- generators/surveyor/templates/locales/surveyor_en.yml
|