diff --git a/app/assets/javascripts/survey.js b/app/assets/javascripts/survey.js
index e266e46..5bc2d49 100644
--- a/app/assets/javascripts/survey.js
+++ b/app/assets/javascripts/survey.js
@@ -149,10 +149,11 @@ function onQuestionTypeChanged ( $fieldType, _val ){
$fieldType.fadeOut(300);
} else {
$fieldType.fadeIn(300);
+
if(_val < 5) {
$fieldType.find('.rgl, hr').addClass('hide').siblings('.allow').removeClass('hide');
} else {
- $fieldType.find('.rgl, hr').removeClass('hide').siblings('.allow').addClass('hide');
+ $fieldType.find('.rgl, hr').removeClass('hide').siblings('.allow').removeClass('hide');
}
};
}
diff --git a/app/controllers/surveys_controller.rb b/app/controllers/surveys_controller.rb
index 83e13c7..a8d1efb 100644
--- a/app/controllers/surveys_controller.rb
+++ b/app/controllers/surveys_controller.rb
@@ -159,6 +159,11 @@ class SurveysController < ApplicationController
@answer_model.errors.add question.title, t('survey_question.required_error')
end
end
+ if question.custom_option
+ unless answer[oid]["custom_group_field"].blank?
+ @answer_model[qid]["#{oid}_custom_group_field"] = answer[oid]["custom_group_field"]
+ end
+ end
end
individual_total << t
end
diff --git a/app/models/survey_question_radiogroup.rb b/app/models/survey_question_radiogroup.rb
index 05d4fcf..1c582e9 100644
--- a/app/models/survey_question_radiogroup.rb
+++ b/app/models/survey_question_radiogroup.rb
@@ -2,6 +2,6 @@ class SurveyQuestionRadiogroup
include Mongoid::Document
field :name, :localize => true
-
+
embedded_in :survey_question
end
\ No newline at end of file
diff --git a/app/views/admin/surveys/_index.html.erb b/app/views/admin/surveys/_index.html.erb
index 19e4135..8731df0 100644
--- a/app/views/admin/surveys/_index.html.erb
+++ b/app/views/admin/surveys/_index.html.erb
@@ -40,11 +40,12 @@
<%= (survey.postdate) ? (format_value survey.postdate) : t(:no_deadline) %> |
<%= (survey.deadline) ? (format_value survey.deadline) : t(:no_deadline) %> |
- <% if survey.needs_login %>
- <%= survey.survey_answers.count %>
- <% else %>
- <%= survey.survey_answers.count %>
- <% end %>
+ <%= survey.survey_answers.count %>
+ <%# if survey.needs_login %>
+
+ <%# else %>
+ <%#= survey.survey_answers.count %>
+ <%# end %>
|
<%= survey.update_user.user_name rescue ''%> |
diff --git a/app/views/admin/surveys/answer_set.html.erb b/app/views/admin/surveys/answer_set.html.erb
index 47b351e..d27b871 100644
--- a/app/views/admin/surveys/answer_set.html.erb
+++ b/app/views/admin/surveys/answer_set.html.erb
@@ -69,7 +69,11 @@
<% sq.survey_question_options.each do |sqo| %>
<% if !@survey_answer[sq.id.to_s].nil? %>
- <%= sqo.name %> : <%= @survey_answer[sq.id.to_s][sqo.id.to_s] %>
+ <% if sq.custom_option %>
+ <%= @survey_answer[sq.id.to_s]["#{sqo.id}_custom_group_field"].blank? ? sqo.name : @survey_answer[sq.id.to_s]["#{sqo.id}_custom_group_field"] %> : <%= @survey_answer[sq.id.to_s][sqo.id.to_s] %>
+ <% else %>
+ <%= sqo.name %> : <%= @survey_answer[sq.id.to_s][sqo.id.to_s] %>
+ <% end %>
<% end %>
<% end %>
diff --git a/app/views/admin/surveys/answer_sets.html.erb b/app/views/admin/surveys/answer_sets.html.erb
index 027f2a8..ac0da0b 100644
--- a/app/views/admin/surveys/answer_sets.html.erb
+++ b/app/views/admin/surveys/answer_sets.html.erb
@@ -15,9 +15,9 @@
<% if !user.nil? %>
<%= user.name %> |
<% else %>
- |
+ NA |
<% end %>
- <%= sa.created_at.strftime("%y-%M-%d %h:%m") rescue nil %> |
+ <%= sa.created_at.strftime("%h %d, %Y - %H:%M") rescue nil %> |
<%= t("survey.view_answers") %> |
<% end %>
diff --git a/app/views/surveys/show.html.erb b/app/views/surveys/show.html.erb
index 2b0d0c3..65dd450 100644
--- a/app/views/surveys/show.html.erb
+++ b/app/views/surveys/show.html.erb
@@ -106,6 +106,9 @@
|
+ <% if question.custom_option %>
+ |
+ <% end %>
<% question.survey_question_radiogroups.each do |radiogroup| %>
<%= radiogroup.name %>
@@ -119,6 +122,13 @@
|
<%= option.name %>
|
+ <% if question.custom_option %>
+ <%= f.fields_for "#{option.id}" do |oid| %>
+
+ <%= oid.text_field "custom_group_field" %>
+ |
+ <% end %>
+ <% end %>
<% question.survey_question_radiogroups.each do |radiogroup| %>
<%= rgf.radio_button option.id, radiogroup.id %>
@@ -147,8 +157,8 @@
|