Fix survey title link redirection after deadline
This commit is contained in:
parent
8f65da0a04
commit
83a8433e52
|
@ -110,4 +110,10 @@ class Panel::Survey::FrontEnd::SurveysController < OrbitWidgetController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def info
|
||||||
|
redirect_standalone result_panel_survey_front_end_survey_path(params[:id], :standalone => 'true') do
|
||||||
|
@survey = ::Survey.find params[:id]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -41,6 +41,16 @@ class Survey
|
||||||
|
|
||||||
before_save :check_deadline, :update_avliable_language
|
before_save :check_deadline, :update_avliable_language
|
||||||
|
|
||||||
|
def topic
|
||||||
|
unless self.deadline && Time.now > self.deadline
|
||||||
|
('<a target="_blank" href="' + Rails.application.routes
|
||||||
|
.url_helpers.panel_survey_front_end_survey_path(self, :standalone => true) + '">' + self.title + '</a>').html_safe
|
||||||
|
else
|
||||||
|
('<a target="_blank" href="' + Rails.application.routes
|
||||||
|
.url_helpers.info_panel_survey_front_end_survey_path(self, :standalone => true) + '">' + self.title + '</a>').html_safe
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def time_range
|
def time_range
|
||||||
r = "#{self.postdate.to_date}"
|
r = "#{self.postdate.to_date}"
|
||||||
r += "- #{self.deadline.to_date}" if self.deadline
|
r += "- #{self.deadline.to_date}" if self.deadline
|
||||||
|
|
16
vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/info.html.erb
vendored
Normal file
16
vendor/built_in_modules/survey/app/views/panel/survey/front_end/surveys/info.html.erb
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<h3>問卷已結束!感謝您的參與!</h3>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th>問卷標題</th>
|
||||||
|
<th>問卷說明</th>
|
||||||
|
<th>開始期間</th>
|
||||||
|
<th>結束期間</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= @survey.title %></td>
|
||||||
|
<td><%= truncate(@survey.description, to: 40) %></td>
|
||||||
|
<td><%= @survey.postdate.to_date %></td>
|
||||||
|
<td><%= @survey.deadline.to_date %></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
|
@ -46,6 +46,7 @@ en:
|
||||||
title: Title
|
title: Title
|
||||||
time_range: Date Range
|
time_range: Date Range
|
||||||
result: Result
|
result: Result
|
||||||
|
topic: Title
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
survey: Survey Frontend
|
survey: Survey Frontend
|
||||||
|
|
|
@ -48,6 +48,7 @@ zh_tw:
|
||||||
time_range: 問卷期間
|
time_range: 問卷期間
|
||||||
write: 填問卷
|
write: 填問卷
|
||||||
result: 結果
|
result: 結果
|
||||||
|
topic: 問卷標題
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
survey: 問卷調查前台
|
survey: 問卷調查前台
|
||||||
|
|
|
@ -24,6 +24,7 @@ Rails.application.routes.draw do
|
||||||
resources :surveys do
|
resources :surveys do
|
||||||
member do
|
member do
|
||||||
get 'result'
|
get 'result'
|
||||||
|
get 'info'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,8 @@ module Faq
|
||||||
enable ["typeA"]
|
enable ["typeA"]
|
||||||
query 'Survey.any_of( {:postdate.lte => Time.now} )'
|
query 'Survey.any_of( {:postdate.lte => Time.now} )'
|
||||||
# link_field :title, {:method => 'panel_survey_front_end_survey_path',:args=>:self}
|
# link_field :title, {:method => 'panel_survey_front_end_survey_path',:args=>:self}
|
||||||
field :title
|
# field :title
|
||||||
|
field :topic
|
||||||
field :time_range
|
field :time_range
|
||||||
field :write
|
field :write
|
||||||
field :result
|
field :result
|
||||||
|
|
Loading…
Reference in New Issue