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

29 lines
1.0 KiB
Plaintext

<%
set_input_name('ask_setting[custom_fields]')
%>
<script>
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))
$('.add_new_options').sortable({'handle':'.icons-list-2'})
}
})
}
</script>
<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| %>
<%= render partial: 'ask_setting',locals:{ask_setting: @ask_setting,f: f,submit_text: t('submit')} %>
<% end %>