Skip to content

Commit

Permalink
templates: initial semantic-ui integration
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidalgarcia committed May 14, 2020
1 parent 123b3db commit 591d877
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 64 deletions.
1 change: 1 addition & 0 deletions invenio_i18n/assets/js/invenio_i18n/app.js
Expand Up @@ -11,6 +11,7 @@ import angular from "angular";
import "angular-gettext/dist/angular-gettext";
import * as $ from "jquery/dist/jquery";

// TODO: Delete this ?
angular.module("langSelector", ["gettext"]).factory("setLanguage", [
"gettextCatalog",
function(gettextCatalog) {
Expand Down
16 changes: 16 additions & 0 deletions invenio_i18n/assets/semantic-ui/js/invenio_i18n/app.js
@@ -0,0 +1,16 @@
/*
* This file is part of Invenio.
* Copyright (C) 2016-2018 CERN.
* Copyright (C) 2016 TIND.
*
* Invenio is free software; you can redistribute it and/or modify it
* under the terms of the MIT License; see LICENSE file for more details.
*/

import * as $ from "jquery/dist/jquery";

$(document).ready(function() {
$("#lang-code").on("change", function() {
$("#language-code-form").submit();
});
});
24 changes: 0 additions & 24 deletions invenio_i18n/bundles.py

This file was deleted.

26 changes: 0 additions & 26 deletions invenio_i18n/static/js/invenio_i18n/angularLangSelector.js

This file was deleted.

@@ -0,0 +1,24 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2018 CERN.
Copyright (C) 2016 TIND.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}

{% macro language_selector_dropdown() %}
<form id="language-code-form" class="lang-select"
action="{{ url_for('invenio_i18n.set_lang')}}"
method="POST">
<div>
<label>{{ _('Language:') }}</label>
<select id="lang-code" name="lang_code">
{% for l in current_i18n.get_locales() %}
<option {% if current_i18n.language == l.language %}selected {% endif %}value="{{ l.language }}">{{ l.get_display_name() }}</option>
{% endfor %}
</select>
</div>
</form>
{% endmacro %}
35 changes: 26 additions & 9 deletions invenio_i18n/webpack.py
Expand Up @@ -8,15 +8,32 @@

"""Webpack bundles for Invenio-I18N."""

from flask_webpackext import WebpackBundle
from invenio_assets.webpack import WebpackThemeBundle

i18n = WebpackBundle(
i18n = WebpackThemeBundle(
__name__,
'assets',
entry={
'i18n_app': './js/invenio_i18n/app.js'
},
dependencies={
'angular': '~1.4.9',
'angular-gettext': '~2.3.8',
})
default='bootstrap3',
themes={
'bootstrap3': dict(
entry={
'i18n_app': './js/invenio_i18n/app.js',
},
dependencies={
'angular': '~1.4.9',
'angular-gettext': '~2.3.8',
}
),
'semantic-ui': dict(
entry={
'i18n_app': './js/invenio_i18n/app.js',
},
dependencies={
'semantic-ui-less': '~2.4.1',
'semantic-ui-css': '~2.4.1',
'font-awesome': '~4.4.0',
'jquery': '~3.2.1',
},
),
}
)
3 changes: 0 additions & 3 deletions setup.py
Expand Up @@ -72,9 +72,6 @@
include_package_data=True,
platforms='any',
entry_points={
'invenio_assets.bundles': [
'invenio_i18n_js = invenio_i18n.bundles:js',
],
'invenio_base.apps': [
'invenio_i18n = invenio_i18n:InvenioI18N',
],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_invenio_i18n.py
Expand Up @@ -202,5 +202,5 @@ def test_bundles(app):
InvenioAssets(app)

with app.app_context():
from invenio_i18n.bundles import js
assert js
from invenio_i18n.webpack import i18n
assert i18n

0 comments on commit 591d877

Please sign in to comment.