added custom fields for radio group and added to answer sets. now answer sets can be viewed also for login not required surveys
This commit is contained in:
parent
5c03cf68d0
commit
730d6b896a
|
@ -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');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -40,11 +40,12 @@
|
|||
<td><%= (survey.postdate) ? (format_value survey.postdate) : t(:no_deadline) %></td>
|
||||
<td><%= (survey.deadline) ? (format_value survey.deadline) : t(:no_deadline) %></td>
|
||||
<td>
|
||||
<% if survey.needs_login %>
|
||||
<a href="/admin/surveys/<%=survey.id.to_s%>/answer_sets"> <%= survey.survey_answers.count %></a>
|
||||
<% else %>
|
||||
<%= survey.survey_answers.count %>
|
||||
<% end %>
|
||||
<a href="/admin/surveys/<%=survey.id.to_s%>/answer_sets"> <%= survey.survey_answers.count %></a>
|
||||
<%# if survey.needs_login %>
|
||||
<!-- <a href="/admin/surveys/<%=survey.id.to_s%>/answer_sets"> <%#= survey.survey_answers.count %></a> -->
|
||||
<%# else %>
|
||||
<%#= survey.survey_answers.count %>
|
||||
<%# end %>
|
||||
</td>
|
||||
<td><%= survey.update_user.user_name rescue ''%></td>
|
||||
</tr>
|
||||
|
|
|
@ -69,7 +69,11 @@
|
|||
<div class="radiogroup">
|
||||
<% 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] %> <br />
|
||||
<% 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] %> <br />
|
||||
<% else %>
|
||||
<%= sqo.name %> : <%= @survey_answer[sq.id.to_s][sqo.id.to_s] %> <br />
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
<% if !user.nil? %>
|
||||
<td><%= user.name %></td>
|
||||
<% else %>
|
||||
<td> </td>
|
||||
<td>NA</td>
|
||||
<% end %>
|
||||
<td><%= sa.created_at.strftime("%y-%M-%d %h:%m") rescue nil %></td>
|
||||
<td><%= sa.created_at.strftime("%h %d, %Y - %H:%M") rescue nil %></td>
|
||||
<td><a href="/admin/surveys/<%= sa.id.to_s %>/answer_set"><%= t("survey.view_answers") %></a></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -106,6 +106,9 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<% if question.custom_option %>
|
||||
<th></th>
|
||||
<% end %>
|
||||
<% question.survey_question_radiogroups.each do |radiogroup| %>
|
||||
<th>
|
||||
<%= radiogroup.name %>
|
||||
|
@ -119,6 +122,13 @@
|
|||
<th class="o-question-title">
|
||||
<%= option.name %>
|
||||
</th>
|
||||
<% if question.custom_option %>
|
||||
<%= f.fields_for "#{option.id}" do |oid| %>
|
||||
<td>
|
||||
<%= oid.text_field "custom_group_field" %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% question.survey_question_radiogroups.each do |radiogroup| %>
|
||||
<td>
|
||||
<%= rgf.radio_button option.id, radiogroup.id %>
|
||||
|
@ -147,8 +157,8 @@
|
|||
<script type="text/javascript">
|
||||
|
||||
<% if @survey.jump_mode %>
|
||||
var answers = <%== @answers.to_json %>;
|
||||
var jump_tos_map = <%== @jump_tos_map.to_json %>;
|
||||
var answers = <%= @answers.to_json %>;
|
||||
var jump_tos_map = <%= @jump_tos_map.to_json %>;
|
||||
var $current_question = $('.question-item').eq(0);
|
||||
var current_index = parseInt($current_question.attr('data-index'));
|
||||
$current_question.removeClass('hide');
|
||||
|
|
Loading…
Reference in New Issue