forked from cernopendata/opendata.cern.ch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
collections: introduce collection pages
* uses forked ‘pamfilos/invenio-collection’ with model updates * address cernopendata#1315 Signed-off-by: Pamfilos Fokianos <pamfilosf@gmail.com>
- Loading branch information
Showing
6 changed files
with
179 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{%- extends 'cernopendata_theme/page.html' %} | ||
|
||
{% from "macros/search_base.html" import search_component %} | ||
|
||
{%- block javascript %} | ||
{{ super() }} | ||
{% assets "invenio_search_ui_search_js" %}<script src="{{ ASSET_URL }}"></script>{% endassets %} | ||
|
||
{# assets "cernopendata_theme_js" %}<script src="{{ ASSET_URL }}"></script>{% endassets #} | ||
<script> | ||
angular.module('invenioSearch').filter('unsafe', function($sce) { return $sce.trustAsHtml; }); | ||
</script> | ||
{% assets "cernopendata_search_js" %}<script src="{{ ASSET_URL }}"></script>{% endassets %} | ||
{%- endblock javascript %} | ||
|
||
{%- block page_body %} | ||
<div class="container"> | ||
<h2>{{ collection.name }}</h2> | ||
<hr> | ||
<div class="row"> | ||
<div class="col-sm-12"> | ||
{% if collection.description %} | ||
<h2>{{ collection.description }}. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium officia praesentium hic, veritatis totam libero alias nostrum provident ex eaque quibusdam, saepe perspiciatis laboriosam nisi, asperiores eius excepturi qui voluptatibus.</h2> | ||
<hr> | ||
{% endif %} | ||
{% for child_col in collection.children %} | ||
<a href="{{ url_for('invenio_collections.collection', name=child_col.name)}}">{{ child_col.name }}</a> {{ "|" if not loop.last }} | ||
{% endfor %} | ||
<hr> | ||
|
||
{{ | ||
search_component(config.SEARCH_UI_SEARCH_API+"?collections="+collection.name) }} | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
{%- endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{%- macro search_component( | ||
endpoint=config.SEARCH_UI_SEARCH_API | ||
) | ||
%} | ||
|
||
|
||
<div id="invenio-search"> | ||
<invenio-search | ||
search-endpoint="{{endpoint}}" | ||
search-hidden-params='{% if search_hidden_params %}{{search_hidden_params|tojson}}{% endif %}' | ||
search-headers='{"Accept": "{{ config.SEARCH_UI_SEARCH_MIMETYPE|default('application/json')}}"}' | ||
> | ||
<div class="search-page"> | ||
<div class="row"> | ||
{%- block search_body %} | ||
<div class="col-xs-12 col-md-9 col-md-push-3"> | ||
{%- block search_header %} | ||
<div class="row"> | ||
{%- block search_count %} | ||
<div class="col-md-3 col-sm-12"> | ||
<invenio-search-count | ||
template="{{ url_for('static', filename=config.SEARCH_UI_JSTEMPLATE_COUNT) }}"> | ||
</invenio-search-count> | ||
</div> | ||
{%- endblock search_count %} | ||
{%- block search_pagination_top %} | ||
<div class="col-md-6 col-sm-12 text-center"> | ||
<invenio-search-pagination | ||
template="{{ url_for('static', filename=config.SEARCH_UI_JSTEMPLATE_PAGINATION) }}"> | ||
</invenio-search-pagination> | ||
</div> | ||
{%- endblock search_pagination_top %} | ||
{%- block search_sort %} | ||
{%- set sort_options = config.get('RECORDS_REST_SORT_OPTIONS', {}).get(config.SEARCH_UI_SEARCH_INDEX) %} | ||
{%- if sort_options %} | ||
<div class="col-md-3 col-sm-12 text-right"> | ||
{%- block search_sort_select scoped %} | ||
Sort by: | ||
<invenio-search-select-box | ||
sort-key="sort" | ||
available-options='{{ sort_options|format_sortoptions|safe }}' | ||
template="{{ url_for('static', filename=config.SEARCH_UI_JSTEMPLATE_SELECT_BOX) }}" | ||
> | ||
</invenio-search-select-box> | ||
{%- endblock search_sort_select %} | ||
{%- block search_sort_order scoped %} | ||
<invenio-search-sort-order | ||
sort-key="sort" | ||
template="{{ url_for('static', filename=config.SEARCH_UI_JSTEMPLATE_SORT_ORDER) }}" | ||
> | ||
</invenio-search-sort-order> | ||
{%- endblock search_sort_order %} | ||
</div> | ||
{%- endif %} | ||
{%- endblock search_sort %} | ||
</div> | ||
<hr class="no-margin-top" /> | ||
{%- endblock search_header %} | ||
{%- block search_error %} | ||
<invenio-search-error | ||
template="{{ url_for('static', filename=config.SEARCH_UI_JSTEMPLATE_ERROR) }}" | ||
message="{{ _('Search failed.') }}"> | ||
</invenio-search-error> | ||
{%- endblock search_error %} | ||
{%- block search_loading %} | ||
<invenio-search-loading | ||
template="{{ url_for('static', filename=config.SEARCH_UI_JSTEMPLATE_LOADING) }}" | ||
message="{{ _('Loading...') }}"> | ||
</invenio-search-loading> | ||
{%- endblock search_loading %} | ||
{%- block search_results %} | ||
<invenio-search-results | ||
template="{{ url_for('static', filename='templates/cernopendata_search_ui/results.html') }}"> | ||
</invenio-search-results> | ||
{%- endblock search_results %} | ||
{%- block search_pagination_bottom %} | ||
<div align="center"> | ||
<invenio-search-pagination | ||
template="{{ url_for('static', filename=config.SEARCH_UI_JSTEMPLATE_PAGINATION) }}"> | ||
</invenio-search-pagination> | ||
</div> | ||
{%- endblock search_pagination_bottom %} | ||
</div> | ||
{%- endblock search_body %} | ||
{%- block search_facets %} | ||
<div class="col-md-3 col-md-pull-9 col-xs-12"> | ||
<invenio-search-facets | ||
template="{{ url_for('static', filename='templates/cernopendata_search_ui/facets.html') }}"> | ||
</invenio-search-facets> | ||
</div> | ||
{%- endblock search_facets %} | ||
</div> | ||
</div> | ||
</invenio-search> | ||
</div> | ||
{%- endmacro %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters