<commit_before>{#
## This file is part of Invenio.
## Copyright (C) 2012, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#}
{% from "_formhelpers.html" import render_filter_form with context %}
{% from "search/helpers.html" import collection_tree, portalbox_sidebar, search_also, search_form, search_form_javascript  with context %}
{% extends "page.html" %}
{# set title = collection.name_ln if collection.id > 1 else None #}
{% set title = None %}

{%- set portalboxes = dict() -%}
{%- for k,l in collection.portalboxes_ln|groupby('position') -%}
  {%- do portalboxes.update({k:l}) -%}
{%- endfor -%}

{% block header %}
  {{ super() }}
  {% js url_for('search.static', filename='js/search/typeahead.js') %}
  {% js url_for('static', filename='js/bootstrap-select.js') %}
{% endblock %}

{% block title %}
  {{ portalboxes.tp }}
  {{ super() }}
  {{ portalboxes.te }}
{% endblock %}

{% macro collection_records(collection) %}
<style>
.websearch .nav > li > ul > li {
  float: left;
}
.websearch .nav > li a {
  display: inline;
}
.websearch .nav > li > a {
  white-space: nowrap;
}
.websearch .nav > li > a:hover {
  background-color: inherit;
}
.websearch ul.nav > li > ul {
  clear: both;
}
.websearch ul.nav > li > ul > li {
  display: inline;
}
.websearch ul.nav > li > ul > li > a {
  display: inline;
}
.websearch .badge {
  font-size: 80%;
}

.collection ul.nav-list {
  padding-left: 0px;
}

.collection ul.nav-list ul.nav-list {
  font-size: 90%;
}

.collection ul ul li a {
  color: #333;
  opacity: 0.8;
}

.collection .badge {
  opacity:0.6;
  font-size:80%;
}

.collection ul ul .badge {
  color: #333;
  background-color: #EEE;
  border: 1px solid #999;
}

</style>

{{ search_form(collection) }}

<div class="row websearch clearfix"><!-- row 2 -->
  {{ portalbox_sidebar(portalboxes.lt, class="span2") }}

  {% if collection.collection_children_r %}
    <div class="span{{ '4' if collection.collection_children_v else '8' }} collection clearfix">
      <h4>{{ _("Narrow by collection:") }}</h4>
      {{ collection_tree(collection.collection_children_r, limit=2, class="nav nav-list clearfix") }}
    </div>
  {% else %}
      <div class="span{{ '4' if collection.collection_children_v else '8' }}">
      {% if collection.is_restricted %}
        <strong>{{ _('This collection is restricted. If you are authorized to access it, please click on the Search button.') }}</strong>
      {% else %}
        {% if collection.reclist %}
        <div class="page-header">
          <h3>{{ _("Latest additions:") }}</h3>
        </div>
        {%- set of = request.values.get('of', 'hb') -%}
        {% for recid in collection.reclist[-10:]|reverse %}
        <div class="row-fluid">
          <div class="span12">
            {{ format_record(recid, of, ln=g.ln)|safe }}
            {{ '<hr/>'|safe if not loop.last }}
          </div>
        </div>
        {% endfor %}
        {% if collection.reclist|length > 10 %}
          <a href="{{ url_for('search.search', cc=collection.name, ln=g.ln, jrec=11)|safe }}"
             class="pull-right muted">[&gt;&gt; {{ _('more')}}]</a>
        {% endif %}
        {% endif %}
      {% endif %}
      </div>
  {% endif %}

  {% if collection.collection_children_v %}
    <div class="span4 collection clearfix">
      <h4>{{ _("Focus on:") }}</h4>
      {{ collection_tree(collection.collection_children_v, limit=2, class="nav nav-list clearfix") }}

      {{ search_also(collection.externalcollections_2) }}
    </div>
  {% elif collection.externalcollections_2 %}
      <div class="span2">
        {{ search_also(collection.externalcollections_2) }}
      </div>
  {% endif %}

  {% if collection.externalcollections_2 %}
    {{ portalbox_sidebar(portalboxes.rt, class="span2") }}
  {% else %}
    {{ portalbox_sidebar(portalboxes.rt, class="offset2 span2") }}
  {% endif %}

</div>
{% endmacro %}

{% block body %}

{% if collection.is_restricted %}
  {{ collection_records(collection) }}
{% else %}
  {% cache 24*60*60, collection.name, g.ln %}
    {{ collection_records(collection) }}
  {% endcache %}
{% endif %}

{% endblock %}

{% block javascript %}
<script>
(function($) {
  $('[rel=tooltip]').tooltip();
})(jQuery);
</script>
{{ search_form_javascript(collection)}}
{% endblock %}
<commit_msg>search: clearer collection name in search pages<commit_after>{#
## This file is part of Invenio.
## Copyright (C) 2012, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#}
{% from "_formhelpers.html" import render_filter_form with context %}
{% from "search/helpers.html" import collection_tree, portalbox_sidebar, search_also, search_form, search_form_javascript  with context %}
{% extends "page.html" %}
{# set title = collection.name_ln if collection.id > 1 else None #}
{% set title = None %}

{%- set portalboxes = dict() -%}
{%- for k,l in collection.portalboxes_ln|groupby('position') -%}
  {%- do portalboxes.update({k:l}) -%}
{%- endfor -%}

{% block header %}
  {{ super() }}
  {% js url_for('search.static', filename='js/search/typeahead.js') %}
  {% js url_for('static', filename='js/bootstrap-select.js') %}
{% endblock %}

{% block title %}
  {{ portalboxes.tp }}
  {{ super() }}
  {{ portalboxes.te }}
{% endblock %}

{% macro collection_records(collection) %}
<style>
.websearch .nav > li > ul > li {
  float: left;
}
.websearch .nav > li a {
  display: inline;
}
.websearch .nav > li > a {
  white-space: nowrap;
}
.websearch .nav > li > a:hover {
  background-color: inherit;
}
.websearch ul.nav > li > ul {
  clear: both;
}
.websearch ul.nav > li > ul > li {
  display: inline;
}
.websearch ul.nav > li > ul > li > a {
  display: inline;
}
.websearch .badge {
  font-size: 80%;
}

.collection ul.nav-list {
  padding-left: 0px;
}

.collection ul.nav-list ul.nav-list {
  font-size: 90%;
}

.collection ul ul li a {
  color: #333;
  opacity: 0.8;
}

.collection .badge {
  opacity:0.6;
  font-size:80%;
}

.collection ul ul .badge {
  color: #333;
  background-color: #EEE;
  border: 1px solid #999;
}

</style>

{{ search_form(collection) }}

<div class="row websearch clearfix"><!-- row 2 -->
  {{ portalbox_sidebar(portalboxes.lt, class="span2") }}

  {% if collection.collection_children_r %}
    <div class="span{{ '4' if collection.collection_children_v else '8' }} collection clearfix">
      <h4>{{ _("Narrow by collection:") }}</h4>
      {{ collection_tree(collection.collection_children_r, limit=2, class="nav nav-list clearfix") }}
    </div>
  {% else %}
      <div class="span{{ '4' if collection.collection_children_v else '8' }}">
      {% if collection.is_restricted %}
        <strong>{{ _('This collection is restricted. If you are authorized to access it, please click on the Search button.') }}</strong>
      {% else %}
        {% if collection.reclist %}
        <div class="page-header">
          <h3>{{ collection.name + ":" }}</h3>
        </div>
        {%- set of = request.values.get('of', 'hb') -%}
        {% for recid in collection.reclist[-10:]|reverse %}
        <div class="row-fluid">
          <div class="span12">
            {{ format_record(recid, of, ln=g.ln)|safe }}
            {{ '<hr/>'|safe if not loop.last }}
          </div>
        </div>
        {% endfor %}
        {% if collection.reclist|length > 10 %}
          <a href="{{ url_for('search.search', cc=collection.name, ln=g.ln, jrec=11)|safe }}"
             class="pull-right muted">[&gt;&gt; {{ _('more')}}]</a>
        {% endif %}
        {% endif %}
      {% endif %}
      </div>
  {% endif %}

  {% if collection.collection_children_v %}
    <div class="span4 collection clearfix">
      <h4>{{ _("Focus on:") }}</h4>
      {{ collection_tree(collection.collection_children_v, limit=2, class="nav nav-list clearfix") }}

      {{ search_also(collection.externalcollections_2) }}
    </div>
  {% elif collection.externalcollections_2 %}
      <div class="span2">
        {{ search_also(collection.externalcollections_2) }}
      </div>
  {% endif %}

  {% if collection.externalcollections_2 %}
    {{ portalbox_sidebar(portalboxes.rt, class="span2") }}
  {% else %}
    {{ portalbox_sidebar(portalboxes.rt, class="offset2 span2") }}
  {% endif %}

</div>
{% endmacro %}

{% block body %}

{% if collection.is_restricted %}
  {{ collection_records(collection) }}
{% else %}
  {% cache 24*60*60, collection.name, g.ln %}
    {{ collection_records(collection) }}
  {% endcache %}
{% endif %}

{% endblock %}

{% block javascript %}
<script>
(function($) {
  $('[rel=tooltip]').tooltip();
})(jQuery);
</script>
{{ search_form_javascript(collection)}}
{% endblock %}

{'fraction_non_alphanumeric': 0.16992207266471004, 'fraction_numerical': 0.016597510373443983, 'mean_word_length': 3.328515111695138, 'pattern_counts': {'":': 1, '<': 67, '<?xml version=': 0, '>': 105, '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': '7653701', 'n_tokens_mistral': 3481, 'n_tokens_neox': 3171, 'n_words': 869}