<div class="toolbar-inline">
	<%= link_to(fa_icon("edit"), edit_rubrik_neuigkeit_path( menu.rubrik,  menu), remote: true , class: "btn", title: "Edit") if can? :edit, menu 
	%>
	<span class="btn-group">
		<%= link_to(fa_icon("paperclip"), "#", 	class: "btn", id: "attachments-form-open", title: "Attachments") if can? :edit, menu 
		%>	
		<%= link_to(fa_icon("calendar-o"),	new_calentry_path(:object_id=>menu.id, :object_type=>"Neuigkeit"), 	:remote=>true, class: :btn) if can? :edit, menu 
		%>
		<%= link_to(fa_icon("link") , "#", id: "findlink-open",title: "Neue Verknüpfung" , class: "btn") if can? :find_link, menu 
		%>
		
	</span>
	
	<%= new_question_for(menu, fa_icon("question")) if can? :new, Survey::Question %>
 
	<span class=" pull-right">
			<%= flag_link(menu, "important")%>
			<%= flag_link(menu, "infoscreen")%>

		<%= link_to(fa_icon("globe"), publish_rubrik_neuigkeit_path(menu.rubrik,menu), title:  I18n.t('neuigkeit.publish'), class: "btn") if can?(:publish, menu) && !menu.published? 
		%>
		<%= link_to(fa_stack("globe","ban"), unpublish_rubrik_neuigkeit_path(menu.rubrik,menu), :remote=>true, class: "btn stacked") if  can?(:unpublish, menu) && menu.published? 
		%>
		<% if menu.published? %>
			<div class="dropdown" style=" display:inline"">
				<a class="dropdown-toggle btn" data-toggle="dropdown" title="publish" href="#">
					<%= fa_icon("mail-forward")%><span class="caret"></span>
				</a>
				<ul class="dropdown-menu">
					<%= li_tag(link_to(fa_icon("facebook-square") + " post on facebook", publish_to_facebook_rubrik_neuigkeit_path(menu.rubrik,menu))) if can?(:publish, menu) && menu.published? 
					%>
					
					<%= li_tag(link_to(fa_icon("envelope-o") + " send mail", mail_preview_rubrik_neuigkeit_path(menu.rubrik,menu))) if can?(:publish, menu) && menu.published? 
					%>
				</ul>
			</div>
		<% end  %>
	</span>
	<div class="ui-dialog" id="attachments-form">
		<%= render_new_attachments_for(menu, fa_icon("plus"), {class: "btn"})  %>
	</div>
</div>
<script>
$(function(){
  dialogatt = $( "#attachments-form" ).dialog({
    autoOpen: false,
    width: "90%",
    modal: true,
    title: "Neue Attachments",
    buttons: {
      "Fertig": function() {
        dialogatt.dialog( "close" );
      }
    }
  });
  $("#attachments-form-open").on("click",function(){dialogatt.dialog("open")})
});
</script>


