2020-03-21 15:36:33 +00:00
|
|
|
<%
|
|
|
|
set_input_name('ask_setting[custom_fields]')
|
|
|
|
%>
|
2020-07-04 13:36:32 +00:00
|
|
|
<script>
|
2020-03-21 15:36:33 +00:00
|
|
|
function add_new_field(){
|
|
|
|
$.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){
|
|
|
|
var add_field_html = "<%= custom_field_block(-1).inspect %>"
|
|
|
|
add_field_html = add_field_html.replace(/-1/g,data['key'])
|
|
|
|
$('.add_field').before($('<div/>').html(add_field_html).text().slice(1,-2))
|
2020-07-04 13:36:32 +00:00
|
|
|
$('.add_new_options').sortable({'handle':'.icons-list-2'})
|
2020-03-21 15:36:33 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</script>
|
2020-07-04 13:36:32 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function(){
|
|
|
|
$('.add_new_options').sortable({'handle':'.icons-list-2'})
|
|
|
|
})
|
|
|
|
</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| %>
|
2020-07-04 13:36:32 +00:00
|
|
|
<%= render partial: 'ask_setting',locals:{ask_setting: @ask_setting,f: f,submit_text: t('submit')} %>
|
2020-03-21 15:36:33 +00:00
|
|
|
<% end %>
|