%= t('ask.setting_type') %>: <%= select_tag "setting_type", options_for_select([[t('ask.field_setting'),'field'],[t('ask.print_setting'),'print']]), :class => "category-selector" %>
<%
set_input_name('ask_category_setting[custom_fields]')
%>
<% if @category_not_add.length != 0 %>
<% ask_setting = AskCategorySetting.new %>
<%= form_for ask_setting,method: 'post',url: "/#{I18n.locale}/admin/asks/category_setting_save",html: { class: "category-set-page"} do |f| %>
<% prompt = t('ask.select_category') %>
<%= t('category') %>: <%= select_tag "category_id", options_for_select(@category_not_add.unshift(prompt),selected: prompt,disabled: prompt), :class => "category-selector" %>
<%= render partial: 'ask_setting',locals:{ask_setting: ask_setting,f: f,submit_text: t('submit')} %>
<% end %>
<% end %>
<% index1 = 0 %>
<% first_category_added = nil %>
<% @category_added.each do |category_added| %>
<% category = @categories.select{|cat| cat.id.to_s==category_added.category_id.to_s}[0] %>
<% if !category.nil? %>
<% if first_category_added.nil?
first_category_added = category_added
end
%>
<% index1+=1 %>
<% name1 = category.title %>
<%= name1.blank? ? "no name" : name1 %>
<% end %>
<% end %>
<% if !first_category_added.nil? %>
<%= render partial: 'category_setting_field',locals: {ask_setting: first_category_added} %>
<% end %>
<% if @category_print_not_add.length != 0 %>
<% else %>
<%= render partial: 'print_format_explain' %>
<% end %>
<% index1 = 0 %>
<% categories = []%>
<% @category_print_added.each do |category_print_added| %>
<% category = @categories.select{|cat| cat.id.to_s==category_print_added.category_id.to_s}[0] %>
<% categories << category %>
<% if !category.nil? %>
<% index1+=1 %>
<% name1 = category.title %>
<%= name1.blank? ? "no name" : name1 %>
<% end %>
<% end %>
<% index2 = 0 %>
<% @category_print_added.each_with_index do |category_print_added,index1| %>
<% if !categories[index1].nil? %>
<% index2 = index2 + 1 %>
<% end %>
<% end %>