From 642d0ed239a7779a93a47c768f2420b32ba9d451 Mon Sep 17 00:00:00 2001 From: iCross Date: Fri, 7 Jun 2013 18:46:30 +0800 Subject: [PATCH] survey module: ensure the commit --- .../survey/app/models/survey_question.rb | 4 ++++ .../survey/back_end/surveys/_form.html.erb | 24 +++++++++++++++++++ .../front_end/surveys/_answer_error.erb | 1 + .../front_end/surveys/_answer_success.erb | 2 ++ .../front_end/surveys/answer_error.js.erb | 1 + .../front_end/surveys/answer_success.js.erb | 1 + .../survey/config/locales/en.yml | 3 +++ .../survey/config/locales/zh_tw.yml | 3 ++- 8 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/_answer_error.erb create mode 100644 vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/_answer_success.erb create mode 100644 vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/answer_error.js.erb create mode 100644 vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/answer_success.js.erb diff --git a/vendor/built_in_modules/survey/app/models/survey_question.rb b/vendor/built_in_modules/survey/app/models/survey_question.rb index bb0c9004d..6feae2a5d 100644 --- a/vendor/built_in_modules/survey/app/models/survey_question.rb +++ b/vendor/built_in_modules/survey/app/models/survey_question.rb @@ -16,6 +16,8 @@ class SurveyQuestion # allow custom answer option field :custom_option, :type => Boolean + + field :sequence, :type => Integer, :default => 0 belongs_to :survey embeds_many :survey_question_options @@ -24,6 +26,8 @@ class SurveyQuestion accepts_nested_attributes_for :survey_question_options, :allow_destroy => true accepts_nested_attributes_for :survey_question_radiogroups, :allow_destroy => true + default_scope asc(:sequence) + def jumpable? case type when SurveyQuestion::Radio, SurveyQuestion::Select 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 3309a2029..46108ee1b 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 @@ -103,7 +103,31 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "survey_form" %>