<commit_before><% menu(:home) %>

<% content_for :javascript do  %>
  $(".news_navigation_link").livequery("click", function(){
	  var route = $(this).attr("href");
		$(this).attr("href","#")
	  $.get(route,
            {authenticity_token: "<%=form_authenticity_token()%>"},
            function(data){
              $("#last_news").replaceWith(data);
            }
          );
	});
	
	$("#join_form").submit(function(){
    var route = $(this).attr("action");
    $.post(route,
            {authenticity_token: "<%=form_authenticity_token()%>"},
            function(data){
              eval(data);
            }
          );
    return false;
  });
	
	$("#query").click(function(){
	  if(this.value == "Search..."){
		  this.value="";
		}
	});
	$(".fancybox_link").fancybox({
    'hideOnContentClick' : false
  });
	
<% end %>

<% content_for :search do  %>
  <% form_tag(search_all_path(@space), :method => 'get') do %>
			<%= text_field_tag 'query',(params[:query] ? params[:query] :  "Search...")%>
      <%= image_submit_tag "buttons/search.png"%>
  <% end %>
<%end%>

<% content_for :sidebar do  %>
  <div id="join">
  <% if space.users.include?(current_user)%>
		<%= link_to image_tag("buttons/leave-space2.png", :alt => "Leave space" ), space_performance_path(@space, @performance), :method => :delete,:title => "Leave space" %>
  <%else%>
	  <%if logged_in? && space.public?%>
		  <% form_tag join_space_path(space), :id => "join_form" do %>
	      <%= image_submit_tag("buttons/join-space.png") %>
	    <% end %>
		<%else%>
		  <%=link_to image_tag("buttons/join-space.png", :alt => "Join space"), join_space_path(space), :class => "fancybox_link"%>
		<%end%>
  <% end %>
	</div>
  <div class="space-desc">

	  <h3>About <em><%=@space.name%></em></h3>

	<p><%=image_tag(logo_path(@space, :size =>48), :align => "left")%>
	<%= sanitize(space.description) if space.description.present? %></p>
  </div>	
	<div id="inc-events">
     <h3><%=image_tag("icons/date.png",:class=>"icon")%> Upcoming Events</h3>
		 <ul>  
		  <% for event in @upcoming_events -%>
		    <li class="event">
		        <h5><%=sanitize(event.title)%></strong></h5>
				<p class="small-font"><%=event.start_date.to_formatted_s(:short)%> - <%=event.end_date.to_formatted_s(:short)%></p>
		    	<%=link_to "", space_event_path(@space,event),:class=>"box-link"%>
		    </li>
		  <% end -%>
		 </ul> 
		 <div class="read_more">
		   <%= link_to "Read more", space_events_path(@space), :class => "read_more_link" if space.authorizes?([:read, :content], :to => current_user) %>
		 </div>
  </div>
<% end %>

<div id="latest_news">

        
  <% if @news_to_show %>
	  <h3><%=image_tag("icons/information.png")%> Latest News</h3>
    <%= render :partial => 'last_news' %>
  <% end %>
        
</div>

<div id="latest_posts">
    <h3><%=image_tag("icons/comment.png")%> Latest Posts</h3>
	  <%if @lastest_posts.empty?%>
	     <br/><p>There aren't recent posts</p>
	  <%else%>
	    <% for post in @lastest_posts -%>
	      <div class="post">
	        <p><strong><%=sanitize(post.title)%></strong><span class="updated"> Updated <%=time_ago_in_words(post.updated_at)%> ago</span></p>
	        <a href="" class="box-link"></a>
	      </div>
	    <% end -%>
	    <div class="read_more"> 
	      <%= link_to "Read more", space_posts_path(@space), :class => "read_more_link" if space.authorizes?([:read, :content], :to => current_user)%>
	    </div>
	  <%end%>     
</div>

<div id="latest_users">
  <h3><%=image_tag("icons/user.png")%> Recent Users Joined</h3>
  <% for user in @lastest_users -%>
    <div class="user">
    	<%if user.authorizes?([:read, :profile],:to=> current_user)%>
			<div><%=logo(user, :size=>32)%></div>
				<div>
				  <ul><commit_msg>link to posts in latest posts fixed<commit_after><% menu(:home) %>

