<%=form_for @font_settings,{:class=>"form-horizontal",:url=>{:controller=>"patchfiles" ,:action=>"editfontfile",:font=>"#{params[:font]}"}}  do |f|%>
	<label for="fontname" style="float:left;margin-bottom:1em;padding-top: 0.3em;">font name:</label><%=f.text_field :title,{:value=>@font_settings.title,:id=>"fontname"}%>
	<div style="clear:both;"></div>
	<label for="fonturl" style="float:left;margin-bottom:1em;padding-top: 0.3em;">font url_link:</label><%=f.text_field :font_link,{:id=>"fonturl"}%>
	<div style="clear:both;"></div>
	<% if @font_settings.font_file_name != ""%>
		<label for="fontfile" style="float:left;margin-bottom:1em;padding-top: 0.3em;">font file:</label>
		<span id="fontfilename" style="font-size:1.2em;padding-top: 0.2em;float: left;"><%= @font_settings.font_file_name %></span>
		<div id="editname" style="float: left;cursor:pointer;"><a style="padding:0 1em;">edit</a></div>
		<div id="deletename" style="float: left;cursor:pointer;"><a>delete</a></div>
		<%=f.text_field :is_delete_font_file, {:id=>"hidden-file",:type => "hidden",:value=>@font_settings.is_delete_font_file} %>
		<%=f.file_field  :font_file,{:id=>"fontfile",:value=>@font_settings.font_file_name,:style=>"display:none;"}%>
	<% else %>
	<label for="fontfile" style="float:left;margin-bottom:1em;padding-top: 0.3em;">font file:</label><%=f.file_field  :font_file,{:id=>"fontfile",:value=>@font_settings.font_file_name}%>
	<% end %>
	<div style="clear:both;"></div>
	<%=f.submit "#{t(:updatefont)}"%>
<%end%>
<script>
	$('#editname').off('click').on('click',function(){
		$('#fontfilename').css('display','none');
		$('#editname').css('display','none');
		$('#fontfile').css('display','block');
		$('#deletename').css('display','none');
	});
	$('#deletename').off('click').on('click',function(){
		$('#fontfilename').css('display','none');
		$('#editname').css('display','none');
		$('#deletename').css('display','none');
		$('#hidden-file').val('true');
		$('#fontfile').css('display','block');
	});
	
</script>