ask/app/views/admin/asks/_show_default_ask_setting.h...

77 lines
2.4 KiB
Plaintext
Raw Normal View History

<fieldset>
<style>
.show_field {
border: 1px solid black;
padding: 3px;
min-width: 1em;
height: 20px;
overflow-y: auto;
}
</style>
<table class="table">
<tbody>
<tr>
<td>
<a href="#" class="btn btn-primary clone_default_setting" data-parent=".show_default_ask_setting"><%= t('ask.clone_default_setting') %></a>
<a href="#" class="btn btn-success recover_data switch_to_default <%= 'hide' if @first_setting.nil? %>" data-parent=".show_default_ask_setting" data-id="<%= @first_setting.id if @first_setting%>" data-use-default="false"><%= t('ask.recover_data') %></a>
</td>
<td></td>
</tr>
<tr>
<td><%= t("ask.title_layout") %>:</td>
<td><%= [t("ask.single_column"),t("ask.two_column")][@default_ask_setting.title_layout] %></td>
</tr>
<tr>
<td><%= t("ask.email_regex") %>:</td>
<td>
<%= check_box_tag :email_regex_enable, @default_ask_setting.email_regex_enable , nil, {:id=>"",:disabled=>'disabled'} %><%= t("ask.enable") %>
<div style="clear: both;"></div>
<div class="show_field">
<%= @default_ask_setting.email_regex %>
</div>
</td>
</tr>
<tr>
<td>
<%= t('ask.field') %>
</td>
<td>
<%= t('ask.whether_open') %>
</td>
</tr>
<% locale = I18n.locale.to_s %>
<% true_false_trans = {'true'=> t('yes'), 'false'=>t('no')} %>
<%
default_setting = @default_ask_setting.default_setting
if default_setting.keys[0].to_s != 'title'
default_setting = {title: true}.merge(default_setting)
end
%>
<% default_setting.each do |k,v| %>
<tr>
<td>
<%= tmp = @default_ask_setting.field_name(k,locale, true) %>
</td>
<td>
<%=
tmp2 = true_false_trans[v]
tmp2 = true_false_trans.values[0] if tmp2.nil?
tmp2
%>
</td>
</tr>
<% end %>
<tr>
<td>
<%= t("ask.usage_rule") %>
</td>
<td colspan="2">
2022-09-21 10:07:01 +00:00
<%= @default_ask_setting.usage_rule.to_s.html_safe %>
</td>
</tr>
</tbody>
<% @default_ask_setting.custom_fields.each do |k,v| %>
<%= custom_field_block(k,v,true).html_safe %>
<% end %>
</table>
</fieldset>