Adjust send_email field to multiple options.

This commit is contained in:
rulingcom 2024-09-03 23:56:53 +08:00
parent 3caa63bb46
commit d2edc29945
6 changed files with 44 additions and 5 deletions

View File

@ -391,7 +391,7 @@ class Admin::AsksController < OrbitAdminController
end
temp_params = temp_params.merge({reviewer: current_user.member_profile, review_time: DateTime.now})
@ask_question.update_attributes(temp_params)
if @ask_question.send_email
if @ask_question.send_email?
build_email(@ask_question)
end

View File

@ -20,8 +20,8 @@ class AskQuestion
field :reply, type: String
field :comment, type: String
field :send_email, type: Boolean, default: false
field :situation, type: String, default: "is_email_not_confirmed" # 預設email未驗證
field :send_email, type: Integer, default: 0
field :email_id
field :verify_email_id
field :custom_values, type: Hash, default: {}
@ -75,5 +75,9 @@ class AskQuestion
def display_format_string(num, str_length)
format("%0#{str_length}d", num)
end
def send_email?
self.send_email == 1
end
end
end

View File

@ -97,9 +97,34 @@
<tr>
<td colspan="5">
<%= f.label :send_email %><%= f.radio_button :send_email, 1, checked: @ask_question.send_email? %><%= t('ask.yes') %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= f.radio_button :send_email, 0, checked: !@ask_question.send_email? %><%= t('ask.no') %>
<%= f.label :send_email, class: "control-label muted" %>
<div class="controls">
<label class="radio inline">
<%= f.radio_button :send_email, 1 %>
<%= t('ask.system_Email') %>
</label>
<label class="radio inline">
<%= f.radio_button :send_email, 0 %>
<%= t('ask.no') %>
</label>
<label class="radio inline">
<%= f.radio_button :send_email, 2 %>
<%= t('ask.phone') %>
</label>
<label class="radio inline">
<%= f.radio_button :send_email, 3 %>
<%= t('ask.fax') %>
</label>
<label class="radio inline">
<%= f.radio_button :send_email, 4 %>
<%= t('ask.paper') %>
</label>
</div>
</td>
</tr>
</table>

View File

@ -99,6 +99,10 @@ en:
is_published: Processed and Published
'yes': 'Yes'
'no': 'No'
system_Email: System Email
phone: Phone
fax: Fax
paper: Paper
required: Required
datepicker: Select a Date
enable_range_setting: Enable Time Range Setting

View File

@ -102,6 +102,10 @@ zh_tw:
is_published: 已處理並發佈網頁
'yes':
'no':
system_Email: 系統發信
phone: 電話
fax: 傳真
paper: 回覆函
required: 必填
datepicker: 選擇日期
enable_range_setting: 啟用時間區段設定

View File

@ -112,6 +112,8 @@ module Ask
end
end
fix_reviewer
AskQuestion.where(send_email: false).update_all(send_email: 0)
AskQuestion.where(send_email: true).update_all(send_email: 1)
OrbitApp.registration "Ask", :type => "ModuleApp" do
module_label "ask.ask"
base_url File.expand_path File.dirname(__FILE__)