<commit_before>{#
## This file is part of Invenio.
## Copyright (C) 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.
#}
{%- if request.args.of == 'id' -%}
{{ records }}
{%- else -%}
{% 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, record_brief_links 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 title %}
  {{ portalboxes.tp }}
  {{ super() }}
  {{ portalboxes.te }}
{% endblock %}
{% block header %}
  {{ super() }} 
  {% js url_for('search.static', filename='js/search/typeahead.js') %}
  {% js url_for('search.static', filename='js/search/facet.js') %}
  {% js url_for('static', filename='js/bootstrap-select.js') %}
  {% js "js/jquery.hotkeys.js" %}
  {% js url_for('search.static', filename='js/search/hotkeys.js') %}
  {% if records|length > 0 %}
  {%- set args = request.args.copy().to_dict() -%}
  {%- set jrec = (pagination.page-2)*pagination.per_page+1 if pagination.has_prev else 1 -%}
  {%- do args.update({'p': records[0][0], 'f': f}) -%}
  {%- if pagination.has_prev -%}
  <link rel="prev" href="{{ url_for(request.endpoint, **args) }}"/>
  {%- endif -%}
  {%- if pagination.has_next -%}
  {%- set jrec = (pagination.page)*pagination.per_page+1 if pagination.has_next else (pagination.pages-1)*pagination.per_page+1 -%}
  {%- do args.update({'p': f ~ (':' if f) ~ records[-1][0]}) -%}
  <link rel="next" href="{{ url_for(request.endpoint, **args) }}"/>
  {%- endif -%}
  {% endif %}
{% endblock %}


{% block body %}

<style>
.modal-backdrop {
  /* Show lighter modal window for search. */
  background-color: rgba(255,255,255,0.5);
}

body {
  position: relative;
}

</style>


{{ search_form(collection, easy_search_form) }}


{% if not records|length %}

<div class="row">
  <div class="col-md-12">
    <p>
      <strong>{{ _('Your search did not match any records. Please try again.') }}</strong>
    </p>
    {{ create_nearest_terms_box()|safe }}
  </div>
</div>

{% else %}

<div class="row">
  <div class="col-md-12">
    <table class="table table-striped table-hover">
      <tr>
        <th style="width: 20%">{{ _('Hits') }}</th>
        <th>{{ _('Values') }} <small>{{ f if f }}</small></th>
      </tr>
      {%- set args = request.args.copy().to_dict() -%}
      {%- do args.pop('action_browse', None) -%}
      {%- do args.pop('f', None) -%}
      {% for record in records %}
      <tr>
        <td>{{ record[1] }}</td>
        <td>
          {%- do args.update({'p': f ~ (':' if f) ~ record[0]}) -%}
          <a href="{{ url_for('search.search',  **args) }}">{{ record[0] }}</a>
        </td>
      </tr>
    {% endfor %}
    </table>

    <ul class="pager">
      <li class="previous">
        {%- do args.update({'p': f ~ (':' if f) ~ records[0][0], 'action_browse': ''}) -%}
        <a href="{{ url_for('search.search',  **args) }}">
          &larr; {{ _('Previous') }}
        </a>
      </li>
      <li class="next">
        {%- do args.update({'p': f ~ (':' if f) ~ records[-1][0], 'action_browse': ''}) -%}
        <a href="{{ url_for('search.search',  **args) }}">
          {{ _('Next') }} &rarr;
        </a>
      </li>
    </ul>
  </div>
</div>
{%- endif -%}
{% endblock body %}

{% block javascript %}
{{ search_form_javascript(collection) }}
{% endblock %}

{%- endif -%}
<commit_msg>search: browse.html inheritance change<commit_after>{#
## This file is part of Invenio.
## Copyright (C) 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.
#}
{%- if request.args.of == 'id' -%}
{{ records }}
{%- else -%}
{% from "_formhelpers.html" import render_filter_form with context %}
{% from "search/helpers.html" import collection_tree, portalbox_sidebar, search_also,  record_brief_links with context %}
{% extends "search/searchbar_frame.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 title %}
  {{ portalboxes.tp }}
  {{ super() }}
  {{ portalboxes.te }}
{% endblock %}
{% block header %}
  {{ super() }}
  {% if records|length > 0 %}
  {%- set args = request.args.copy().to_dict() -%}
  {%- set jrec = (pagination.page-2)*pagination.per_page+1 if pagination.has_prev else 1 -%}
  {%- do args.update({'p': records[0][0], 'f': f}) -%}
  {%- if pagination.has_prev -%}
  <link rel="prev" href="{{ url_for(request.endpoint, **args) }}"/>
  {%- endif -%}
  {%- if pagination.has_next -%}
  {%- set jrec = (pagination.page)*pagination.per_page+1 if pagination.has_next else (pagination.pages-1)*pagination.per_page+1 -%}
  {%- do args.update({'p': f ~ (':' if f) ~ records[-1][0]}) -%}
  <link rel="next" href="{{ url_for(request.endpoint, **args) }}"/>
  {%- endif -%}
  {% endif %}
{% endblock %}


{% block inner_content %}

<style>
.modal-backdrop {
  /* Show lighter modal window for search. */
  background-color: rgba(255,255,255,0.5);
}

body {
  position: relative;
}

</style>


{% if not records|length %}

<div class="row">
  <div class="col-md-12">
    <p>
      <strong>{{ _('Your search did not match any records. Please try again.') }}</strong>
    </p>
    {{ create_nearest_terms_box()|safe }}
  </div>
</div>

{% else %}

<div class="row">
  <div class="col-md-12">
    <table class="table table-striped table-hover">
      <tr>
        <th style="width: 20%">{{ _('Hits') }}</th>
        <th>{{ _('Values') }} <small>{{ f if f }}</small></th>
      </tr>
      {%- set args = request.args.copy().to_dict() -%}
      {%- do args.pop('action_browse', None) -%}
      {%- do args.pop('f', None) -%}
      {% for record in records %}
      <tr>
        <td>{{ record[1] }}</td>
        <td>
          {%- do args.update({'p': f ~ (':' if f) ~ record[0]}) -%}
          <a href="{{ url_for('search.search',  **args) }}">{{ record[0] }}</a>
        </td>
      </tr>
    {% endfor %}
    </table>

    <ul class="pager">
      <li class="previous">
        {%- do args.update({'p': f ~ (':' if f) ~ records[0][0], 'action_browse': ''}) -%}
        <a href="{{ url_for('search.search',  **args) }}">
          &larr; {{ _('Previous') }}
        </a>
      </li>
      <li class="next">
        {%- do args.update({'p': f ~ (':' if f) ~ records[-1][0], 'action_browse': ''}) -%}
        <a href="{{ url_for('search.search',  **args) }}">
          {{ _('Next') }} &rarr;
        </a>
      </li>
    </ul>
  </div>
</div>
{%- endif -%}
{% endblock inner_content %}

{%- endif -%}

{'fraction_non_alphanumeric': 0.2110035534860924, 'fraction_numerical': 0.013478740350447249, 'mean_word_length': 3.1077000503271264, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 95, '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': '2885509', 'n_tokens_mistral': 3050, 'n_tokens_neox': 2822, 'n_words': 749}