diff --git a/invenio_search_ui/assets/js/invenio_search_ui/app.js b/invenio_search_ui/assets/bootstrap3/js/invenio_search_ui/app.js
similarity index 100%
rename from invenio_search_ui/assets/js/invenio_search_ui/app.js
rename to invenio_search_ui/assets/bootstrap3/js/invenio_search_ui/app.js
diff --git a/invenio_search_ui/assets/scss/invenio_search_ui/search.scss b/invenio_search_ui/assets/bootstrap3/scss/invenio_search_ui/search.scss
similarity index 100%
rename from invenio_search_ui/assets/scss/invenio_search_ui/search.scss
rename to invenio_search_ui/assets/bootstrap3/scss/invenio_search_ui/search.scss
diff --git a/invenio_search_ui/assets/js/invenio_react_search_ui/App.js b/invenio_search_ui/assets/semantic-ui/js/invenio_react_search_ui/App.js
similarity index 100%
rename from invenio_search_ui/assets/js/invenio_react_search_ui/App.js
rename to invenio_search_ui/assets/semantic-ui/js/invenio_react_search_ui/App.js
diff --git a/invenio_search_ui/assets/js/invenio_react_search_ui/Results.js b/invenio_search_ui/assets/semantic-ui/js/invenio_react_search_ui/Results.js
similarity index 100%
rename from invenio_search_ui/assets/js/invenio_react_search_ui/Results.js
rename to invenio_search_ui/assets/semantic-ui/js/invenio_react_search_ui/Results.js
diff --git a/invenio_search_ui/assets/js/invenio_react_search_ui/index.js b/invenio_search_ui/assets/semantic-ui/js/invenio_react_search_ui/index.js
similarity index 100%
rename from invenio_search_ui/assets/js/invenio_react_search_ui/index.js
rename to invenio_search_ui/assets/semantic-ui/js/invenio_react_search_ui/index.js
diff --git a/invenio_search_ui/config.py b/invenio_search_ui/config.py
index ed2e08b2..a585bb39 100644
--- a/invenio_search_ui/config.py
+++ b/invenio_search_ui/config.py
@@ -10,7 +10,7 @@
from __future__ import absolute_import, print_function
-SEARCH_UI_APP_THEME = ['react', 'angular']
+APP_THEME = ['semantic-ui', 'bootstrap3']
SEARCH_UI_SEARCH_API = '/api/records/'
"""Configure the search engine endpoint."""
diff --git a/invenio_search_ui/ext.py b/invenio_search_ui/ext.py
index f94f6d2a..a21bd49e 100644
--- a/invenio_search_ui/ext.py
+++ b/invenio_search_ui/ext.py
@@ -48,23 +48,6 @@ def init_config(self, app):
app.config.get('HEADER_TEMPLATE',
'invenio_search_ui/base_header.html')
)
- app.config.setdefault(
- 'SEARCH_UI_JS_FRAMEWORK',
- app.config.get('JS_FRAMEWORK',
- 'react')
- )
- if app.config.get('SEARCH_UI_JS_FRAMEWORK') == 'react':
- app.config.setdefault(
- 'SEARCH_UI_SEARCH_TEMPLATE',
- app.config.get('SEARCH_TEMPLATE',
- 'invenio_search_ui/react_search.html')
- )
- else:
- app.config.setdefault(
- 'SEARCH_UI_SEARCH_TEMPLATE',
- app.config.get('SEARCH_TEMPLATE',
- 'invenio_search_ui/search.html')
- )
for k in dir(config):
if k.startswith('SEARCH_UI_'):
diff --git a/invenio_search_ui/templates/invenio_search_ui/search.html b/invenio_search_ui/templates/invenio_search_ui/search.html
index 68276012..d4254649 100644
--- a/invenio_search_ui/templates/invenio_search_ui/search.html
+++ b/invenio_search_ui/templates/invenio_search_ui/search.html
@@ -11,21 +11,14 @@
{%- block css %}
{{ super() }}
- {{ webpack['search_ui_theme'] }}
+ {{ webpack['search_ui_theme.css'] }}
{# assets "invenio_search_ui_search_css" %}{% endassets #}
-
- {% block css_render %}
- {{ webpack.render('.css') }}
- {% endblock css_render %}
{%- endblock css %}
{%- block javascript %}
{{ super() }}
- {{ webpack['search_ui_app'] }}
+ {{ webpack['search_ui_app.js'] }}
{# assets "invenio_search_ui_search_js" %}{% endassets #}
- {% block javascript_render %}
- {{ webpack.render('.js') }}
- {% endblock javascript_render %}
{%- endblock javascript %}
{%- block body_inner %}
diff --git a/invenio_search_ui/templates/invenio_search_ui/react_search.html b/invenio_search_ui/templates/semantic-ui/invenio_search_ui/search.html
similarity index 56%
rename from invenio_search_ui/templates/invenio_search_ui/react_search.html
rename to invenio_search_ui/templates/semantic-ui/invenio_search_ui/search.html
index 930c3142..94ad29ac 100644
--- a/invenio_search_ui/templates/invenio_search_ui/react_search.html
+++ b/invenio_search_ui/templates/semantic-ui/invenio_search_ui/search.html
@@ -1,22 +1,9 @@
{% extends config.SEARCH_UI_BASE_TEMPLATE %}
-{%- block css %}
- {{ super() }}
- {{ webpack['vendor.css'] }}
-
- {% block css_render %}
- {{ webpack.render('.css') }}
- {% endblock css_render %}
-{%- endblock css %}
-
-
{%- block javascript %}
{{ super() }}
{{ webpack['search_ui_app.js'] }}
- {% block javascript_render %}
- {{ webpack.render('.js') }}
- {% endblock javascript_render %}
{%- endblock javascript %}
diff --git a/invenio_search_ui/views.py b/invenio_search_ui/views.py
index ca0dbbdc..832d3911 100644
--- a/invenio_search_ui/views.py
+++ b/invenio_search_ui/views.py
@@ -93,7 +93,9 @@ def format_sortoptions(sort_options):
def format_config(config, endpoint_name):
"""Create config JSON dump for Invenio-Search-JS."""
- search_index = current_app.get('RECORDS_REST_ENDPOINTS', {}).get(
+ # TODO check what happens when search_index not defined
+ # in record_rest_endpoints
+ search_index = config.get('RECORDS_REST_ENDPOINTS', {}).get(
endpoint_name, {}).get('search_index', 'records')
config_sort_options = config.get('RECORDS_REST_SORT_OPTIONS', {}).get(
@@ -109,5 +111,5 @@ def format_config(config, endpoint_name):
config_sort_options, config_default_sort
),
"aggs": searchkit_aggs(config.get('RECORDS_REST_FACETS', {}).get(
- endpoint_name).get("aggs", {})),
+ search_index).get("aggs", {})),
})
diff --git a/invenio_search_ui/webpack.py b/invenio_search_ui/webpack.py
index 26957eb2..5c41143d 100644
--- a/invenio_search_ui/webpack.py
+++ b/invenio_search_ui/webpack.py
@@ -17,23 +17,20 @@
"""
-from flask import current_app
-from flask_webpackext import WebpackBundle
-
-
-def search_ui():
- """Create webpack asset endpoint."""
- if current_app.config['SEARCH_UI_JS_FRAMEWORK'] == 'react':
- return WebpackBundle(
- __name__,
- 'assets',
+from invenio_assets.webpack import WebpackThemeBundle
+
+search_ui = WebpackThemeBundle(
+ __name__,
+ 'assets',
+ default='semantic-ui',
+ themes={
+ 'semantic-ui': dict(
entry={
'search_ui_app': './js/invenio_react_search_ui/index.js',
},
dependencies={
"axios": "^0.19.0",
"lodash": "^4.17.15",
- "node-sass": "^4.12.0",
"qs": "^6.8.0",
"prop-types": "^15.7.2",
"react": "^16.9.0",
@@ -43,14 +40,9 @@ def search_ui():
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
'react-searchkit': '^0.19.0',
- "semantic-ui-css": "^2.4.1",
- "semantic-ui-react": "^0.88.0"
- })
-
- else:
- return WebpackBundle(
- __name__,
- 'assets',
+ }
+ ),
+ 'bootstrap3': dict(
entry={
'search_ui_app': './js/invenio_search_ui/app.js',
'search_ui_theme': './scss/invenio_search_ui/search.scss',
@@ -61,47 +53,8 @@ def search_ui():
'angular-loading-bar': '~0.9.0',
'd3': '^3.5.17',
'invenio-search-js': '^1.3.1',
- 'jquery': '~3.2.1',
- })
-
-
-# search_ui = WebpackBundle(
-# __name__,
-# 'assets',
-# themes={
-# 'react': dict(
-# entry={
-# 'search_ui_app': './js/invenio_react_search_ui/index.js',
-# },
-# dependencies={
-# "axios": "^0.19.0",
-# "lodash": "^4.17.15",
-# "node-sass": "^4.12.0",
-# "qs": "^6.8.0",
-# "react": "^16.9.0",
-# "react-dom": "^16.9.0",
-# "react-redux": "^7.1",
-# "react-scripts": "3.1.1",
-# "redux": "^4.0.4",
-# "redux-thunk": "^2.3.0",
-# 'react-searchkit': '^0.19.0',
-# "semantic-ui-css": "^2.4.1",
-# "semantic-ui-react": "^0.88.0"
-# }
-# ),
-# 'angular': dict(
-# entry={
-# 'search_ui_app': './js/invenio_search_ui/app.js',
-# 'search_ui_theme': './scss/invenio_search_ui/search.scss',
-# },
-# dependencies={
-# 'almond': '~0.3.1',
-# 'angular': '~1.4.10',
-# 'angular-loading-bar': '~0.9.0',
-# 'd3': '^3.5.17',
-# 'invenio-search-js': '^1.3.1',
-# 'jquery': '~3.2.1',
-# }
-# )
-# }
-# )
+ 'jquery': '~3.2.1'
+ }
+ ),
+ },
+)