<% content_for :javascript do  %>
  $(".news_navigation_link").livequery("click", function(){
	  var route = $(this).attr("href");
		$(this).attr("href","#")
	  $.get(route,
            {authenticity_token: "<%=form_authenticity_token()%>"},
            function(data){
              $("#last_news").replaceWith(data);
            }
          );
	});
	
	$("#join_form").submit(function(){
    var route = $(this).attr("action");
    $.post(route,
            {authenticity_token: "<%=form_authenticity_token()%>"},
            function(data){
              eval(data);
            }
          );
    return false;
  });
	
	$("#query").click(function(){
	  if(this.value == "Search..."){
		  this.value="";
		}
	});
	$(".fancybox_link").fancybox({
    'hideOnContentClick' : false
  });
	
<% end %>

<% content_for :search do  %>
  <% form_tag(search_all_path(@space), :method => 'get') do %>
			<%= text_field_tag 'query',(params[:query] ? params[:query] :  "Search...")%>
      <%= image_submit_tag "buttons/search.png"%>
  <% end %>
<%end%>

<% content_for :sidebar do  %>
  <div id="join">
  <% if space.users.include?(current_user)%>
		<%= link_to image_tag("buttons/leave-space2.png", :alt => "Leave space" ), space_performance_path(@space, @performance), :method => :delete,:title => "Leave space" %>
  <%else%>
	  <%if logged_in? && space.public?%>
		  <% form_tag join_space_path(space), :id => "join_form" do %>
	      <%= image_submit_tag("buttons/join-space.png") %>
	    <% end %>
		<%else%>
		  <%=link_to image_tag("buttons/join-space.png", :alt => "Join space"), join_space_path(space), :class => "fancybox_link"%>
		<%end%>
  <% end %>
	</div>
  <div class="space-desc">

	  <h3>About <em><%=@space.name%></em></h3>

	<p><%=image_tag(logo_path(@space, :size =>48), :align => "left")%>
	<%= sanitize(space.description) if space.description.present? %></p>
  </div>	
	<div id="inc-events">
     <h3><%=image_tag("icons/date.png",:class=>"icon")%> Upcoming Events</h3>
		 <ul>  
		  <% for event in @upcoming_events -%>
		    <li class="event">
		        <h5><%=sanitize(event.title)%></strong></h5>
				<p class="small-font"><%=event.start_date.to_formatted_s(:short)%> - <%=event.end_date.to_formatted_s(:short)%></p>
		    	<%=link_to "", space_event_path(@space,event),:class=>"box-link"%>
		    </li>
		  <% end -%>
		 </ul> 
		 <div class="read_more">
		   <%= link_to "Read more", space_events_path(@space), :class => "read_more_link" if space.authorizes?([:read, :content], :to => current_user) %>
		 </div>
  </div>
<% end %>

<div id="latest_news">

        
  <% if @news_to_show %>
	  <h3><%=image_tag("icons/information.png")%> Latest News</h3>
    <%= render :partial => 'last_news' %>
  <% end %>
        
</div>

<div id="latest_posts">
    <h3><%=image_tag("icons/comment.png")%> Latest Posts</h3>
	  <%if @lastest_posts.empty?%>
	     <br/><p>There aren't recent posts</p>
	  <%else%>
	    <% for post in @lastest_posts -%>
	      <div class="post">
	        <p><strong><%=sanitize(post.title)%></strong><span class="updated"> Updated <%=time_ago_in_words(post.updated_at)%> ago</span></p>
	        <a href=<%=space_post_path(@space, post)%> class="box-link"></a>
	      </div>
	    <% end -%>
	    <div class="read_more"> 
	      <%= link_to "Read more", space_posts_path(@space), :class => "read_more_link" if space.authorizes?([:read, :content], :to => current_user)%>
	    </div>
	  <%end%>     
</div>

<div id="latest_users">
  <h3><%=image_tag("icons/user.png")%> Recent Users Joined</h3>
  <% for user in @lastest_users -%>
    <div class="user">
    	<%if user.authorizes?([:read, :profile],:to=> current_user)%>
			<div><%=logo(user, :size=>32)%></div>
				<div>
				  <ul>
{'fraction_non_alphanumeric': 0.23315579227696404, 'fraction_numerical': 0.004527296937416778, 'mean_word_length': 3.4286556603773586, 'pattern_counts': {'":': 0, '<': 220, '<?xml version=': 0, '>': 256, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3196616', 'n_tokens_mistral': 3043, 'n_tokens_neox': 2751, 'n_words': 442}