Skip to content

Commit

Permalink
wip: configurable themes
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsherva committed May 13, 2020
1 parent a502595 commit 97a46e2
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
2 changes: 1 addition & 1 deletion invenio_search_ui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from __future__ import absolute_import, print_function

SEARCH_UI_JS_FRAMEWORK = 'react'
SEARCH_UI_APP_THEME = ['react', 'angular']

SEARCH_UI_SEARCH_API = '/api/records/'
"""Configure the search engine endpoint."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
{%- 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'] }}
<script type="text/javascript">window.initSearchApp("invenio-search-ui-app", {{ config|format_config("recid")|safe }});</script>
{% block javascript_render %}
{{ webpack.render('.js') }}
{% endblock javascript_render %}
{%- endblock javascript %}


Expand Down
11 changes: 9 additions & 2 deletions invenio_search_ui/templates/invenio_search_ui/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@

{%- block css %}
{{ super() }}
{{ webpack['search_ui_theme.css'] }}
{{ webpack['search_ui_theme'] }}
{# assets "invenio_search_ui_search_css" %}<link href="{{ ASSET_URL }}" rel="stylesheet">{% endassets #}

{% block css_render %}
{{ webpack.render('.css') }}
{% endblock css_render %}
{%- endblock css %}

{%- block javascript %}
{{ super() }}
{{ webpack['search_ui_app.js'] }}
{{ webpack['search_ui_app'] }}
{# assets "invenio_search_ui_search_js" %}<script src="{{ ASSET_URL }}"></script>{% endassets #}
{% block javascript_render %}
{{ webpack.render('.js') }}
{% endblock javascript_render %}
{%- endblock javascript %}

{%- block body_inner %}
Expand Down
42 changes: 42 additions & 0 deletions invenio_search_ui/webpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,45 @@ def search_ui():
'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',
# }
# )
# }
# )

0 comments on commit 97a46e2

Please sign in to comment.