2020-03-21 15:36:33 +00:00
|
|
|
<%
|
2022-09-21 10:07:01 +00:00
|
|
|
set_input_name_for_ask('ask_setting[custom_fields]')
|
2020-03-21 15:36:33 +00:00
|
|
|
%>
|
2020-07-04 13:36:32 +00:00
|
|
|
<script>
|
2022-03-18 03:49:11 +00:00
|
|
|
function add_new_field(ele){
|
2020-03-21 15:36:33 +00:00
|
|
|
$.ajax({
|
|
|
|
url : "<%= get_new_setting_index_admin_asks_path %>",
|
|
|
|
dataType : "json",
|
|
|
|
type : "post",
|
|
|
|
error: function(){
|
|
|
|
alert('init process failed, please try again later.')
|
|
|
|
},
|
|
|
|
success: function(data){
|
2022-09-22 08:06:12 +00:00
|
|
|
var add_field_html = "<%= custom_field_block_for_ask(-1).inspect %>"
|
2020-03-21 15:36:33 +00:00
|
|
|
add_field_html = add_field_html.replace(/-1/g,data['key'])
|
2022-03-18 03:49:11 +00:00
|
|
|
$(ele).parents('.add_field').before($('<div/>').html(add_field_html).text().slice(1,-2))
|
2022-07-07 08:54:09 +00:00
|
|
|
var new_item = add_field.prev();
|
|
|
|
new_item.find('.add_new_options').sortable({'handle':'.icons-list-2'})
|
|
|
|
new_item.find('.ckeditor').each(function(i, item){
|
|
|
|
CKEDITOR.replace(item);
|
|
|
|
});
|
2020-03-21 15:36:33 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</script>
|
2020-07-04 13:36:32 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function(){
|
2022-07-07 08:54:09 +00:00
|
|
|
$('.add_new_options').sortable({'handle':'.icons-list-2'});
|
2020-07-04 13:36:32 +00:00
|
|
|
})
|
|
|
|
</script>
|
2020-03-21 15:36:33 +00:00
|
|
|
<%= form_for @ask_setting,method: 'post',url: @url,html: { class: 'form-horizontal main-forms previewable' } do |f| %>
|
2022-04-12 14:17:34 +00:00
|
|
|
<%= render partial: 'ask_setting',locals:{ask_setting: @ask_setting,f: f,submit_text: t('submit'), :@has_email_regex => true} %>
|
2020-03-21 15:36:33 +00:00
|
|
|
<% end %>
|