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

33 lines
1.2 KiB
Plaintext

<%
set_input_name_for_ask('ask_setting[custom_fields]')
%>
<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))
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);
});
}
})
}
</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'), :@has_email_regex => true} %>
<% end %>