<% tmp_get_input_name = get_input_name_for_ask form_type = tmp_get_input_name.split('[')[0] set_input_name_for_ask("#{form_type}") %>
<% if @has_switch_button %>
<% elsif form_type!= 'ask_setting' %>
<%= t("ask.use_default") %> <%= hidden_field_tag "#{f.object_name}[use_default]", false %>
<% end %>
<%= f.select :title_layout, ['single_column','two_column'].each_with_index.map{|v,i| [t("ask.#{v}"), i]} %>
<% if @has_email_regex %>
<%= f.check_box :email_regex_enable, {:id=>"email_regex_enable"} %><%= t("ask.enable") %>
<%= f.text_field :email_regex, {:id=>"ask_email_regex", :style => "width: 30em;"}.merge(f.object.email_regex_enable ? {} : {:disabled=>"disabled"}) %>
<% else %>
<%= t("ask.email_regex") %>:
<%= check_box_tag :email_regex_enable, @default_ask_setting.email_regex_enable , @default_ask_setting.email_regex_enable , {:id=>"",:disabled=>'disabled'} %><%= t("ask.enable") %>
<%= @default_ask_setting.email_regex %>
<% end %> <% if form_type=='ask_setting' %> <% end %> <% locale = I18n.locale.to_s %> <% default_setting = 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| %> <% if form_type=='ask_setting' %> <% end %> <% v = ask_setting.default_setting_required[k] %> <% end %> <% set_input_name_for_ask(tmp_get_input_name) %> <% if @default_custom_fields %> <% ask_setting.custom_fields.each do |k,v| %> <%= custom_field_block_for_ask("default@#{k}",v, false, (hidden_field_tag("#{f.object_name}[agree_customs][]", k))).html_safe %> <% end %> <%= f.hidden_field :use_default, :value => false %> <% else %> <% ask_setting.custom_fields.each do |k,v| %> <%= custom_field_block_for_ask(k,v).html_safe %> <% end %> <% end %> <% has_need_check_customs = (ask_setting.class == AskCategorySetting && (ask_setting.need_check_customs.count + ask_setting.reject_customs.count) != 0) org_hide = ask_setting.class == AskCategorySetting ? (ask_setting.need_check_customs.count == 0) : true; %> <% if has_need_check_customs %> <% end %> <% if has_need_check_customs %> <% (ask_setting.need_check_customs + ask_setting.reject_customs).sort_by{|k| k.to_i}.each do |k| %> <% if ask_setting.reject_customs.include?(k) %> <% other_first_rows = "" %> <%= custom_field_block_for_ask(k, @default_ask_setting.custom_fields[k], true, other_first_rows, "discard_fields hide").html_safe %> <% else %> <% other_first_rows = "" %> <%= custom_field_block_for_ask(k, @default_ask_setting.custom_fields[k], true, other_first_rows).html_safe %> <% end %> <% end %> <% end %>
<%= t('ask.field') %> <%= t('ask.whether_open') %> <%= t('ask.field_name') %> <%= t('ask.prompt_word') %> <%= t('ask.required') %>
<%= tmp = (form_type=='ask_setting' ? ask_setting.default_field_name(k,locale, true) : @default_ask_setting.field_name(k,locale, true)) %> <%= select_tag "#{get_input_name_for_ask}[default_setting][#{k}]",options_for_select([[t('yes'),'true'],[t('no'),false]],v) %> <%= multiple_lang_tag_for_ask(nil,'text_field',"default_setting_field_name][#{k}",ask_setting.field_name_translations(k),{placeholder: tmp}) %> <% if AskSetting::No_prompt_word.include?(k) %> <%= t('ask.the_same_as_field_name') %> <% else %> <%= multiple_lang_tag_for_ask(nil,'text_field',"default_setting_prompt_word][#{k}",ask_setting.prompt_word_translations(k),{placeholder: tmp}) %> <% end %> <%= select_tag "#{get_input_name_for_ask}[default_setting_required][#{k}]",options_for_select([[t('yes'),'true'],[t('no'),false]],v) %>
<%= t("ask.usage_rule") %> <%= f.text_area "usage_rule",class: 'ckeditor' %>
<%= hidden_field_tag :delete_field, nil,{'class'=> 'delete_field' } %> <% if !ask_setting.new_record? %> <%= f.hidden_field :id, value: ask_setting.id %> <% end %>
<%= t('ask.default_custom_fields') %> <%=t('ask.apply_all')%> <%=t('ask.discard_changes')%>
#{t('ask.apply')}
#{t('ask.apply')}#{t('ask.discard')}