<%= content_for :header do %>
<title>Fetsite - <%=  @neuigkeit.title %> (<%= @neuigkeit.rubrik.name %>)</title>
<% set_meta_tags :author => fetprofile_path(@neuigkeit.author.fetprofile) unless @neuigkeit.author.fetprofile.nil? %>
<% unless @neuigkeit.picture_robust.url.nil?
   picture_url=URI(root_url)
   picture_url.path=@neuigkeit.picture_robust.url(:locale=>nil, :theme=>nil)
end
%>
<% set_meta_tags :og => {
    :image => picture_url.to_s,
    :title => @neuigkeit.title.to_s + " (" + @neuigkeit.rubrik.name.to_s + ")",
    :type => "article",
    :description =>@neuigkeit.text_first_words,
:url=>neuigkeit_url(:theme=>nil)
}
%>


<%= display_meta_tags %>
<% end %>

<%= render 'rubriken/tabs' %>

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/de_DE/sdk.js#xfbml=1&appId=120379864660921&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="content-column content-wrap">
  <p id="notice"><%= notice %></p>
  <div class="contentbox" itemscope itemtype="http://schema.org/Article">
    <meta itemprop="about" content="<%= @neuigkeit.text_first_words %>"/>
    <meta itemprop="sameAs" content="<%= neuigkeit_url(@neuigkeit,:theme=>nil)%>"/>
   <meta itemprop="url" content="<%= neuigkeit_url(@neuigkeit,:theme=>nil)%>"/>
  
   <div class="row-fluid">
      <span itemprop="articleSection">
	<%= ff_icon(@neuigkeit.rubrik.icon) unless @neuigkeit.rubrik.icon.nil? or @neuigkeit.rubrik.icon.empty? %>&nbsp;<%= @neuigkeit.rubrik.name %>
      </span>
      <span class="pull-right">
	<span itemprop="author"><%= @neuigkeit.author.email.to_s unless @neuigkeit.try(:author).try(:email).to_s %> 
	  <%= @neuigkeit.author.text %></span><% unless @neuigkeit.try(:datum).try(:to_date).nil? %><%= " "+ I18n.t("neuigkeit.am")+" " %><span itemprop="datePublished"><%= I18n.l(@neuigkeit.try(:datum).try(:to_date))   %>
      </span>
<% end %>
    </div>
    <% unless @neuigkeit.published? %> 
    <div class="sticker sticker-red"> Not Published</div> <% end %>
    
    <div class="media">
      <% unless @neuigkeit.picture_robust.big_thumb.to_s.empty? %>
      <div class="pull-left" href="#">
	<p><br><%= link_to image_tag(@neuigkeit.picture_robust.big_thumb.url),@neuigkeit.picture_robust.try(:url)  %>
	</p>
      </div>
      <% end %>
      <div class="media-body">
	<h1 itemprop="name">
	  <%=  @neuigkeit.title%>
	</h1>
	<div itemprop="articleBody">
	<%= raw(@neuigkeit.text) %>
	</div>
	<p></p>
      </div>
    </div>
    <div id="calentries">
<% @calentries1.each do |ce|%>
<%= render ce unless ce.nil? %>
<% end %>
</div>
<div class="fb-like" data-href"<%= rubrik_neuigkeit_url(@rubrik,@neuigkeit,{themes: nil, locale: nil})%>" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>

<% unless @neuigkeit.meeting.nil? %>
<%= render @neuigkeit.meeting %>
<% end%>
<div id="calentry_new" ><%= link_to "new Calentry",  new_calentry_path(:object_id=>@neuigkeit.id, :object_type=>"Neuigkeit"), :remote=>true if can? :edit, @neuigkeit  %></div>

<%=   %>
<%= render_attachments_for(@neuigkeit) %>
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>
</div>
<%= render partial: 'nlink_list_whole', :object=>@neuigkeit.nlinks %>
<% if can? :find_link , @neuigkeit %>
<a id="findlink-open" href="#"><%= fa_icon("link")%> Neue Verknüpfungen </a>
<% end %>
</div>
<style>

</style>
<div id="findlink-body"class="ui-dialog" style="">
<% if can? :find_link, @neuigkeit %>
Nach Element suchen:
<%= semantic_form_for :find_link, :url=>find_link_rubrik_neuigkeit_path(@rubrik,@neuigkeit), :html=>{:id=>"search_form", :method=>'get'} , :remote=> true do |f| %>
<%= f.input :query, :input_html => { :name => 'query' },:label=>false %>
<% end %>
<%= render partial: 'nlink_list_search_whole', object: @nlink_search %>

<% end %>
</div>


<script>
$(function(){
  dialog = $( "#findlink-body" ).dialog({
      autoOpen: false,
      width: 350,
      modal: true,
      title: "Neue Verknüpfung hinzufügen",
      buttons: {
        "Fertig": function() {
          dialog.dialog( "close" );
        }
      }
    });
  $("#findlink-open").on("click",function(){dialog.dialog("open")})
  });
</script>
