Skip to content

Commit

Permalink
global: apply changes for Invenio 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ntarocco committed May 13, 2020
1 parent 7ce93c0 commit 86ea4fb
Show file tree
Hide file tree
Showing 14 changed files with 92 additions and 56 deletions.
1 change: 1 addition & 0 deletions {{cookiecutter.project_shortname}}/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
],
'invenio_assets.webpack': [
'{{ cookiecutter.package_name }}_theme = {{ cookiecutter.package_name }}.theme.webpack:theme',
'{{ cookiecutter.package_name }}_search_app = {{ cookiecutter.package_name }}.records.webpack:search_app',
],
'invenio_config.module': [
'{{ cookiecutter.package_name }} = {{ cookiecutter.package_name }}.config',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def _(x):

# Theme configuration
# ===================
#: Site name
#: The Invenio theme.
APP_THEME = ['semantic-ui']
#: Site name.
THEME_SITENAME = _('{{cookiecutter.project_name}}')
#: Use default frontpage.
THEME_FRONTPAGE = True
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";
import { overrideStore } from "react-overridable";
import { Card, Item, List } from "semantic-ui-react";

const {{datamodel_extension_class}}ResultsListItem = ({ result, index }) => {
const contributors = result.metadata.contributors || [];
return (
<Item key={index} href={`/records/{{ result.id }}`}>
<Item.Content>
<Item.Header>{result.metadata.title}</Item.Header>
<Item.Description>
{contributorsList && (
<List horizontal relaxed>
{contributors.map((contributor) => (
<List.Item>{contributor.name}</List.Item>
))}
</List>
)}
</Item.Description>
</Item.Content>
</Item>
);
};

overrideStore.add("ResultsList.item", {{datamodel_extension_class}}ResultsListItem);

const {{datamodel_extension_class}}ResultsGridItem = ({ result, index }) => {
const contributors = result.metadata.contributors || [];
return (
<Card fluid key={index} href={`/records/{{ result.id }}`}>
<Card.Content>
<Card.Header>{result.metadata.title}</Card.Header>
<Card.Description>
{contributorsList && (
<List horizontal relaxed>
{contributors.map((contributor) => (
<List.Item>{contributor.name}</List.Item>
))}
</List>
)}
</Card.Description>
</Card.Content>
</Card>
);
};

overrideStore.add("ResultsGrid.item", {{datamodel_extension_class}}ResultsGridItem);
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def _(x):
)
"""Records UI for {{cookiecutter.project_shortname}}."""

SEARCH_UI_JSTEMPLATE_RESULTS = 'templates/records/results.html'
"""Result list template."""
SEARCH_UI_SEARCH_TEMPLATE = '{{cookiecutter.package_name}}/records/search.html'

PIDSTORE_RECID_FIELD = '{{ cookiecutter.datamodel_pid_name }}'

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% include 'misc/header.tpl' -%}{% raw %}
{%- extends config.RECORDS_UI_BASE_TEMPLATE %}

{% from 'invenio_previewer/macros.html' import file_list, preview_file %}
{% from 'semantic-ui/invenio_previewer/macros.html' import file_list, preview_file %}

{%- macro record_content(data) %}
{% set ignore_list = ['_bucket', '$schema'] %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "semantic-ui/invenio_search_ui/search.html" %}

{%- block javascript_override_searchapp %}
{{ webpack['{%- endraw %}{{cookiecutter.project_shortname}}{%- raw %}-search-app.js'] }}
{%- endblock javascript_override_searchapp %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% include 'misc/header.py' %}
"""JS/CSS Webpack bundle to override search results template."""

from invenio_assets.webpack import WebpackThemeBundle

search_app = WebpackThemeBundle(
__name__,
'assets',
default='semantic-ui',
themes={
'semantic-ui': dict(
entry={
'{{ cookiecutter.project_shortname }}-search-app': './js/{{ cookiecutter.package_name }}/records/search_app_customizations.js',
},
dependencies={}
)
}
)

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% include 'misc/header.jinja2' %}
{%- raw %}
{%- extends "invenio_theme/frontpage.html" %}
{%- extends "semantic-ui/invenio_theme/frontpage.html" %}

{%- block page_body %}
<div class="container marketing">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{% include 'misc/header.jinja2' %}
{%- raw %}
{%- extends "invenio_theme/page.html" %}
{%- extends "semantic-ui/invenio_theme/page.html" %}

{%- block css %}
{{ super() }}
{{ webpack['{%- endraw %}{{cookiecutter.project_shortname}}{%- raw %}-theme.css'] }}
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{% include 'misc/header.py' %}
"""JS/CSS Webpack bundles for theme."""

from __future__ import absolute_import, print_function
from invenio_assets.webpack import WebpackThemeBundle

from flask_webpackext import WebpackBundle

theme = WebpackBundle(
theme = WebpackThemeBundle(
__name__,
'assets',
entry={
'{{ cookiecutter.project_shortname }}-theme': './scss/{{ cookiecutter.package_name }}/theme.scss',
'{{ cookiecutter.project_shortname }}-preview': './js/{{ cookiecutter.package_name }}/previewer.js',
},
dependencies={
# add any additional npm dependencies here...
default='semantic-ui',
themes={
'semantic-ui': dict(
entry={
# CHANGE ME TO LESS '{{ cookiecutter.project_shortname }}-theme': './less/{{ cookiecutter.package_name }}/theme.less',
'{{ cookiecutter.project_shortname }}-preview': './js/{{ cookiecutter.package_name }}/previewer.js',
},
dependencies={
# add any additional npm dependencies here...
}
)
}
)

0 comments on commit 86ea4fb

Please sign in to comment.