surveyor_gui 0.0.3 → 0.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/README.md +22 -2
- data/app/controllers/surveyor_gui/answers_controller.rb +3 -0
- data/app/controllers/surveyor_gui/application_controller.rb +3 -0
- data/app/controllers/{dependencys_controller.rb → surveyor_gui/dependencys_controller.rb} +5 -5
- data/app/controllers/{question_groups_controller.rb → surveyor_gui/question_groups_controller.rb} +13 -7
- data/app/controllers/{questions_controller.rb → surveyor_gui/questions_controller.rb} +6 -6
- data/app/controllers/surveyor_gui/reports_controller.rb +6 -6
- data/app/controllers/surveyor_gui/responses_controller.rb +3 -1
- data/app/controllers/surveyor_gui/survey_controller.rb +1 -1
- data/app/controllers/{survey_sections_controller.rb → surveyor_gui/survey_sections_controller.rb} +5 -5
- data/app/controllers/{surveyforms_controller.rb → surveyor_gui/surveyforms_controller.rb} +1 -1
- data/app/controllers/{surveyor_controller.rb → surveyor_gui/surveyor_controller.rb} +2 -2
- data/app/helpers/surveyor_gui/application_helper.rb +2 -0
- data/app/helpers/{dependency_helper.rb → surveyor_gui/dependencys_helper.rb} +1 -1
- data/app/helpers/surveyor_gui/question_groups_helper.rb +3 -0
- data/app/helpers/{question_helper.rb → surveyor_gui/questions_helper.rb} +1 -1
- data/app/helpers/surveyor_gui/{report_helper.rb → reports_helper.rb} +1 -1
- data/app/helpers/surveyor_gui/surveyforms_helper.rb +160 -0
- data/app/helpers/{surveyor_helper.rb → surveyor_gui/surveyor_helper.rb} +1 -1
- data/app/models/question_group_tracker.rb +19 -0
- data/app/views/layouts/{application.html.erb → surveyor_gui/application.html.erb} +0 -0
- data/app/views/layouts/{surveyor_gui_blank.html.erb → surveyor_gui/surveyor_gui_blank.html.erb} +1 -0
- data/app/views/layouts/{surveyor_gui_default.html.erb → surveyor_gui/surveyor_gui_default.html.erb} +1 -0
- data/app/views/layouts/{surveyor_modified.html.erb → surveyor_gui/surveyor_modified.html.erb} +0 -0
- data/app/views/{dependencys → surveyor_gui/dependencys}/_column.html.erb +0 -0
- data/app/views/{dependencys → surveyor_gui/dependencys}/_dependency.html.erb +0 -0
- data/app/views/{dependencys → surveyor_gui/dependencys}/_dependency_condition_fields.html.erb +0 -0
- data/app/views/{dependencys → surveyor_gui/dependencys}/_form.html.erb +0 -0
- data/app/views/{dependencys → surveyor_gui/dependencys}/blank.html.erb +0 -0
- data/app/views/{dependencys → surveyor_gui/dependencys}/edit.html.erb +0 -0
- data/app/views/{dependencys → surveyor_gui/dependencys}/new.html.erb +0 -0
- data/app/views/{partials → surveyor_gui/partials}/_answer.html.haml +0 -0
- data/app/views/{partials → surveyor_gui/partials}/_question.html.haml +0 -0
- data/app/views/{partials → surveyor_gui/partials}/_question_group.html.haml +0 -0
- data/app/views/{partials → surveyor_gui/partials}/_section.html.haml +0 -0
- data/app/views/surveyor_gui/partials/_url_helpers.html.erb +5 -0
- data/app/views/{question_groups → surveyor_gui/question_groups}/_form.html.erb +2 -1
- data/app/views/{question_groups → surveyor_gui/question_groups}/_group_inline_field.html.erb +0 -0
- data/app/views/{question_groups → surveyor_gui/question_groups}/_group_inline_fields.html.erb +0 -0
- data/app/views/{question_groups → surveyor_gui/question_groups}/blank.html.erb +0 -0
- data/app/views/{question_groups → surveyor_gui/question_groups}/edit.html.erb +0 -0
- data/app/views/{question_groups → surveyor_gui/question_groups}/new.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/_answer_fields.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/_answer_options.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/_form.html.erb +2 -1
- data/app/views/{questions → surveyor_gui/questions}/_grid_dropdown_columns.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/_grid_dropdown_fields.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/_grid_fields.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/_no_picks.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/_pick.html +0 -0
- data/app/views/{questions → surveyor_gui/questions}/_picks.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/blank.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/edit.html.erb +0 -0
- data/app/views/{questions → surveyor_gui/questions}/new.html.erb +0 -0
- data/app/views/surveyor_gui/responses/_survey_results.html.haml +1 -1
- data/app/views/surveyor_gui/responses/index.html.haml +1 -1
- data/app/views/surveyor_gui/shared/_report_data.html.haml +17 -14
- data/app/views/{survey_sections → surveyor_gui/survey_sections}/_form.html.erb +0 -0
- data/app/views/{survey_sections → surveyor_gui/survey_sections}/blank.html.erb +0 -0
- data/app/views/{survey_sections → surveyor_gui/survey_sections}/edit.html.erb +0 -0
- data/app/views/{survey_sections → surveyor_gui/survey_sections}/new.html.erb +0 -0
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/_form.html.erb +4 -4
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/_question_field.html.erb +0 -0
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/_question_group.html.erb +14 -14
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/_question_group_fields.html.erb +0 -0
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/_question_name_and_number.html.erb +0 -0
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/_question_section.html.erb +0 -0
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/_question_wrapper.html.erb +14 -15
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/_survey_section_fields.html.erb +11 -12
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/clone_survey.html.erb +0 -0
- data/app/views/surveyor_gui/surveyforms/edit.html.erb +5 -0
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/index.html.erb +2 -2
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/new.html.erb +0 -0
- data/app/views/{surveyforms → surveyor_gui/surveyforms}/show.html.erb +0 -0
- data/config/routes.rb +20 -22
- data/lib/assets/javascripts/surveyor_gui/surveyor_gui.js +25 -14
- data/lib/assets/stylesheets/surveyor_gui/surveyor_gui.sass +2 -0
- data/lib/generators/surveyor_gui/install_generator.rb +1 -1
- data/lib/generators/surveyor_gui/templates/app/views/layouts/{surveyor_gui_default.html.erb → surveyor_gui/surveyor_gui_default.html.erb} +1 -0
- data/lib/surveyor_gui/engine.rb +2 -1
- data/lib/surveyor_gui/models/response_set_methods.rb +2 -1
- data/lib/surveyor_gui/surveyforms_controller_methods.rb +1 -1
- data/lib/surveyor_gui/version.rb +1 -1
- data/spec/controllers/surveyforms_controller_spec.rb +10 -9
- data/spec/features/create_survey_spec.rb +2 -3
- data/spec/features/dependencies_spec.rb +1 -1
- data/spec/support/surveyforms_creation_helpers.rb +4 -4
- data/spec/views/questions/edit.html.erb_spec.rb +4 -3
- data/spec/views/surveyforms/edit.html.erb_spec.rb +1 -1
- metadata +71 -67
- data/app/controllers/answers_controller.rb +0 -3
- data/app/controllers/application_controller.rb +0 -3
- data/app/helpers/application_helper.rb +0 -2
- data/app/helpers/surveyform_helper.rb +0 -179
- data/app/views/surveyforms/edit.html.erb +0 -5
|
File without changes
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
<%= link_to "Edit", edit_surveyform_path(survey) %> 
|
|
25
25
|
<%= link_to "Clone", clone_survey_surveyform_path(survey) %> 
|
|
26
26
|
<%= link_to "Destroy", survey, data: { confirm: 'Are you sure?' }, :method => :delete %>
|
|
27
|
-
<%= link_to "Run Report",
|
|
28
|
-
<%= link_to "View Responses" ,
|
|
27
|
+
<%= link_to "Run Report", report_path(survey) %>
|
|
28
|
+
<%= link_to "View Responses" , responses_path(id: survey) %></td>
|
|
29
29
|
</tr>
|
|
30
30
|
<% end %>
|
|
31
31
|
</table>
|
|
File without changes
|
|
File without changes
|
data/config/routes.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
SurveyorGui::Engine.routes.draw do
|
|
2
2
|
|
|
3
3
|
resources :surveyforms do
|
|
4
4
|
member do
|
|
@@ -28,16 +28,17 @@ Rails.application.routes.draw do
|
|
|
28
28
|
member do
|
|
29
29
|
get 'cut'
|
|
30
30
|
end
|
|
31
|
+
collection do
|
|
32
|
+
get 'render_answer_fields_partial'
|
|
33
|
+
get 'render_grid_partial'
|
|
34
|
+
get 'render_group_inline_partial'
|
|
35
|
+
get 'render_no_picks_partial'
|
|
36
|
+
end
|
|
31
37
|
end
|
|
32
38
|
|
|
33
39
|
resources :question_groups do
|
|
34
40
|
end
|
|
35
41
|
|
|
36
|
-
get '/question/render_answer_fields_partial', :to => 'questions#render_answer_fields_partial'
|
|
37
|
-
get '/question/render_grid_partial', :to => 'questions#render_grid_partial'
|
|
38
|
-
get '/question_group/render_group_inline_partial', :to => 'question_groups#render_group_inline_partial'
|
|
39
|
-
get '/question/render_no_picks_partial', :to => 'questions#render_no_picks_partial'
|
|
40
|
-
|
|
41
42
|
resources :dependencys do
|
|
42
43
|
collection do
|
|
43
44
|
get 'get_answers'
|
|
@@ -47,25 +48,22 @@ Rails.application.routes.draw do
|
|
|
47
48
|
end
|
|
48
49
|
get '/dependency/render_dependency_conditions_partial', :to => 'dependencys#render_dependency_conditions_partial'
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
'show_pdf'] do
|
|
56
|
-
member do
|
|
57
|
-
get 'show'
|
|
58
|
-
get 'preview'
|
|
59
|
-
get 'show_pdf'
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
resources :survey, only: ['show'] do
|
|
63
|
-
end
|
|
64
|
-
resources :responses, only: ['show', 'index', 'preview'] do
|
|
51
|
+
resources :reports,
|
|
52
|
+
:only=>[
|
|
53
|
+
'show',
|
|
54
|
+
'preview',
|
|
55
|
+
'show_pdf'] do
|
|
65
56
|
member do
|
|
57
|
+
get 'show'
|
|
66
58
|
get 'preview'
|
|
59
|
+
get 'show_pdf'
|
|
67
60
|
end
|
|
68
61
|
end
|
|
62
|
+
resources :survey, only: ['show'] do
|
|
63
|
+
end
|
|
64
|
+
resources :responses, only: ['show', 'index', 'preview'] do
|
|
65
|
+
member do
|
|
66
|
+
get 'preview'
|
|
67
|
+
end
|
|
69
68
|
end
|
|
70
|
-
|
|
71
69
|
end
|
|
@@ -11,6 +11,13 @@ function application_js_code(){
|
|
|
11
11
|
// this function is added to jQuery, it allows access to the readylist
|
|
12
12
|
// it works for jQuery 1.3.2, it might break on future versions
|
|
13
13
|
// if (!Modernizr.input.required) {
|
|
14
|
+
surveyor_gui_mount_point = $("#surveyor_gui_mount_point").data("surveyor_gui_mount_point");
|
|
15
|
+
if (surveyor_gui_mount_point.length==0){
|
|
16
|
+
surveyor_gui_mount_point="/";
|
|
17
|
+
} else {
|
|
18
|
+
surveyor_gui_mount_point= surveyor_gui_mount_point.replace(/surveyforms/i, "");
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
$.ajaxSetup({
|
|
15
22
|
headers: {
|
|
16
23
|
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
|
|
@@ -446,9 +453,10 @@ function application_js_code(){
|
|
|
446
453
|
};
|
|
447
454
|
|
|
448
455
|
$.fn.render_no_picks_partial = function (){
|
|
456
|
+
var render_no_picks_partial_url = $('#no_picks_partial_url').data("render_no_picks_partial_url");
|
|
449
457
|
here = $(this)
|
|
450
458
|
$.get(
|
|
451
|
-
"
|
|
459
|
+
render_no_picks_partial_url + "?id="+ $(this).closest('.questions').find('input#question_id').val(),
|
|
452
460
|
function(data){
|
|
453
461
|
here.html(data);
|
|
454
462
|
}
|
|
@@ -457,6 +465,7 @@ function application_js_code(){
|
|
|
457
465
|
|
|
458
466
|
$.fn.render_answer_fields_partial = function (add_row){
|
|
459
467
|
here = $(this);
|
|
468
|
+
var answer_fields_partial_url = $("#answer_fields_partial_url").data("answer_fields_partial_url");
|
|
460
469
|
if (add_row === true) {
|
|
461
470
|
var option = "&add_row=true";
|
|
462
471
|
}
|
|
@@ -464,7 +473,7 @@ function application_js_code(){
|
|
|
464
473
|
option = ' ';
|
|
465
474
|
}
|
|
466
475
|
$.get(
|
|
467
|
-
"
|
|
476
|
+
answer_fields_partial_url + "?id=" + $(this).closest('.questions').find('input#question_id').val() + option,
|
|
468
477
|
function(data){
|
|
469
478
|
if (add_row == true) {
|
|
470
479
|
data = replace_idx($(".question_answers_text"),"answers", data)
|
|
@@ -481,9 +490,10 @@ function application_js_code(){
|
|
|
481
490
|
|
|
482
491
|
$.fn.render_grid_fields_partial = function (question_type, index){
|
|
483
492
|
here = $(this);
|
|
493
|
+
var render_grid_partial_url = $("#render_grid_partial_url").data("render_grid_partial_url");
|
|
484
494
|
index = typeof index !== 'undefined' ? index : null;
|
|
485
495
|
$.get(
|
|
486
|
-
"
|
|
496
|
+
render_grid_partial_url + "?id="
|
|
487
497
|
+ $(this).closest('.questions').find('input#question_id').val()
|
|
488
498
|
+ "&question_type_id="+question_type
|
|
489
499
|
+ "&index=" + parseInt(index)
|
|
@@ -510,7 +520,7 @@ function application_js_code(){
|
|
|
510
520
|
}
|
|
511
521
|
else
|
|
512
522
|
var question_clause = "/new";
|
|
513
|
-
window.location.href = "
|
|
523
|
+
window.location.href = surveyor_gui_mount_point+"questions"+question_clause +"?survey_section_id="+
|
|
514
524
|
survey_section_id+"&text="+text+
|
|
515
525
|
"&display_order="+display_order +
|
|
516
526
|
"&question_type_id="+question_type_id;
|
|
@@ -531,7 +541,7 @@ function application_js_code(){
|
|
|
531
541
|
else
|
|
532
542
|
var question_group_clause = "/new";
|
|
533
543
|
|
|
534
|
-
window.location.href = "
|
|
544
|
+
window.location.href = surveyor_gui_mount_point+"question_groups"+question_group_clause+"?survey_section_id="+
|
|
535
545
|
survey_section_id+"&text="+text+
|
|
536
546
|
"&display_order="+display_order +
|
|
537
547
|
"&question_id="+question_id +
|
|
@@ -541,6 +551,7 @@ function application_js_code(){
|
|
|
541
551
|
|
|
542
552
|
$.fn.render_group_inline_fields_partial = function (add_row){
|
|
543
553
|
here = $(this);
|
|
554
|
+
var render_group_inline_partial_url = $("render_group_inline_partial_url").data("render_group_inline_partial_url");
|
|
544
555
|
var survey_section_id = $('input#question_group_survey_section_id').val();
|
|
545
556
|
if (add_row === true) {
|
|
546
557
|
var option = "&add_row=true";
|
|
@@ -552,7 +563,7 @@ function application_js_code(){
|
|
|
552
563
|
var display_order = (this).closest('.questions').find('input[id$="display_order"]').last().val();
|
|
553
564
|
display_order = parseInt(display_order) + 1;
|
|
554
565
|
$.get(
|
|
555
|
-
"
|
|
566
|
+
render_group_inline_partial_url + "?id="
|
|
556
567
|
+ last_question.val() +
|
|
557
568
|
"&display_order=" + display_order +
|
|
558
569
|
option,
|
|
@@ -729,7 +740,7 @@ function application_js_code(){
|
|
|
729
740
|
option = ' ';
|
|
730
741
|
}
|
|
731
742
|
$.get(
|
|
732
|
-
"
|
|
743
|
+
surveyor_gui_mount_point+"dependency/render_dependency_conditions_partial?id=" + $(this).data('question_id') +
|
|
733
744
|
"&dependency_id=" + $(this).data('dependency_id') + option,
|
|
734
745
|
function(data){
|
|
735
746
|
if (add_row === true) {
|
|
@@ -1012,7 +1023,7 @@ function application_js_code(){
|
|
|
1012
1023
|
function update_dependency_questions() {
|
|
1013
1024
|
$('.question_logic_notifier').closest('div.question').each(function(){
|
|
1014
1025
|
var id = $(this).closest('div.question').attr('id').match(/\d+/)[0]
|
|
1015
|
-
$.get("
|
|
1026
|
+
$.get(surveyor_gui_mount_point+"surveyforms/0/replace_question?question_id="+id,
|
|
1016
1027
|
{},
|
|
1017
1028
|
function(response) {
|
|
1018
1029
|
$("#question_"+id).html(replace_idx($("#question_"+id),"questions", response));
|
|
@@ -1050,7 +1061,7 @@ function application_js_code(){
|
|
|
1050
1061
|
complete: function(request){
|
|
1051
1062
|
$('#survey_section').effect('highlight');
|
|
1052
1063
|
},
|
|
1053
|
-
url: '
|
|
1064
|
+
url: surveyor_gui_mount_point+'survey_sections/sort'})
|
|
1054
1065
|
}
|
|
1055
1066
|
});
|
|
1056
1067
|
|
|
@@ -1092,7 +1103,7 @@ function application_js_code(){
|
|
|
1092
1103
|
$('#survey_section').effect('highlight');
|
|
1093
1104
|
update_question_numbers();
|
|
1094
1105
|
},
|
|
1095
|
-
url: '/questions/sort'
|
|
1106
|
+
url: surveyor_gui_mount_point+'/questions/sort'
|
|
1096
1107
|
})
|
|
1097
1108
|
}
|
|
1098
1109
|
});
|
|
@@ -1301,7 +1312,7 @@ function application_js_code(){
|
|
|
1301
1312
|
.datepicker({
|
|
1302
1313
|
duration: 'fast',
|
|
1303
1314
|
showOn: 'both',
|
|
1304
|
-
buttonImage: '
|
|
1315
|
+
buttonImage: '/../../assets/datepicker.gif',
|
|
1305
1316
|
buttonImageOnly: true
|
|
1306
1317
|
});
|
|
1307
1318
|
$("input.datetime_picker")
|
|
@@ -1322,7 +1333,7 @@ function application_js_code(){
|
|
|
1322
1333
|
|
|
1323
1334
|
$.fn.determine_dependency_question_type = function () {
|
|
1324
1335
|
var target = $(this);
|
|
1325
|
-
$.get('
|
|
1336
|
+
$.get(surveyor_gui_mount_point+'dependencys/get_question_type',
|
|
1326
1337
|
'question_id='+$(this).val(),
|
|
1327
1338
|
function(data){
|
|
1328
1339
|
show_dependency_value(data,target);
|
|
@@ -1339,7 +1350,7 @@ function application_js_code(){
|
|
|
1339
1350
|
$(this).closest("tr").find('[id*="dependency_attributes_dependency_conditions_attributes"][id$="_id"]').val();
|
|
1340
1351
|
$(this).closest('tr').find('[id*="dependency_attributes_dependency_conditions_attributes"][id$="answer_id"]')
|
|
1341
1352
|
.load(
|
|
1342
|
-
'
|
|
1353
|
+
surveyor_gui_mount_point+'dependencys/get_answers',
|
|
1343
1354
|
'question_id='+question_id +
|
|
1344
1355
|
'&dependency_condition_id='+dependency_condition_id +
|
|
1345
1356
|
'&column_id='+column_id
|
|
@@ -1352,7 +1363,7 @@ function application_js_code(){
|
|
|
1352
1363
|
$(this).closest("tr").find('[id*="dependency_attributes_dependency_conditions_attributes"][id$="_id"]').val();
|
|
1353
1364
|
column.closest('.column_id').show()
|
|
1354
1365
|
$.get(
|
|
1355
|
-
'
|
|
1366
|
+
surveyor_gui_mount_point+'dependencys/get_columns',
|
|
1356
1367
|
'question_id='+question_id +
|
|
1357
1368
|
'&dependency_condition_id='+dependency_condition_id,
|
|
1358
1369
|
function(data){
|
data/lib/surveyor_gui/engine.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'haml' # required for view resolution
|
|
|
4
4
|
|
|
5
5
|
module SurveyorGui
|
|
6
6
|
class Engine < Rails::Engine
|
|
7
|
+
isolate_namespace SurveyorGui
|
|
7
8
|
root = File.expand_path('../../', __FILE__)
|
|
8
9
|
config.autoload_paths << root
|
|
9
10
|
|
|
@@ -17,7 +18,7 @@ module SurveyorGui
|
|
|
17
18
|
Dir.glob(root + "app/facades/*.rb").each do |c|
|
|
18
19
|
require_dependency(c)
|
|
19
20
|
end
|
|
20
|
-
c = Dir.glob(File.expand_path('../',root)+'/app/controllers/surveyor_controller.rb').first
|
|
21
|
+
c = Dir.glob(File.expand_path('../',root)+'/app/controllers/surveyor_gui/surveyor_controller.rb').first
|
|
21
22
|
require_dependency(c)
|
|
22
23
|
Dir.glob(File.expand_path('../',root)+'/app/models/*.rb').each do |c|
|
|
23
24
|
require_dependency(c)
|
|
@@ -35,10 +35,11 @@ module SurveyorGui
|
|
|
35
35
|
|
|
36
36
|
def report_user_name
|
|
37
37
|
user_name = nil
|
|
38
|
+
fake_users = {'0'=>'Bob', '-1'=>'Kishore','-2'=>'Tina','-3'=>'Xiao','-4'=>'Marshal','-5'=>'Lana','-6'=>'Demarius','-7'=>'Taylor','-8'=>'Cameron','-9'=>'Clio'}
|
|
38
39
|
if class_exists?('ResponseSetUser')
|
|
39
40
|
user_name = ResponseSetUser.new(self.user_id).report_user_name
|
|
40
41
|
end
|
|
41
|
-
user_name || self.user_id || self.id
|
|
42
|
+
user_name || fake_users[self.user_id.to_s] || self.id
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
private
|
data/lib/surveyor_gui/version.rb
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
2
2
|
|
|
3
|
-
describe SurveyformsController do
|
|
3
|
+
describe SurveyorGui::SurveyformsController do
|
|
4
4
|
include Surveyor::Engine.routes.url_helpers
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
include SurveyorGui::Engine.routes.url_helpers
|
|
6
|
+
before do
|
|
7
|
+
self.routes = SurveyorGui::Engine.routes
|
|
8
|
+
end
|
|
8
9
|
|
|
9
10
|
let!(:survey) { FactoryGirl.create(:survey, :title => "Alphabet", :access_code => "alpha", :survey_version => 0)}
|
|
10
11
|
let!(:survey_beta) { FactoryGirl.create(:survey, :title => "Alphabet", :access_code => "alpha", :survey_version => 1)}
|
|
@@ -106,7 +107,7 @@ describe SurveyformsController do
|
|
|
106
107
|
|
|
107
108
|
it "returns to the edit page" do
|
|
108
109
|
do_post(:title=>'New surv')
|
|
109
|
-
expect(response).to redirect_to(
|
|
110
|
+
expect(response).to redirect_to(edit_surveyform_path(assigns(:surveyform).id))
|
|
110
111
|
end
|
|
111
112
|
|
|
112
113
|
it "resets question_no to 0" do
|
|
@@ -133,7 +134,7 @@ describe SurveyformsController do
|
|
|
133
134
|
context "when sections are valid" do
|
|
134
135
|
it "redirects to the edit page" do
|
|
135
136
|
do_post @survey_with_sections
|
|
136
|
-
expect(response).to redirect_to(
|
|
137
|
+
expect(response).to redirect_to(edit_surveyform_path(assigns(:surveyform).id))
|
|
137
138
|
end
|
|
138
139
|
end
|
|
139
140
|
|
|
@@ -191,7 +192,7 @@ describe SurveyformsController do
|
|
|
191
192
|
|
|
192
193
|
it "redirects to index" do
|
|
193
194
|
do_put(:id=>survey.id,:surveyform=>{:id=>survey.id})
|
|
194
|
-
expect(response).to redirect_to(
|
|
195
|
+
expect(response).to redirect_to(surveyforms_path)
|
|
195
196
|
end
|
|
196
197
|
|
|
197
198
|
end
|
|
@@ -238,7 +239,7 @@ describe SurveyformsController do
|
|
|
238
239
|
|
|
239
240
|
it "successfully destroys the survey" do
|
|
240
241
|
do_delete
|
|
241
|
-
expect(response).to redirect_to(
|
|
242
|
+
expect(response).to redirect_to(surveyforms_path)
|
|
242
243
|
expect(Survey.exists?(survey_with_no_responses.id)).to be_false
|
|
243
244
|
end
|
|
244
245
|
end
|
|
@@ -250,7 +251,7 @@ describe SurveyformsController do
|
|
|
250
251
|
|
|
251
252
|
it "fails to delete the survey" do
|
|
252
253
|
do_delete
|
|
253
|
-
expect(response).to redirect_to(
|
|
254
|
+
expect(response).to redirect_to(surveyforms_path)
|
|
254
255
|
expect(Survey.exists?(survey_with_responses.id)).to be_true
|
|
255
256
|
end
|
|
256
257
|
|
|
@@ -8,7 +8,6 @@ feature "User creates a new survey using a browser", %q{
|
|
|
8
8
|
As a user
|
|
9
9
|
I want to create a new survey using a browser
|
|
10
10
|
So that I don't have to learn the Surveyor DSL or dive into technical weeds} do
|
|
11
|
-
|
|
12
11
|
#force a cr/lf to make the output look better
|
|
13
12
|
scenario " " do
|
|
14
13
|
end
|
|
@@ -16,7 +15,7 @@ feature "User creates a new survey using a browser", %q{
|
|
|
16
15
|
context "User has not yet started a new survey" do
|
|
17
16
|
scenario "User starts a new survey" do
|
|
18
17
|
#Given I'm on the surveyform web page
|
|
19
|
-
visit surveyforms_path
|
|
18
|
+
visit surveyor_gui.surveyforms_path
|
|
20
19
|
|
|
21
20
|
#When I click "New Survey"
|
|
22
21
|
click_link "New Survey"
|
|
@@ -27,7 +26,7 @@ feature "User creates a new survey using a browser", %q{
|
|
|
27
26
|
|
|
28
27
|
scenario "User gives the survey a title" do
|
|
29
28
|
#Given I'm on the "Create New Survey" page
|
|
30
|
-
visit new_surveyform_path
|
|
29
|
+
visit surveyor_gui.new_surveyform_path
|
|
31
30
|
|
|
32
31
|
#When I fill in a title
|
|
33
32
|
fill_in "Title", with: "How was Boston?"
|
|
@@ -23,7 +23,7 @@ feature "User creates a dependency using browser", %q{
|
|
|
23
23
|
|
|
24
24
|
scenario "user creates a dependency", js: true do
|
|
25
25
|
#Given I have a survey with two questions
|
|
26
|
-
visit surveyforms_path
|
|
26
|
+
visit surveyor_gui.surveyforms_path
|
|
27
27
|
expect(page).to have_content("Hotel ratings")
|
|
28
28
|
within "tr", text: "Hotel ratings" do
|
|
29
29
|
click_link "Edit"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module SurveyFormsCreationHelpers
|
|
2
2
|
module CreateSurvey
|
|
3
3
|
def start_a_new_survey
|
|
4
|
-
visit new_surveyform_path
|
|
4
|
+
visit surveyor_gui.new_surveyform_path
|
|
5
5
|
fill_in "Title", with: "How was Boston?"
|
|
6
6
|
click_button "Save Changes"
|
|
7
7
|
end
|
|
@@ -64,7 +64,7 @@ module SurveyFormsCreationHelpers
|
|
|
64
64
|
module BuildASurvey
|
|
65
65
|
def build_a_survey
|
|
66
66
|
#Given I'm on the "Create New Survey" page
|
|
67
|
-
visit new_surveyform_path
|
|
67
|
+
visit surveyor_gui.new_surveyform_path
|
|
68
68
|
|
|
69
69
|
title_the_survey
|
|
70
70
|
title_the_first_section
|
|
@@ -89,14 +89,14 @@ module SurveyFormsCreationHelpers
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def build_a_three_question_survey
|
|
92
|
-
visit new_surveyform_path
|
|
92
|
+
visit surveyor_gui.new_surveyform_path
|
|
93
93
|
title_the_survey
|
|
94
94
|
question_maker = QuestionsFactory.new
|
|
95
95
|
question_maker.make_question(3){|text| add_a_text_question(text)}
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def build_a_three_section_survey
|
|
99
|
-
visit new_surveyform_path
|
|
99
|
+
visit surveyor_gui.new_surveyform_path
|
|
100
100
|
title_the_survey
|
|
101
101
|
title_the_first_section ("Unique Section 1")
|
|
102
102
|
add_a_new_section("Unique Section 2")
|