Skip to content

Commit

Permalink
assets: move to webpack
Browse files Browse the repository at this point in the history
Signed-off-by: Johnny Mariéthoz <[email protected]>
  • Loading branch information
jma committed Dec 2, 2020
1 parent f6c73a8 commit 6c32bef
Show file tree
Hide file tree
Showing 95 changed files with 441 additions and 971 deletions.
105 changes: 0 additions & 105 deletions rero_ils/bundles.py

This file was deleted.

24 changes: 5 additions & 19 deletions rero_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
25 changes: 25 additions & 0 deletions rero_ils/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import json
import re
import glob
import os

import dateparser
from babel.dates import format_date, format_datetime, format_time
Expand All @@ -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 = '<script {tags} src="{value}"></script>'.format(
value=value,
tags=tags
)
if _type == 'css':
to_return = '<link {tags} href="{value}" rel="stylesheet">'.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,
Expand Down
37 changes: 0 additions & 37 deletions rero_ils/modules/contributions/bundles.py

This file was deleted.

45 changes: 0 additions & 45 deletions rero_ils/modules/contributions/static/js/rero_ils/contribution.js

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions rero_ils/modules/contributions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
46 changes: 0 additions & 46 deletions rero_ils/modules/documents/bundles.py

This file was deleted.

Loading

0 comments on commit 6c32bef

Please sign in to comment.