<commit_before><% content_for :javascript do  %>
  $(".space_item").hover(
	  function () {
		    var route = "div#" + $(this).attr("name");
				$("#space_description div").hide();
				$(route).show();
				
      }, 
      function () {

      }
    );
  
	/* TODO with <NAME> */ 
  $(".unautorized form").submit(function(){
	  var route = $(this).attr("action");
    $.post(route,
            {authenticity_token: "<%=form_authenticity_token()%>"},
            function(data){
						  $("#lightbox_content").children().remove();
              $("#lightbox_content").append(data);
							$("<a href=\"#lightbox_content\"></a>").fancybox({
                'hideOnContentClick' : false
              }).click();
            }
          );
		return false;
  });
<% end %>


<% content_for :sidebar do  %>
  <div class="join">
    <h2>Start now!</h2>
    <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
    <%=link_to image_tag("new-space.jpg"),new_space_path(), :class => "new_space_link"%>  
  </div>
  <div id="space_description">
  	<% for space in @spaces %>
		  <div style="display:none;" id="<%=space.permalink%>" >
			  <%= render :partial=> "space_description", :locals => {:space => space}%>
		  </div>
		<%end%>
  </div>
<% end %>

<% @page_title = "Spaces"-%>

<h3>Private Spaces</h3>

<div id = "private_spaces">
	<% for space in @private_spaces %>
	  <% unless space.authorizes?(:read, :to => current_agent) %>
	    <div class="space_item unautorized" name="<%=space.permalink%>">
			  <% form_tag join_space_path(space) do %>
          <%= image_submit_tag(logo_path (space, :size=> 48, :title => space.name, :alt => space.name))%>
        <% end %>
			</div>
		<% else %>
		  <div class="space_item" name="<%=space.permalink%>"><%=link_logo (space, :size=> 48, :title => space.name, :alt => space.name)%></div>
		<% end %>
	<% end %>
</div>

<h3>Public Spaces</h3>

<div id = "public_spaces">
  <ul>
  <% for space in @public_spaces %>
    <% unless space.authorizes?(:read, :to => current_agent) %>
      <li class="space_item unautorized" name="<%=space.permalink%>">
        <%=link_logo (space, :size=> 48, :title => space.name)%> <%= link_to sanitize(space.name), space %>
        <% form_for [ space, JoinRequest.new ] do |f| %>
          <%= f.submit "Join Request" %>
        <% end %>
      </li>
    <% else %>
      <li class="space_item" name="<%=space.permalink%>"><%=link_logo (space, :size=> 48, :title => space.name, :alt => space.name)%></li>
    <% end %>
  <% end %>
  </ul>
</div>

<div id="lightbox_content" style="display:none"></div><commit_msg>jquery space filter in space index<commit_after><% content_for :javascript do  %>
  
	$("#space_filter").show();
	
	$("input#public").click(function(){
	  $("#public_spaces").slideToggle("slow");
	});
	
	$("input#private").click(function(){
    $("#private_spaces").slideToggle("slow");
  });
	
	$("#space_name_filter").keyup(function(){
	  var filter_text = this.value.toLowerCase();
    $("div.space_item").each(function() {
        if($(this).attr("name").toLowerCase().search(filter_text)>=0){
          $(this).css({ display:"inline"})
      }else{
          $(this).hide();
      }
      });
	});

  $(".space_item").hover(
	  function () {
		    var route = "div#" + $(this).attr("name");
				$("#space_description div").hide();
				$(route).show();
				
      }, 
      function () {

      }
    );
  
  $(".unautorized form").submit(function(){
	  var route = $(this).attr("action");
    $.post(route,
            {authenticity_token: "<%=form_authenticity_token()%>"},
            function(data){
						  $("#lightbox_content").children().remove();
              $("#lightbox_content").append(data);
							$("<a href=\"#lightbox_content\"></a>").fancybox({
                'hideOnContentClick' : false
              }).click();
            }
          );
		return false;
  });
<% end %>


<% content_for :sidebar do  %>
  <div class="join">
    <h2>Start now!</h2>
    <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
    <%=link_to image_tag("new-space.jpg"),new_space_path(), :class => "new_space_link"%>  
  </div>
  <div id="space_description">
  	<% for space in @spaces %>
		  <div style="display:none;" id="<%=space.permalink%>" >
			  <%= render :partial=> "space_description", :locals => {:space => space}%>
		  </div>
		<%end%>
  </div>
<% end %>

<% @page_title = "Spaces"-%>

<div id="space_filter" style="display:none">
	Space filter: <%=text_field_tag 'space_name_filter'%>
 <%= check_box_tag "public","public",true%><%= label_tag "public"%>  <%= check_box_tag "private","private",true%><%= label_tag "private" %>
</div>

<div id = "private_spaces">

  <h3>Private Spaces</h3>

	<% for space in @private_spaces %>
	  <% unless space.authorizes?(:read, :to => current_agent) %>
	    <div class="space_item unautorized" name="<%=space.permalink%>">
			  <% form_tag join_space_path(space) do %>
          <%= image_submit_tag(logo_path (space, :size=> 48, :title => space.name, :alt => space.name))%>
        <% end %>
			</div>
		<% else %>
		  <div class="space_item" name="<%=space.permalink%>"><%=link_logo (space, :size=> 48, :title => space.name, :alt => space.name)%></div>
		<% end %>
	<% end %>
</div>

<div id = "public_spaces">

  <h3>Public Spaces</h3>

  <% for space in @public_spaces %>
    <div class="space_item" name="<%=space.permalink%>"><%=link_logo (space, :size=> 48, :title => space.name, :alt => space.name)%></div>
  <% end %>
</div>

<div id="lightbox_content" style="display:none"></div>
{'fraction_non_alphanumeric': 0.22398271516024487, 'fraction_numerical': 0.004861361181130717, 'mean_word_length': 3.230769230769231, 'pattern_counts': {'":': 0, '<': 132, '<?xml version=': 0, '>': 164, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6791436', 'n_tokens_mistral': 2153, 'n_tokens_neox': 1922, 'n_words': 355}