<commit_before><%
   objects = faceted_search
   object_type = objects.first.class.name
   facet_config = YAML.load(File.read(facet_config_path))
   facets_for_object = facet_config[object_type] || {}
%>

<div style="width: 100%">
  <div data-ex-role="exhibit-collection" data-ex-item-types="<%= object_type%>"></div>
  <div class="yui-g" id="exhibit">
    <div class="yui-u first" style="width: 85%;">
      <div id="content-area">
        <div data-ex-role="exhibit-lens" style="display: none">
          <span data-ex-content=".display_content"></span>
        </div>

        <div data-ex-role="exhibit-viewPanel">
          <div data-ex-role="exhibit-view"
               data-ex-label="Tiles"
               data-ex-possible-orders=".<%= facets_for_object.keys.join(',.') %>"
               data-ex-paginate="true"
               data-ex-page-size="10"
               data-ex-show-all="true"
          ></div>
        </div>
      </div>
    </div>
    <div class="yui-u" style="float:right;width: 15%;">
      <div data-ex-role="facet" data-ex-facet-class="TextSearch" id="facet_search_box"></div>
      <br/>
      <b>Filter <%= internationalized_resource_name(object_type)%> by:</b>
      <hr/>
      <% count = 0 %>
      <% facets_for_object.each do |key, value| %>
          <% label = value['label'] %>
          <% facet_class = value['facet_class'] %>
          <div data-ex-role="facet"
               data-ex-expression=".<%= key %>"
               data-ex-facet-label="<%= label %>"
               data-ex-facet-class="<%= facet_class %>"
               data-ex-height="13em"
               data-ex-collapsible="true"

               <% if facet_class == "NumericRange" %>
               <% interval = value['interval'] %>
               data-ex-interval="<%= interval %>"
               <% end %>

               <% if facet_class == "Exhibit.HierarchicalFacet" %>
               data-ex-uniform-grouping=".subclassOf"
               data-ex-scroll="false"
               <% end %>
               <% count += 1%>
               <% if count > 1 %>
               data-ex-collapsed="true"
               <% end %>
               >
          </div>
          <br/>
      <% end %>
    </div>
  </div>
  <%= render :partial => "faceted_browsing/data_search", :locals => {:objects => objects} %>
</div>

<%= javascript_include_tag 'exhibit/locales/en/locale'%>
<%#= javascript_include_tag 'exhibit/lib/jquery-1.7.2.min'%>

<script type="text/javascript">
    Exhibit.jQuery(document).ready(initializationFunction);
    Exhibit.jQuery(document).trigger("scriptsLoaded.exhibit");
</script>


<commit_msg>add ability to dislay More or Less facets<commit_after><%
   objects = faceted_search
   object_type = objects.first.class.name
   facet_config = YAML.load(File.read(facet_config_path))
   facets_for_object = facet_config[object_type] || {}
   expand_facet_count = 1
   display_facet_count = 3
%>

<div style="width: 100%">
  <div data-ex-role="exhibit-collection" data-ex-item-types="<%= object_type%>"></div>
  <div class="yui-g" id="exhibit">
    <div class="yui-u first" style="width: 85%;">
      <div id="content-area">
        <div data-ex-role="exhibit-lens" style="display: none">
          <span data-ex-content=".display_content"></span>
        </div>

        <div data-ex-role="exhibit-viewPanel">
          <div data-ex-role="exhibit-view"
               data-ex-label="Tiles"
               data-ex-possible-orders=".<%= facets_for_object.keys.join(',.') %>"
               data-ex-paginate="true"
               data-ex-page-size="10"
               data-ex-show-all="true"
          ></div>
        </div>
      </div>
    </div>
    <div class="yui-u" style="float:right;width: 15%;">
      <div data-ex-role="facet" data-ex-facet-class="TextSearch" id="facet_search_box"></div>
      <br/>
      <b>Filter <%= internationalized_resource_name(object_type)%> by:</b>
      <hr/>
      <% count = 0 %>
      <% facets_for_object.each do |key, value| %>
          <% label = value['label'] %>
          <% facet_class = value['facet_class'] %>

          <div data-ex-role="facet"
               data-ex-expression=".<%= key %>"
               data-ex-facet-label="<%= label %>"
               data-ex-facet-class="<%= facet_class %>"
               data-ex-height="13em"
               data-ex-collapsible="true"

               <% if facet_class == "NumericRange" %>
                    <% interval = value['interval'] %>
                    data-ex-interval="<%= interval %>"
               <% end %>

               <% if facet_class == "Exhibit.HierarchicalFacet" %>
                    data-ex-uniform-grouping=".subclassOf"
                    data-ex-scroll="false"
               <% end %>
               <% count += 1%>
               <% if count > expand_facet_count %>
                    data-ex-collapsed="true"
               <% end %>
               <% if count > display_facet_count %>
                    style="display:none"
                    id="toogle_facet_<%= count %>"
               <% end %>
               >
          </div>
          <br/>
      <% end %>

      <% if facets_for_object.keys.count > display_facet_count %>
          <%= link_to_function ("More "+image("expand")).html_safe, :id => 'more_facets', :style => "float:right;margin-top:-2em;" do |page|
            page["more_facets"].toggle
            page["less_facets"].toggle
            facets_for_object.keys.each_with_index do |key, index|
              if (index + 1) > display_facet_count
                page.visual_effect(:toggle_appear, "toogle_facet_#{index + 1}", :duration => 0.3)
                #page["toogle_facet_#{index + 1}"].data-ex-collapsed="true"
              end
            end
          end
          -%>
          <%= link_to_function ("Less "+image("collapse")).html_safe, :id => 'less_facets', :style => "float:right;display:none" do |page|
            page["more_facets"].toggle
            page["less_facets"].toggle
            facets_for_object.keys.each_with_index do |key, index|
              if (index + 1) > display_facet_count
                page.visual_effect(:toggle_appear, "toogle_facet_#{index + 1}", :duration => 0.3)
              end
            end
          end
          -%>
      <% end %>

    </div>
  </div>
  <%= render :partial => "faceted_browsing/data_search", :locals => {:objects => objects} %>
</div>

<%= javascript_include_tag 'exhibit/locales/en/locale'%>
<%#= javascript_include_tag 'exhibit/lib/jquery-1.7.2.min'%>

<script type="text/javascript">
    Exhibit.jQuery(document).ready(initializationFunction);
    Exhibit.jQuery(document).trigger("scriptsLoaded.exhibit");
</script>



{'fraction_non_alphanumeric': 0.17073536019170285, 'fraction_numerical': 0.006739553691777744, 'mean_word_length': 2.02994555353902, 'pattern_counts': {'":': 0, '<': 120, '<?xml version=': 0, '>': 138, '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': '6981396', 'n_tokens_mistral': 2296, 'n_tokens_neox': 2101, 'n_words': 322}