<%= semantic_form_for @themengruppe do |f| %>
  <%= f.inputs do %>
    <%= f.input :title %>
    <% f.input :priority %>
    <%= f.input :public %>

    <%= f.input :icon ,:as=>:hidden, :input_html=>{:id=>"iconfield"}%>
    <i id="icon" style="font-size:2em" class="<%= @themengruppe.icon %>"></i><a href="#" id="openselect" onclick=""> Choose Icon</a>
    <% f.input :picture, :as => :file %>
    <%= f.input :text %>
  <% end %>

  <%= f.actions do %>
   	<%= f.action :submit, :as => :input %>
	<%= f.action :cancel,:label => I18n.t("common.back"), :as => :link %>
  <% end %>
<% end %>
<script>
$(
  function()
    {$('#iconfield').on('change', function(){$('#icon').attr("class",$(this).val())});
$("#dialog").dialog({width:'100%', position:'center top', at:'left top',autoOpen: false,closeOnEscape: false});
$("#openselect").on('click', function(){$('#dialog').dialog('open')});
});
</script>

<div style="font-size:2em; line-height:1.2em" id ="dialog" title="Icon"><p>
<% ffi1_list.each do |i| %>
 <a onclick="$('#iconfield').val('ffi1-<%= i %>');$('#icon').attr('class','ffi1-<%= i %>'); $('#dialog').dialog('close')" href="#"><%=ffi1_icon(i)%>
</a>
<% end %> 

</p><p>
<% fa_list.each do |i| %>
 <a onclick="$('#iconfield').val('fa <%= i %>');$('#icon').attr('class','fa <%= i %>'); $('#dialog').dialog('close')" href="#"><%=ff_icon('fa '+i)%>
</a>
<% end %> 

</p>
</div>
