diff --git a/{{cookiecutter.project_shortname}}/Pipfile b/{{cookiecutter.project_shortname}}/Pipfile
index 3861d23..5b0dbdf 100644
--- a/{{cookiecutter.project_shortname}}/Pipfile
+++ b/{{cookiecutter.project_shortname}}/Pipfile
@@ -6,7 +6,7 @@ name = "pypi"
[packages]
Babel = ">=2.4.0"
Flask-BabelEx = ">=0.9.3"
-invenio = { version = ">=3.2.0,<3.3.0", extras = ["base", "auth", "metadata", "files", "{{ cookiecutter.database }}", "elasticsearch{{ cookiecutter.elasticsearch }}" ]}
+invenio = { version = ">=3.4.0a1,<3.5.0", extras = ["base", "auth", "metadata", "files", "{{ cookiecutter.database }}", "elasticsearch{{ cookiecutter.elasticsearch }}" ]}
lxml = ">=3.5.0,<4.2.6"
marshmallow = ">=3.0.0,<4.0.0"
uwsgi = ">=2.0"
diff --git a/{{cookiecutter.project_shortname}}/scripts/bootstrap b/{{cookiecutter.project_shortname}}/scripts/bootstrap
index 01d55e6..c5e395f 100755
--- a/{{cookiecutter.project_shortname}}/scripts/bootstrap
+++ b/{{cookiecutter.project_shortname}}/scripts/bootstrap
@@ -6,13 +6,20 @@ set -e
script_path=$(dirname "$0")
pipfile_lock_path="$script_path/../Pipfile.lock"
-if [ ! -f $pipfile_lock_path ]; then
- echo "'Pipfile.lock' not found. Generating via 'pipenv lock --dev'..."
- pipenv lock --dev
-fi
+# START: PUT ME BACK
+# if [ ! -f $pipfile_lock_path ]; then
+# echo "'Pipfile.lock' not found. Generating via 'pipenv lock --dev'..."
+# pipenv lock --dev
+# fi
+
+# # Installs all packages specified in Pipfile.lock
+# pipenv sync --dev
+# /END: PUT ME BACK
+
+# START: REMOVE ME
+pipenv run pip install -e git+https://github.com/inveniosoftware/invenio.git#egg=invenio["base","auth","metadata","files","postgresql","elasticsearch7"]
+# /END: REMOVE ME
-# Installs all packages specified in Pipfile.lock
-pipenv sync --dev
# Install application code and entrypoints from 'setup.py'
pipenv run pip install -e $script_path/..
# Build assets
diff --git a/{{cookiecutter.project_shortname}}/setup.py b/{{cookiecutter.project_shortname}}/setup.py
index 94642ae..655d181 100644
--- a/{{cookiecutter.project_shortname}}/setup.py
+++ b/{{cookiecutter.project_shortname}}/setup.py
@@ -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',
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/config.py b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/config.py
index 1f606f0..47551ed 100644
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/config.py
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/config.py
@@ -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
@@ -169,7 +171,6 @@ def _(x):
APP_DEFAULT_SECURE_HEADERS['content_security_policy'] = {
'default-src': ["'self'", "'unsafe-inline'"],
'object-src': ["'none'"],
- 'style-src': ["'self'", "'unsafe-inline'"],
- 'font-src': ["'self'", "data:", "https://fonts.gstatic.com",
- "https://fonts.googleapis.com"],
+ 'style-src': ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"],
+ 'font-src': ["'self'", "data:", "https://fonts.gstatic.com"],
}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/assets/semantic-ui/js/{{cookiecutter.package_name}}/search_app_customizations.js b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/assets/semantic-ui/js/{{cookiecutter.package_name}}/search_app_customizations.js
new file mode 100644
index 0000000..86e23e0
--- /dev/null
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/assets/semantic-ui/js/{{cookiecutter.package_name}}/search_app_customizations.js
@@ -0,0 +1,84 @@
+{%- include 'misc/header.js' %}{%- raw %}
+import React from "react";
+import { overrideStore } from "react-overridable";
+import { Card, Input, Item, List } from "semantic-ui-react";
+
+const {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}ResultsListItem = ({ result, index }) => {
+ const contributors = result.metadata.contributors || [];
+ return (
+ -
+
+ {result.metadata.title}
+
+ {contributors && (
+
+ {contributors.map((contributor, idx) => (
+ {contributor.name}
+ ))}
+
+ )}
+
+
+
+ );
+};
+
+overrideStore.add("ResultsList.item", {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}ResultsListItem);
+
+const {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}ResultsGridItem = ({ result, index }) => {
+ const contributors = result.metadata.contributors || [];
+ return (
+
+
+ {result.metadata.title}
+
+ {contributors && (
+
+ {contributors.map((contributor, idx) => (
+ {contributor.name}
+ ))}
+
+ )}
+
+
+
+ );
+};
+
+overrideStore.add("ResultsGrid.item", {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}ResultsGridItem);
+
+const {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}SearchBarElement = ({
+ placeholder: passedPlaceholder,
+ queryString,
+ onInputChange,
+ executeSearch,
+}) => {
+ const placeholder = passedPlaceholder || "Search";
+ const onBtnSearchClick = () => {
+ executeSearch();
+ };
+ const onKeyPress = (event) => {
+ if (event.key === "Enter") {
+ executeSearch();
+ }
+ };
+ return (
+ {
+ onInputChange(value);
+ }}
+ value={queryString}
+ onKeyPress={onKeyPress}
+ />
+ );
+};
+
+overrideStore.add("SearchBar.element", {% endraw -%}{{cookiecutter.datamodel_extension_class}}{%- raw %}SearchBarElement);
+{% endraw %}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/config.py b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/config.py
index 0aa8c55..c6e6431 100644
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/config.py
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/config.py
@@ -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 = 'records/search.html'
PIDSTORE_RECID_FIELD = '{{ cookiecutter.datamodel_pid_name }}'
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/ext.py b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/ext.py
index 99d413b..e26d426 100644
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/ext.py
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/ext.py
@@ -34,8 +34,8 @@ def init_config(self, app):
for k in dir(config):
if k.startswith('{{ cookiecutter.package_name | upper }}_'):
app.config.setdefault(k, getattr(config, k))
- elif k == 'SEARCH_UI_JSTEMPLATE_RESULTS':
- app.config['SEARCH_UI_JSTEMPLATE_RESULTS'] = getattr(
+ elif k == 'SEARCH_UI_SEARCH_TEMPLATE':
+ app.config['SEARCH_UI_SEARCH_TEMPLATE'] = getattr(
config, k)
elif k == 'PIDSTORE_RECID_FIELD':
app.config['PIDSTORE_RECID_FIELD'] = getattr(config, k)
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/static/templates/records/results.html b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/static/templates/records/results.html
deleted file mode 100644
index 7fcfc9c..0000000
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/static/templates/records/results.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% include 'misc/header.html' -%}{% raw %}
-
-
-
- -
- {{ contributor.name }};
-
-
-
-
-{% endraw %}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/templates/records/record.html b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/templates/semantic-ui/records/record.html
similarity index 81%
rename from {{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/templates/records/record.html
rename to {{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/templates/semantic-ui/records/record.html
index 181dc81..db79333 100644
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/templates/records/record.html
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/templates/semantic-ui/records/record.html
@@ -1,7 +1,8 @@
-{% include 'misc/header.tpl' -%}{% raw %}
-{%- extends config.RECORDS_UI_BASE_TEMPLATE %}
+{%- 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'] %}
@@ -32,7 +33,7 @@
{% endfor %}
{%- endmacro %}
-{% macro preview(files) %}
+{#{% macro preview(files) %}}
{% set selected_file = files|select_preview_file %}
{%- if selected_file -%}
@@ -48,22 +49,22 @@
{%- endif %}
-{%- endmacro %}
+{%- endmacro %}#}
{%- block page_body %}
-
+
{{record.title}}
{{ record_content(record) }}
- {% set files = record._files %}
+ {#{% set files = record._files %}
{{ preview(files) }}
{%- if files -%}
{{ file_list(files, pid) }}
- {%- endif %}
+ {%- endif %}#}
- {{ webpack['{%- endraw %}{{cookiecutter.project_shortname}}{%- raw %}-preview.js'] }}
+ {{ webpack['{%- endraw -%}{{cookiecutter.project_shortname}}{%- raw -%}-preview.js'] }}
{%- endblock %}
-{% endraw %}
+{%- endraw -%}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/templates/semantic-ui/records/search.html b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/templates/semantic-ui/records/search.html
new file mode 100644
index 0000000..285fb61
--- /dev/null
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/templates/semantic-ui/records/search.html
@@ -0,0 +1,8 @@
+{%- include 'misc/header.tpl' -%}
+{%- raw -%}
+{%- extends "semantic-ui/invenio_search_ui/search.html" %}
+
+{% block javascript_searchapp_customization %}
+ {{ webpack['{%- endraw -%}{{cookiecutter.project_shortname}}{%- raw -%}-search-app.js'] }}
+{% endblock javascript_searchapp_customization %}
+{%- endraw -%}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/webpack.py b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/webpack.py
new file mode 100644
index 0000000..bc0b964
--- /dev/null
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/records/webpack.py
@@ -0,0 +1,23 @@
+{% 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 }}/search_app_customizations.js',
+ },
+ dependencies={
+ "react": "^16.9.0",
+ "react-dom": "^16.9.0",
+ "react-overridable": "^0.0.2",
+ "semantic-ui-react": "^0.88.0"
+ }
+ )
+ }
+)
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/scss/{{cookiecutter.package_name}}/theme.scss b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/scss/{{cookiecutter.package_name}}/theme.scss
deleted file mode 100644
index 75c773a..0000000
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/scss/{{cookiecutter.package_name}}/theme.scss
+++ /dev/null
@@ -1,21 +0,0 @@
-{% include 'misc/header.js' %}
-
-// Check out https://github.com/inveniosoftware/invenio-theme/blob/master/invenio_theme/assets/scss/invenio_theme
-@import "variables";
-@import "../invenio_theme/styles";
-
-
-.hide-on-collapsed {
- display: block;
-}
-.show-on-collapsed {
- display: none;
-}
-.panel-toggle.collapsed {
- .hide-on-collapsed {
- display: none;
- }
- .show-on-collapsed {
- display: block;
- }
-}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/scss/{{cookiecutter.package_name}}/variables.scss b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/scss/{{cookiecutter.package_name}}/variables.scss
deleted file mode 100644
index 9c27a19..0000000
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/scss/{{cookiecutter.package_name}}/variables.scss
+++ /dev/null
@@ -1,8 +0,0 @@
-{% include 'misc/header.js' %}
-
-@import "../invenio_theme/variables";
-
-// If you want to change the primary color you can do something like:
-// $color1: rgba(100, 42, 156, 0.8);
-// $color1-gradient: lighten($color1, 15%);
-// $navbar-default-bg: $color1;
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/js/{{cookiecutter.package_name}}/previewer.js b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/semantic-ui/js/{{cookiecutter.package_name}}/previewer.js
similarity index 77%
rename from {{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/js/{{cookiecutter.package_name}}/previewer.js
rename to {{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/semantic-ui/js/{{cookiecutter.package_name}}/previewer.js
index 92c1048..52e8b55 100644
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/js/{{cookiecutter.package_name}}/previewer.js
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/assets/semantic-ui/js/{{cookiecutter.package_name}}/previewer.js
@@ -1,3 +1,5 @@
+{% include 'misc/header.js' -%}
+{%- raw %}
import $ from "jquery";
$("#files")
@@ -6,3 +8,4 @@ $("#files")
$("#preview").show();
$("#preview-iframe").attr("src", $(event.target).data("url"));
});
+{%- endraw %}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/semantic-ui/{{cookiecutter.package_name}}/frontpage.html b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/semantic-ui/{{cookiecutter.package_name}}/frontpage.html
new file mode 100644
index 0000000..6543f97
--- /dev/null
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/semantic-ui/{{cookiecutter.package_name}}/frontpage.html
@@ -0,0 +1,15 @@
+{%- include 'misc/header.tpl' -%}
+{%- raw -%}
+{%- extends "semantic-ui/invenio_theme/frontpage.html" %}
+
+{% block page_body %}
+
+
+
+{%- endraw -%}
+
+{%- raw -%}
+
+
+{% endblock %}
+{%- endraw -%}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/{{cookiecutter.package_name}}/page.html b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/semantic-ui/{{cookiecutter.package_name}}/page.html
similarity index 52%
rename from {{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/{{cookiecutter.package_name}}/page.html
rename to {{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/semantic-ui/{{cookiecutter.package_name}}/page.html
index c6e1978..bdaa9e0 100644
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/{{cookiecutter.package_name}}/page.html
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/semantic-ui/{{cookiecutter.package_name}}/page.html
@@ -1,13 +1,14 @@
-{% include 'misc/header.jinja2' %}
-{%- raw %}
-{%- extends "invenio_theme/page.html" %}
+{%- include 'misc/header.tpl' -%}
+{%- raw -%}
+{%- extends "semantic-ui/invenio_theme/page.html" %}
-{%- block css %}
-{{ webpack['{%- endraw %}{{cookiecutter.project_shortname}}{%- raw %}-theme.css'] }}
+{% block css %}
+{{ super() }}
+{#{{ webpack['{%- endraw -%}{{cookiecutter.project_shortname}}{%- raw -%}-theme.css'] }}#}
-{%- endblock %}
-{%- endraw %}
+{% endblock %}
+{%- endraw -%}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/{{cookiecutter.package_name}}/frontpage.html b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/{{cookiecutter.package_name}}/frontpage.html
deleted file mode 100644
index a5a3715..0000000
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/templates/{{cookiecutter.package_name}}/frontpage.html
+++ /dev/null
@@ -1,15 +0,0 @@
-{% include 'misc/header.jinja2' %}
-{%- raw %}
-{%- extends "invenio_theme/frontpage.html" %}
-
-{%- block page_body %}
-
-
-
-{%- endraw %}
-
Welcome to {{cookiecutter.project_name}}.
-{%- raw %}
-
-
-{%- endblock %}
-{%- endraw %}
diff --git a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/webpack.py b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/webpack.py
index c4151a8..b984735 100644
--- a/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/webpack.py
+++ b/{{cookiecutter.project_shortname}}/{{cookiecutter.package_name}}/theme/webpack.py
@@ -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...
+ }
+ )
}
)