diff --git a/vendor/built_in_modules/survey/app/controllers/panel/survey/front_end/surveys_controller.rb b/vendor/built_in_modules/survey/app/controllers/panel/survey/front_end/surveys_controller.rb
index 5d83101e7..847fa430d 100644
--- a/vendor/built_in_modules/survey/app/controllers/panel/survey/front_end/surveys_controller.rb
+++ b/vendor/built_in_modules/survey/app/controllers/panel/survey/front_end/surveys_controller.rb
@@ -10,13 +10,18 @@ class Panel::Survey::FrontEnd::SurveysController < OrbitWidgetController
end
def show
- redirect_standalone panel_survey_front_end_survey_path(params[:id], :standalone => 'true') do
- @survey = ::Survey.find params[:id]
- @questions = @survey.survey_questions.all
- if @survey.jump_mode
- @jumpable_questions = @questions.all.select{ |q| q.jumpable? && q.can_set_jump? }
+ @survey = ::Survey.find params[:id]
+ if @survey.redirect_mode
+ @redirect_url = @survey.redirect_url
+ render :redirect_standalone
+ else
+ redirect_standalone panel_survey_front_end_survey_path(params[:id], :standalone => 'true') do
+ @questions = @survey.survey_questions.all
+ if @survey.jump_mode
+ @jumpable_questions = @questions.all.select{ |q| q.jumpable? && q.can_set_jump? }
- @jump_tos_map = @jumpable_questions.map(&:get_jump_tos).inject(:merge)
+ @jump_tos_map = @jumpable_questions.map(&:get_jump_tos).inject(:merge)
+ end
end
end
end
diff --git a/vendor/built_in_modules/survey/app/models/survey.rb b/vendor/built_in_modules/survey/app/models/survey.rb
index 295658c9b..4767b2f2c 100644
--- a/vendor/built_in_modules/survey/app/models/survey.rb
+++ b/vendor/built_in_modules/survey/app/models/survey.rb
@@ -28,6 +28,9 @@ class Survey
mount_uploader :upload_file, AssetUploader
field :jump_mode, :type => Boolean, :default => false
+
+ field :redirect_mode, :type => Boolean, :default => false
+ field :redirect_url, :type => String
validates :title, :at_least_one => true
diff --git a/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_form.html.erb b/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_form.html.erb
index 0bd483a8e..3309a2029 100644
--- a/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_form.html.erb
+++ b/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_form.html.erb
@@ -18,6 +18,22 @@
+
diff --git a/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_survey.html.erb b/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_survey.html.erb
index 762b7fc9b..1383bc078 100644
--- a/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_survey.html.erb
+++ b/vendor/built_in_modules/survey/app/views/panel/survey/back_end/surveys/_survey.html.erb
@@ -13,7 +13,6 @@
<%= link_to t('survey.duplicate_it'), duplicate_it_panel_survey_back_end_survey_path(survey, :page => params[:page]) %>
<%= link_to t('survey.jump'), jump_panel_survey_back_end_survey_path(survey, :page => params[:page]) %>
<%= link_to t('survey.set_answers'), set_answers_panel_survey_back_end_survey_path(survey, :page => params[:page]) %>
-
<%= link_to t('survey.answers_list'), panel_survey_back_end_survey_answers_path(survey, :page => params[:page]) %>
<%= link_to t('survey.export_csv'), export_panel_survey_back_end_survey_path(survey, :format => :csv), :target => '_blank' %>
<%= link_to t('survey.chart'), result_panel_survey_front_end_survey_path(survey, :force_chart => true, :standalone => true), :target => '_blank' %>
<%= link_to t(:delete_), panel_survey_back_end_survey_path(survey), :confirm => t('sure?'), :method => :delete, :remote => true %>
diff --git a/vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/result.html.erb b/vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/result.html.erb
index 6db8b0c55..2d02eea77 100644
--- a/vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/result.html.erb
+++ b/vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/result.html.erb
@@ -6,7 +6,7 @@
- <%= t 'survey.results_count' %>: <%= @survey_questions.count %>
+ <%= t 'survey.results_count' %>: <%= @survey.survey_answers.count %>
<% @survey_questions.each do |question| %>
diff --git a/vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/show.html.erb b/vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/show.html.erb
index e21269985..b013e0078 100644
--- a/vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/show.html.erb
+++ b/vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/show.html.erb
@@ -1,109 +1,117 @@
<% # encoding: utf-8 %>
-<%= @survey.title %>
-
-
-
- <%= form_for :answer, :method => :put, :url => panel_survey_front_end_survey_path(@survey, :inner => true), :html => {:class => 'clear'} do |f| %>
-
- <%= @survey.description %>
-
-
- <% @questions.each_with_index do |question, i| %>
- -
- <% label = question.title %>
- <% label += ' (' + t('survey_question.required') + ')' if question.is_required %>
- <%= f.label question.id, label, :class => "o-question-title" %>
-
- <%= question.description %>
-
- <% case question.type %>
- <% when ::SurveyQuestion::Oneline %>
- <%= f.text_field question.id, :required => question.is_required %>
- <% when ::SurveyQuestion::Multiline %>
- <%= f.text_area question.id, :rows => 5, :required => question.is_required %>
- <% when ::SurveyQuestion::Radio %>
- <% question.survey_question_options.each do |option| %>
-
- <%= f.radio_button question.id, option.id %>
- <%= f.label "#{question.id}_#{option.id}", option.name, :style => "display:inline" %>
-
- <% end %>
- <% if question.custom_option %>
-
- <%= f.radio_button question.id, 'custom_option' %>
- <%= f.label "#{question.id}_custom_option", t('survey_question.use_custom_option') + ': ', :style => "display:inline" %>
- <%= f.text_field "#{question.id}_custom_option" %>
-
- <% end %>
- <% when ::SurveyQuestion::Check %>
- <%= f.fields_for "#{question.id}" do |cf| %>
- <% question.survey_question_options.each do |option| %>
-
- <%= cf.check_box option.id %>
- <%= cf.label option.id, option.name, :style => "display:inline" %>
-
- <% end %>
- <% if question.custom_option %>
-
- <%= cf.check_box 'custom_option' %>
- <%= f.label "#{question.id}_custom_option", t('survey_question.use_custom_option') + ': ', :style => "display:inline" %>
- <%= f.text_field "#{question.id}_custom_option" %>
-
- <% end %>
- <% end %>
- <% when ::SurveyQuestion::Select %>
- <% options = question.survey_question_options.collect {|o| [ o.name, o.id ] } %>
- <% if question.custom_option %>
- <% options.push [t('survey_question.use_custom_option'), 'custom_option'] %>
- <% end %>
- <%= f.select question.id, options %>
- <% if question.custom_option %>
- <%= f.text_field "#{question.id}_custom_option", :class => 'custom_option' %>
- <% end %>
- <% when ::SurveyQuestion::Radiogroup %>
- <%= f.fields_for "#{question.id}" do |rgf| %>
-
-
-
- |
- <% question.survey_question_radiogroups.each do |radiogroup| %>
-
- <%= radiogroup.name %>
- |
- <% end %>
-
-
-
- <% question.survey_question_options.each_with_index do |option, j| %>
- >
-
- <%= option.name %>
- |
- <% question.survey_question_radiogroups.each do |radiogroup| %>
-
- <%= rgf.radio_button option.id, radiogroup.id %>
- |
- <% end %>
-
- <% end %>
-
-
- <% end %>
- <% end %>
-
- <% end %>
-
-
- <%= f.submit t('submit'), :class => 'survey-submit' %>
-
- <% end %>
-
-
+
+ <%= form_for :answer, :method => :put, :url => panel_survey_front_end_survey_path(@survey, :standalone => true), :html => {:class => 'survey clear'} do |f| %>
+
<%= @survey.title %>
+
+ <%= @survey.description %>
+
+
+ <% @questions.each_with_index do |question, i| %>
+ -
+ <% label = question.title %>
+ <% label += ' (*)' if question.is_required %>
+ <%= f.label question.id, label, :class => "o-question-title" %>
+
+ <%= question.description %>
+
+ <% case question.type %>
+ <% when ::SurveyQuestion::Oneline %>
+ <%= f.text_field question.id, :required => question.is_required %>
+ <% when ::SurveyQuestion::Multiline %>
+ <%= f.text_area question.id, :rows => 5, :required => question.is_required %>
+ <% when ::SurveyQuestion::Radio %>
+
+ <% question.survey_question_options.each do |option| %>
+ -
+ <%= f.radio_button question.id, option.id %>
+ <%= f.label "#{question.id}_#{option.id}", option.name, :class => 'o-question-option' %>
+
+ <% end %>
+ <% if question.custom_option %>
+ -
+ <%= f.radio_button question.id, 'custom_option' %>
+ <%= f.label "#{question.id}_custom_option", t('survey_question.use_custom_option') + ': ', :class => 'o-question-option' %>
+ <%= f.text_field "#{question.id}_custom_option" %>
+
+ <% end %>
+
+ <% when ::SurveyQuestion::Check %>
+
+ <%= f.fields_for "#{question.id}" do |cf| %>
+ <% question.survey_question_options.each do |option| %>
+ -
+ <%= cf.check_box option.id %>
+ <%= cf.label option.id, option.name, :class => 'o-question-option' %>
+
+ <% end %>
+ <% if question.custom_option %>
+ -
+ <%= cf.check_box 'custom_option' %>
+ <%= f.label "#{question.id}_custom_option", t('survey_question.use_custom_option') + ': ', :class => 'o-question-option' %>
+ <%= f.text_field "#{question.id}_custom_option" %>
+
+ <% end %>
+ <% end %>
+
+ <% when ::SurveyQuestion::Select %>
+ <% options = question.survey_question_options.collect {|o| [ o.name, o.id ] } %>
+ <% if question.custom_option %>
+ <% options.push [t('survey_question.use_custom_option'), 'custom_option'] %>
+ <% end %>
+ <%= f.select question.id, options, {}, :class => 'o-question-group view-dropdown' %>
+ <% if question.custom_option %>
+ <%= f.text_field "#{question.id}_custom_option", :class => 'custom_option' %>
+ <% end %>
+ <% when ::SurveyQuestion::Radiogroup %>
+ <%= f.fields_for "#{question.id}" do |rgf| %>
+
+
+
+ |
+ <% question.survey_question_radiogroups.each do |radiogroup| %>
+
+ <%= radiogroup.name %>
+ |
+ <% end %>
+
+
+
+ <% question.survey_question_options.each_with_index do |option, j| %>
+ >
+
+ <%= option.name %>
+ |
+ <% question.survey_question_radiogroups.each do |radiogroup| %>
+
+ <%= rgf.radio_button option.id, radiogroup.id %>
+ |
+ <% end %>
+
+ <% end %>
+
+
+ <% end %>
+ <% end %>
+
+ <% end %>
+
+
+ <%= f.submit t('submit'), :class => 'survey-submit' %>
+
+ <% end %>
<% content_for :page_stylesheets do %>
<% end %>
+