diff --git a/rero_ils/bundles.py b/rero_ils/bundles.py
deleted file mode 100644
index 0bb24ba65c..0000000000
--- a/rero_ils/bundles.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# RERO ILS
-# Copyright (C) 2019 RERO
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, version 3 of the License.
-#
-# This program 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-
-"""JS/CSS bundles for RERO ILS theme."""
-
-from __future__ import absolute_import, print_function
-
-import os
-
-from invenio_assets import AngularGettextFilter, GlobBundle, NpmBundle
-from pkg_resources import resource_filename
-
-RERO_ILS_UI_VERSION = '0.8.0'
-
-
-def catalog(domain):
- """Return glob matching path to tranlated messages for a given domain."""
- return os.path.join(
- os.path.abspath(resource_filename('rero_ils', 'translations')),
- '*', # language code
- 'LC_MESSAGES',
- '{0}.po'.format(domain),
- )
-
-
-main_css = NpmBundle(
- 'scss/rero_ils/styles.scss',
- depends=('scss/rero_ils/*.scss'),
- filters='node-scss,cleancssurl',
- output='gen/rero_ils_main.%(version)s.css',
- npm={
- 'almond': '~0.3.3',
- 'bootstrap': '~4.2.1',
- 'font-awesome': '~4.7.0',
- 'jquery': '~1.9.1',
- }
-)
-"""Main CSS bundle with Bootstrap and Font-Awesome."""
-
-i18n = GlobBundle(
- catalog('messages'),
- filters=AngularGettextFilter(catalog_name='reroilsAppTranslations'),
-)
-
-js = NpmBundle(
- 'node_modules/almond/almond.js',
- 'js/rero_ils/rero_ils.js',
- 'js/rero_ils/rero_keep_tab.js',
- filters='requirejs',
- npm={
- 'almond': '~0.3.3',
- 'angular': '~1.6.9',
- 'bootstrap': '~4.2.1',
- 'angular-gettext': '~2.3.8',
- 'jquery': '~1.9.1',
- },
- output='gen/rero_ils.main.%(version)s.js'
-)
-
-admin_ui_js = NpmBundle(
- 'node_modules/@rero/rero-ils-ui/dist/admin/runtime.*.js',
- 'node_modules/@rero/rero-ils-ui/dist/admin/polyfills.*.js',
- 'node_modules/@rero/rero-ils-ui/dist/admin/styles.*.js',
- 'node_modules/@rero/rero-ils-ui/dist/admin/scripts.*.js',
- 'node_modules/@rero/rero-ils-ui/dist/admin/main.*.js',
- output='gen/rero_ils_admin_ui.%(version)s.js',
- npm={
- '@rero/rero-ils-ui': '~{version}'.format(version=RERO_ILS_UI_VERSION)
- }
-)
-
-public_search_ui_js = NpmBundle(
- 'node_modules/@rero/rero-ils-ui/dist/public-search/runtime.*.js',
- 'node_modules/@rero/rero-ils-ui/dist/public-search/polyfills.*.js',
- 'node_modules/@rero/rero-ils-ui/dist/public-search/styles.*.js',
- 'node_modules/@rero/rero-ils-ui/dist/public-search/scripts.*.js',
- 'node_modules/@rero/rero-ils-ui/dist/public-search/main.*.js',
- output='gen/rero_ils_public-search_ui.%(version)s.js',
- npm={
- '@rero/rero-ils-ui': '~{version}'.format(version=RERO_ILS_UI_VERSION)
- }
-)
-
-search_bar_ui_js = NpmBundle(
- 'node_modules/@rero/rero-ils-ui/dist/search-bar/polyfills.*.js',
- 'node_modules/@rero/rero-ils-ui/dist/search-bar/main.*.js',
- output='gen/rero_ils_search-bar_ui.%(version)s.js',
- npm={
- '@rero/rero-ils-ui': '~{version}'.format(version=RERO_ILS_UI_VERSION)
- }
-)
diff --git a/rero_ils/config.py b/rero_ils/config.py
index 332b6d211e..227c9787f4 100644
--- a/rero_ils/config.py
+++ b/rero_ils/config.py
@@ -154,22 +154,7 @@ def _(x):
SECURITY_REGISTER_USER_TEMPLATE = 'rero_ils/register_user.html'
SECURITY_FORGOT_PASSWORD_TEMPLATE = 'rero_ils/forgot_password.html'
SECURITY_RESET_PASSWORD_TEMPLATE = 'rero_ils/reset_password.html'
-#: Template for tombstone page.
-RECORDS_UI_TOMBSTONE_TEMPLATE = "rero_ils/tombstone.html"
-#: Miscellaneous templates
-SEARCH_UI_JSTEMPLATE_RESULTS = (
- 'templates/rero_ils/brief_view_documents.html'
-)
-SEARCH_UI_SEARCH_TEMPLATE = 'rero_ils/search.html'
-SEARCH_UI_JSTEMPLATE_FACETS = 'templates/rero_ils/facets.html'
-SEARCH_UI_JSTEMPLATE_RANGE = 'templates/rero_ils/range.html'
-SEARCH_UI_JSTEMPLATE_COUNT = 'templates/rero_ils/count.html'
-SEARCH_UI_JSTEMPLATE_PAGINATION = 'templates/rero_ils/pagination.html'
-SEARCH_UI_SEARCH_MIMETYPE = 'application/rero+json'
-
-SEARCH_UI_HEADER_TEMPLATE = 'rero_ils/search_header.html'
-REROILS_SEARCHBAR_TEMPLATE = 'templates/rero_ils/searchbar.html'
-RERO_ILS_EDITOR_TEMPLATE = 'rero_ils/editor.html'
+RERO_ILS_SEARCH_TEMPLATE = 'rero_ils/search.html'
RERO_ILS_COLLECTIONS_TEMPLATE = 'rero_ils/collections.html'
# Theme configuration
@@ -197,13 +182,14 @@ def _(x):
#: Template for error pages.
THEME_ERROR_TEMPLATE = 'rero_ils/page_error.html'
#: RERO-ils search endpoint (i.e /search/documents)
-RERO_ILS_THEME_SEARCH_ENDPOINT = '/search/documents'
+# RERO_ILS_THEME_SEARCH_ENDPOINT = '/search/documents'
# External CSS for each organisation customization
RERO_ILS_THEME_ORGANISATION_CSS_ENDPOINT = 'https://resources.rero.ch/ils/test/css/'
#: Template for including a tracking code for web analytics.
THEME_TRACKINGCODE_TEMPLATE = 'rero_ils/trackingcode.html'
THEME_JAVASCRIPT_TEMPLATE = 'rero_ils/javascript.html'
+# WEBPACKEXT_PROJECT = 'rero_ils.webpack.project'
# Logings
# =======
#: Sentry level
@@ -1486,7 +1472,7 @@ def _(x):
),
)
-SEARCH_UI_SEARCH_INDEX = 'documents'
+# SEARCH_UI_SEARCH_INDEX = 'documents'
# Default view code for all organisations view
# TODO: Should be taken into angular
@@ -2089,7 +2075,7 @@ def _(x):
INDEXER_REPLACE_REFS = True
INDEXER_RECORD_TO_INDEX = 'rero_ils.modules.indexer_utils.record_to_index'
-SEARCH_UI_SEARCH_API = '/api/documents/'
+# SEARCH_UI_SEARCH_API = '/api/documents/'
RERO_ILS_APP_URL_SCHEME = 'https'
RERO_ILS_APP_HOST = 'ils.rero.ch'
diff --git a/rero_ils/filter.py b/rero_ils/filter.py
index f21d2d5aea..ec417dae19 100644
--- a/rero_ils/filter.py
+++ b/rero_ils/filter.py
@@ -19,6 +19,8 @@
import json
import re
+import glob
+import os
import dateparser
from babel.dates import format_date, format_datetime, format_time
@@ -27,6 +29,29 @@
from markupsafe import Markup
+def webpack_assets(package, patterns=['runtime*.js', 'polyfills*.js', 'main*.js'], _type='js', tags=''):
+ package_path = os.path.join(current_app.static_folder, 'node_modules', package)
+ def transform(value):
+ value = re.sub(r'(.*?)\/static', '/static', value)
+ to_return = ''.format(
+ value=value,
+ tags=tags
+ )
+ if _type == 'css':
+ to_return = ''.format(
+ value=value,
+ tags=tags
+ )
+ return to_return
+ output_files = []
+ for pattern in patterns:
+ files = glob.glob(os.path.join(package_path, pattern))
+ output_files.extend([transform(v) for v in files])
+ class Test:
+ def __html__():
+ return Markup('\n'.join(output_files))
+ return Test
+
def format_date_filter(
date_str, date_format='full', time_format='medium',
locale=None, delimiter=', ', timezone=None,
diff --git a/rero_ils/modules/contributions/bundles.py b/rero_ils/modules/contributions/bundles.py
deleted file mode 100644
index 744fe8cd47..0000000000
--- a/rero_ils/modules/contributions/bundles.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# RERO ILS
-# Copyright (C) 2020 RERO
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, version 3 of the License.
-#
-# This program 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-
-"""JS/CSS bundles for theme."""
-
-from __future__ import absolute_import, print_function
-
-from flask_assets import Bundle
-from invenio_assets import NpmBundle
-
-from ...bundles import i18n
-
-detailed_js = Bundle(
- i18n,
- NpmBundle(
- 'js/rero_ils/contribution_jq.js',
- npm={
- 'jquery': '~1.9.1',
- }
- ),
- filters='jsmin',
- output='gen/rero_ils.contribution_detailed.%(version)s.js',
-)
diff --git a/rero_ils/modules/contributions/static/js/rero_ils/contribution.js b/rero_ils/modules/contributions/static/js/rero_ils/contribution.js
deleted file mode 100644
index fc28b2064e..0000000000
--- a/rero_ils/modules/contributions/static/js/rero_ils/contribution.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-
-RERO ILS
-Copyright (C) 2019 RERO
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program 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 Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see .
-
-*/
-
-angular.module('reroilsPerson', [])
- .controller('personController', ['$scope', function($scope) {
-
- $scope.person = null;
-
- $scope.$watch("record", function(record) {
- $scope.person = extract_source(record, $scope.config);
- });
-
- function extract_source(record, config) {
- var orders = config.persons_label_order;
- var language = config.language;
- data = record['metadata'];
- if (!(language in orders)) {
- language = orders['fallback'];
- }
- order = orders[language];
- order.some(function(source) {
- if (source in data) {
- dataSource = source;
- return true;
- }
- })
- return data[dataSource];
- }
- }]);
diff --git a/rero_ils/modules/contributions/static/js/rero_ils/contribution_jq.js b/rero_ils/modules/contributions/static/js/rero_ils/contribution_jq.js
deleted file mode 100644
index 2b42983d41..0000000000
--- a/rero_ils/modules/contributions/static/js/rero_ils/contribution_jq.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-
-RERO ILS
-Copyright (C) 2020 RERO
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program 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 Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see .
-
-*/
-
-$(document).ready(function() {
- $('#nav-tab').keeptab({ localeItemName: 'person-tab'});
-});
diff --git a/rero_ils/modules/contributions/views.py b/rero_ils/modules/contributions/views.py
index f270753c63..cd48fbc5c0 100644
--- a/rero_ils/modules/contributions/views.py
+++ b/rero_ils/modules/contributions/views.py
@@ -26,11 +26,11 @@
from invenio_pidstore.models import PersistentIdentifier
from invenio_records_ui.signals import record_viewed
-from rero_ils.modules.contributions.api import Contribution, ContributionType
-from rero_ils.modules.organisations.api import Organisation
+from .api import Contribution, ContributionType
+from ..organisations.api import Organisation
from ..documents.api import DocumentsSearch
-from ...views import url_active
+from ...theme.views import url_active
blueprint = Blueprint(
'contributions',
diff --git a/rero_ils/modules/documents/bundles.py b/rero_ils/modules/documents/bundles.py
deleted file mode 100644
index 5f0404c1c2..0000000000
--- a/rero_ils/modules/documents/bundles.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# RERO ILS
-# Copyright (C) 2019 RERO
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, version 3 of the License.
-#
-# This program 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-
-"""JS/CSS bundles for theme."""
-
-from __future__ import absolute_import, print_function
-
-from flask_assets import Bundle
-from invenio_assets import NpmBundle
-
-from ...bundles import i18n
-
-detailed_js = Bundle(
- i18n,
- NpmBundle(
- 'js/rero_ils/translations.js',
- 'js/rero_ils/thumbnail.js',
- 'js/rero_ils/detailed_app.js',
- 'js/rero_ils/documents_jq.js',
- filters='requirejs',
- depends=('node_modules/d3/*'),
- npm={
- "almond": "~0.3.1",
- 'angular': '~1.4.10',
- 'angular-loading-bar': '~0.9.0',
- 'd3': '^3.5.17',
- 'jquery': '~1.9.1',
- }
- ),
- filters='jsmin',
- output='gen/rero_ils.detailed.%(version)s.js',
-)
diff --git a/rero_ils/modules/documents/static/js/rero_ils/detailed_app.js b/rero_ils/modules/documents/static/js/rero_ils/detailed_app.js
deleted file mode 100644
index 11152188f6..0000000000
--- a/rero_ils/modules/documents/static/js/rero_ils/detailed_app.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-
-RERO ILS
-Copyright (C) 2019 RERO
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program 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 Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see .
-
-*/
-
-require([
- 'node_modules/d3/d3',
- 'node_modules/angular/angular',
- 'node_modules/angular-loading-bar/build/loading-bar'
- ], function() {
- // When the DOM is ready bootstrap the `invenio-serach-js`
-
- angular.element(document).ready(function() {
- angular.bootstrap(
- document.getElementById("thumbnail"), [
- 'angular-loading-bar', 'reroilsAppTranslations', 'reroThumbnails'
- ]
- );
- });
- });
diff --git a/rero_ils/modules/documents/static/js/rero_ils/documents.js b/rero_ils/modules/documents/static/js/rero_ils/documents.js
deleted file mode 100644
index 4ddaa88c38..0000000000
--- a/rero_ils/modules/documents/static/js/rero_ils/documents.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-
-RERO ILS
-Copyright (C) 2019 RERO
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program 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 Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see .
-
-*/
-
-angular.module('reroilsUtils', [])
-
- .controller('exportController', ['$scope', function($scope) {
- $scope.csvURL = function() {
- return window.location.href.toString().replace('search', 'api/export/documents/csv').replace(/size=\d+/, 'size=19999');
- };
- }])
-
- .directive('reroilsExportCsv', function() {
- return {
- template: '
'
- };
- })
-
- .controller('recordController', ['$scope', function($scope) {
- record = $scope.rec;
- }]);
diff --git a/rero_ils/modules/documents/static/js/rero_ils/documents_jq.js b/rero_ils/modules/documents/static/js/rero_ils/documents_jq.js
deleted file mode 100644
index 06e014573c..0000000000
--- a/rero_ils/modules/documents/static/js/rero_ils/documents_jq.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-
-RERO ILS
-Copyright (C) 2019 RERO
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program 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 Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see .
-
-*/
-
-$(document).ready(function() {
- $('.collapse').on('hidden.bs.collapse shown.bs.collapse', function () {
- var element = $('#' + $(this).data('holdingId')).find('.availability');
- element.hasClass('d-none') ?
- element.removeClass('d-none') : element.addClass('d-none');
- });
-
- $('#nav-tab').keeptab({ localeItemName: 'document-tab'});
- });
diff --git a/rero_ils/modules/documents/templates/rero_ils/_documents_get.html b/rero_ils/modules/documents/templates/rero_ils/_documents_get.html
index a34404d869..11372409f7 100644
--- a/rero_ils/modules/documents/templates/rero_ils/_documents_get.html
+++ b/rero_ils/modules/documents/templates/rero_ils/_documents_get.html
@@ -232,8 +232,8 @@
{{ _('Select a Pickup Location') }}
{%- elif reasons %}
-
-
- {%- block javascript %}{% endblock javascript %}
- {%- block trackingcode %}{% include config.THEME_TRACKINGCODE_TEMPLATE %}{% endblock %}
+{%- block javascript %}
+{% include 'rero_ils/javascript.html' %}
+{%- endblock javascript %}
+{%- block trackingcode %}
+{% include 'rero_ils/trackingcode.html' %}
+{%- endblock %}
{%- endblock outer_body %}
diff --git a/rero_ils/templates/rero_ils/page_error.html b/rero_ils/theme/templates/rero_ils/page_error.html
similarity index 100%
rename from rero_ils/templates/rero_ils/page_error.html
rename to rero_ils/theme/templates/rero_ils/page_error.html
diff --git a/rero_ils/templates/rero_ils/page_settings.html b/rero_ils/theme/templates/rero_ils/page_settings.html
similarity index 100%
rename from rero_ils/templates/rero_ils/page_settings.html
rename to rero_ils/theme/templates/rero_ils/page_settings.html
diff --git a/rero_ils/templates/rero_ils/page_wiki.html b/rero_ils/theme/templates/rero_ils/page_wiki.html
similarity index 100%
rename from rero_ils/templates/rero_ils/page_wiki.html
rename to rero_ils/theme/templates/rero_ils/page_wiki.html
diff --git a/rero_ils/templates/rero_ils/professional.html b/rero_ils/theme/templates/rero_ils/professional.html
similarity index 62%
rename from rero_ils/templates/rero_ils/professional.html
rename to rero_ils/theme/templates/rero_ils/professional.html
index e487c1e426..76364c5ee6 100644
--- a/rero_ils/templates/rero_ils/professional.html
+++ b/rero_ils/theme/templates/rero_ils/professional.html
@@ -25,15 +25,12 @@
Admin
-
-
+ {{ webpack_assets('@rero/rero-ils-ui/dist/admin', ['styles.*css'], 'css') }}
- {% assets "rero_ils_admin_ui_js" %}
-
- {% endassets %}
+ {{ webpack_assets('@rero/rero-ils-ui/dist/admin') }}