ask/app/views/admin/asks/setting.html.erb

29 lines
1.0 KiB
Plaintext
Raw Normal View History

<%
set_input_name('ask_setting[custom_fields]')
%>
2020-07-04 13:36:32 +00:00
<script>
function add_new_field(ele){
$.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'])
$(ele).parents('.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'})
}
})
}
</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>
<%= 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')} %>
<% end %>