mirror of
https://github.com/Cian-H/invenio-theme-iform.git
synced 2025-12-24 05:31:57 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79a9014878 | ||
|
|
708d10ae1a | ||
|
|
0dc9240e73 | ||
|
|
7f1286bd6b | ||
|
|
f883dc7760 | ||
|
|
7c250a41fe | ||
|
|
c9ff126c28 | ||
|
|
597b8b0905 | ||
|
|
903498185f | ||
|
|
4fd0501c58 | ||
|
|
d8c91df396 | ||
|
|
0da96559ec |
@@ -15,15 +15,6 @@ insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
|
||||
# Python files
|
||||
[*.py]
|
||||
indent_size = 4
|
||||
# isort plugin configuration
|
||||
known_first_party = invenio_theme_tugraz
|
||||
multi_line_output = 2
|
||||
default_section = THIRDPARTY
|
||||
skip = .eggs
|
||||
|
||||
# RST files (used by sphinx)
|
||||
[*.rst]
|
||||
indent_size = 4
|
||||
|
||||
1
.git-blame-ignore-revs
Normal file
1
.git-blame-ignore-revs
Normal file
@@ -0,0 +1 @@
|
||||
cd71ecd24b8fc2253a58c60082c80a87c8085601
|
||||
4
.github/workflows/pypi-publish.yml
vendored
4
.github/workflows/pypi-publish.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel
|
||||
pip install setuptools wheel babel
|
||||
- name: Build package
|
||||
run: |
|
||||
python setup.py compile_catalog sdist bdist_wheel
|
||||
@@ -23,4 +23,4 @@ jobs:
|
||||
uses: pypa/gh-action-pypi-publish@v1.3.1
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.pypi_password }}
|
||||
password: ${{ secrets.pypi_password }}
|
||||
|
||||
42
.github/workflows/tests.yml
vendored
42
.github/workflows/tests.yml
vendored
@@ -1,3 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2020-2022 Graz University of Technology.
|
||||
#
|
||||
# invenio-theme-tugraz is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||
# details.
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
@@ -20,42 +28,18 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9]
|
||||
requirements-level: [min, pypi]
|
||||
db-service: [postgresql12]
|
||||
python-version: [3.8, 3.9]
|
||||
requirements-level: [pypi]
|
||||
db-service: [postgresql13]
|
||||
search-service: [elasticsearch7]
|
||||
exclude:
|
||||
- python-version: 3.6
|
||||
requirements-level: pypi
|
||||
|
||||
- python-version: 3.7
|
||||
requirements-level: min
|
||||
|
||||
- python-version: 3.8
|
||||
requirements-level: min
|
||||
|
||||
- python-version: 3.9
|
||||
requirements-level: min
|
||||
|
||||
- db-service: postgresql12
|
||||
requirements-level: min
|
||||
|
||||
- search-service: elasticsearch7
|
||||
requirements-level: min
|
||||
|
||||
include:
|
||||
|
||||
- db-service: postgresql12
|
||||
DB_EXTRAS: "postgresql"
|
||||
|
||||
|
||||
- search-service: elasticsearch7
|
||||
SEARCH_EXTRAS: "elasticsearch7"
|
||||
|
||||
env:
|
||||
DB: ${{ matrix.db-service }}
|
||||
SEARCH: ${{ matrix.search-service }}
|
||||
EXTRAS: all,${{ matrix.DB_EXTRAS }},${{ matrix.SEARCH_EXTRAS }}
|
||||
EXTRAS: tests,${{ matrix.SEARCH_EXTRAS }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -67,7 +51,7 @@ jobs:
|
||||
|
||||
- name: Generate dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools py wheel requirements-builder
|
||||
pip install wheel requirements-builder
|
||||
requirements-builder -e "$EXTRAS" --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
# invenio-theme-tugraz is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||
# details.
|
||||
#
|
||||
# 1) Create message catalog:
|
||||
# $ python setup.py extract_messages
|
||||
# $ python setup.py update_catalog -l de
|
||||
# $ python setup.py compile_catalog
|
||||
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
13
CHANGES.rst
13
CHANGES.rst
@@ -7,6 +7,19 @@
|
||||
|
||||
Changes
|
||||
=======
|
||||
Version 3.9.1 (released 2022-06-02)
|
||||
|
||||
- fix: add trigger to accordion (#265)
|
||||
- dep: adapt to v9 of invenioRDM(#263)
|
||||
|
||||
Version 3.9.0 (released 2022-05-27)
|
||||
|
||||
- global: migrate setup.py to setup.cfg #260
|
||||
|
||||
Version 3.8.0 (released 2022-03-03)
|
||||
|
||||
- global: migrate to v8 of invenioRDM #257
|
||||
|
||||
Version 3.7.0 (released 2021-12-07)
|
||||
|
||||
- dep: bump config module #252
|
||||
|
||||
@@ -41,3 +41,4 @@ recursive-include tests *.py
|
||||
recursive-include invenio_theme_tugraz *.jpg
|
||||
recursive-include invenio_theme_tugraz *.gitkeep
|
||||
recursive-include .github/workflows *.yml
|
||||
include .git-blame-ignore-revs
|
||||
|
||||
27
docs/conf.py
27
docs/conf.py
@@ -8,7 +8,7 @@
|
||||
|
||||
"""Sphinx configuration."""
|
||||
|
||||
import os
|
||||
from invenio_theme_tugraz import __version__
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
@@ -44,9 +44,9 @@ source_suffix = ".rst"
|
||||
master_doc = "index"
|
||||
|
||||
# General information about the project.
|
||||
project = u"invenio-theme-tugraz"
|
||||
copyright = u"2020, Graz University of Technology"
|
||||
author = u"Graz University of Technology"
|
||||
project = "invenio-theme-tugraz"
|
||||
copyright = "2020, Graz University of Technology"
|
||||
author = "Graz University of Technology"
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
@@ -54,17 +54,8 @@ author = u"Graz University of Technology"
|
||||
#
|
||||
# The short X.Y version.
|
||||
|
||||
# Get the version string. Cannot be done with import!
|
||||
g = {}
|
||||
with open(
|
||||
os.path.join(os.path.dirname(__file__), "..", "invenio_theme_tugraz", "version.py"),
|
||||
"rt",
|
||||
) as fp:
|
||||
exec(fp.read(), g)
|
||||
version = g["__version__"]
|
||||
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = version
|
||||
release = __version__
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@@ -250,8 +241,8 @@ latex_documents = [
|
||||
(
|
||||
master_doc,
|
||||
"invenio-theme-tugraz.tex",
|
||||
u"invenio-theme-tugraz Documentation",
|
||||
u"Graz University of Technology",
|
||||
"invenio-theme-tugraz Documentation",
|
||||
"Graz University of Technology",
|
||||
"manual",
|
||||
),
|
||||
]
|
||||
@@ -285,7 +276,7 @@ man_pages = [
|
||||
(
|
||||
master_doc,
|
||||
"invenio-theme-tugraz",
|
||||
u"invenio-theme-tugraz Documentation",
|
||||
"invenio-theme-tugraz Documentation",
|
||||
[author],
|
||||
1,
|
||||
)
|
||||
@@ -304,7 +295,7 @@ texinfo_documents = [
|
||||
(
|
||||
master_doc,
|
||||
"invenio-theme-tugraz",
|
||||
u"invenio-theme-tugraz Documentation",
|
||||
"invenio-theme-tugraz Documentation",
|
||||
author,
|
||||
"invenio-theme-tugraz",
|
||||
"invenio module for TUGRAZ theme.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2020-2021 Graz University of Technology.
|
||||
# Copyright (C) 2020-2022 Graz University of Technology.
|
||||
#
|
||||
# invenio-theme-tugraz is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||
@@ -9,6 +9,7 @@
|
||||
"""invenio module for TUGRAZ theme."""
|
||||
|
||||
from .ext import InvenioThemeTugraz
|
||||
from .version import __version__
|
||||
|
||||
__version__ = "3.9.1"
|
||||
|
||||
__all__ = ("__version__", "InvenioThemeTugraz")
|
||||
|
||||
@@ -32,3 +32,7 @@
|
||||
transition: background-color 0.15s ease 0s, color 0.15s ease 0s;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.nowrap-link {
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -16,9 +16,7 @@ INVENIO_THEME_TUGRAZ_DEFAULT_VALUE = _("TU Graz Repository")
|
||||
INVENIO_THEME_TUGRAZ_BASE_TEMPLATE = "invenio_theme_tugraz/base.html"
|
||||
"""TU Graz Default base template"""
|
||||
|
||||
INVENIO_THEME_TUGRAZ_ACCOUNT_BASE = (
|
||||
"invenio_theme_tugraz/accounts/accounts_base.html"
|
||||
)
|
||||
INVENIO_THEME_TUGRAZ_ACCOUNT_BASE = "invenio_theme_tugraz/accounts/accounts_base.html"
|
||||
"""TU Graz Default account base template"""
|
||||
|
||||
INVENIO_THEME_TUGRAZ_ICON = "images/icon_use.png"
|
||||
@@ -75,9 +73,7 @@ THEME_SITENAME = _("Repository")
|
||||
SECURITY_LOGIN_USER_TEMPLATE = "invenio_theme_tugraz/accounts/login_user.html"
|
||||
"""Login template"""
|
||||
|
||||
SECURITY_REGISTER_USER_TEMPLATE = (
|
||||
"invenio_theme_tugraz/accounts/register_user.html"
|
||||
)
|
||||
SECURITY_REGISTER_USER_TEMPLATE = "invenio_theme_tugraz/accounts/register_user.html"
|
||||
"""Sigup template"""
|
||||
|
||||
# Invenio-app-rdm
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
"""Frontpage records."""
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
from elasticsearch_dsl.query import Q
|
||||
from invenio_search.api import RecordsSearch
|
||||
|
||||
@@ -22,5 +20,6 @@ class FrontpageRecordsSearch(RecordsSearch):
|
||||
|
||||
index = "rdmrecords-records"
|
||||
default_filter = Q(
|
||||
"query_string", query=(
|
||||
"access.record:public " "AND versions.is_latest:true"))
|
||||
"query_string",
|
||||
query=("access.record:public " "AND versions.is_latest:true"),
|
||||
)
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
{%- with form = login_user_form %}
|
||||
{%- set accordion_active = "active" if form.errors else "" %}
|
||||
<div class="ui styled accordion">
|
||||
<div class="title {{ accordion_active }}">
|
||||
<div class="title trigger {{ accordion_active }}">
|
||||
{{ _('Log in with repository credentials') }}
|
||||
<i class="user icon"></i>
|
||||
<i class="user icon button"></i>
|
||||
</div>
|
||||
<div class="content {{ accordion_active }}">
|
||||
<form action="{{ url_for_security('login') }}" method="POST" name="login_user_form" class="ui large form">
|
||||
|
||||
@@ -61,9 +61,9 @@
|
||||
{%- set accordion_active = "active" if form.errors else "" %}
|
||||
<div class="ui padded centered large form">
|
||||
<div class="ui styled accordion">
|
||||
<div class="title {{ accordion_active }}">
|
||||
<div class="title trigger {{ accordion_active }}">
|
||||
{{ _('Sign up with repository credentials') }}
|
||||
<i class="user icon"></i>
|
||||
<i class="user icon button"></i>
|
||||
</div>
|
||||
<div class="content {{ accordion_active }}">
|
||||
<form class="ui large form" action="{{ url_for_security('register') }}" method="POST" name="register_user_form">
|
||||
|
||||
@@ -13,58 +13,70 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<header>
|
||||
{%- block navbar %}
|
||||
<nav>
|
||||
{%- block navbar_header %}
|
||||
{%- include "invenio_theme_tugraz/navbar.html" %}
|
||||
{%- endblock navbar_header %}
|
||||
<div>
|
||||
<header>
|
||||
{%- block navbar %}
|
||||
<nav>
|
||||
{%- block navbar_header %}
|
||||
{%- include "invenio_theme_tugraz/navbar.html" %}
|
||||
{%- endblock navbar_header %}
|
||||
|
||||
<div class="ui container">
|
||||
<div class="ui container">
|
||||
<div class="ui grid stackable container">
|
||||
<div class="three column row centered" style="padding-bottom: 0;">
|
||||
<div class="two wide column main-menu-entry">
|
||||
<a href="{{url_for('invenio_theme_tugraz.index')}}" title="Home" class="no-decoration">
|
||||
<span class="home-inline">
|
||||
<svg shape-rendering="geometricPrecision" id="int-menu-q-home-icon"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1" xml:space="preserve" height="36.997" width="35.969"
|
||||
enable-background="new 0 0 595.28 841.89" y="0px" x="0px" xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 35.969 36.997451">
|
||||
<polyline style="stroke:#E4154B;stroke-linecap:square;stroke-width:4;fill:none"
|
||||
points="282.72 437.28 282.72 414.77 297.71 406.69 312.69 414.77 312.69 437.28"
|
||||
transform="translate(-279.72 -403.28)">
|
||||
</polyline>
|
||||
</svg>
|
||||
{{_ ("Home")}}
|
||||
</span>
|
||||
<svg shape-rendering="geometricPrecision" id="int-menu-q-home-icon"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1" xml:space="preserve" height="36.997" width="35.969"
|
||||
enable-background="new 0 0 595.28 841.89" y="0px" x="0px" xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 35.969 36.997451">
|
||||
<polyline style="stroke:#E4154B;stroke-linecap:square;stroke-width:4;fill:none"
|
||||
points="282.72 437.28 282.72 414.77 297.71 406.69 312.69 414.77 312.69 437.28"
|
||||
transform="translate(-279.72 -403.28)">
|
||||
</polyline>
|
||||
</svg>
|
||||
{{_ ("Home")}}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{%- for item in current_menu.submenu('main').children|sort(attribute='order') if item.visible recursive %}
|
||||
<div class="two wide column main-menu-entry">
|
||||
<a href="{{ item.url }}" class="no-decoration">{{ item.text|safe }}</a>
|
||||
</div>
|
||||
{%- endfor %}
|
||||
<div class="two wide column main-menu-entry">
|
||||
<a role="menuitem" href="{{ item.url }}" class="no-decoration">{{ item.text|safe }}</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% for item in current_menu.submenu('actions').children|sort(attribute='order') if item.visible recursive %}
|
||||
<div class="two wide column main-menu-entry">
|
||||
<a role="menuitem" href="{{ item.url }}" class="no-decoration">{{ item.text|safe }}</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
<div id="margin-divider" class="ui divider main-menu-underline-line">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="spacer"></div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
{%- endblock navbar %}
|
||||
|
||||
{%- block flashmessages %}
|
||||
{%- from "invenio_theme/macros/messages.html" import flashed_messages with context -%}
|
||||
{{ flashed_messages() }}
|
||||
{%- endblock %}
|
||||
{#
|
||||
</nav>
|
||||
{%- endblock navbar %}
|
||||
|
||||
{%- block flashmessages %}
|
||||
{%- from "invenio_theme/macros/messages.html" import flashed_messages with context -%}
|
||||
{{ flashed_messages() }}
|
||||
{%- endblock %}
|
||||
</header>
|
||||
|
||||
{#
|
||||
{%- block breadcrumbs %}
|
||||
{%- include "invenio_theme/breadcrumbs.html" %}
|
||||
{%- include "invenio_theme/breadcrumbs.html" %}
|
||||
{%- endblock breadcrumbs %}
|
||||
#}
|
||||
</header>
|
||||
#}
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: invenio-theme-tugraz 1.0.4\n"
|
||||
"Report-Msgid-Bugs-To: mojib.wali@tugraz.at\n"
|
||||
"POT-Creation-Date: 2021-11-02 15:12+0100\n"
|
||||
"POT-Creation-Date: 2022-03-03 10:34+0100\n"
|
||||
"PO-Revision-Date: 2020-10-06 10:27+0200\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language: de\n"
|
||||
@@ -17,7 +17,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.9.0\n"
|
||||
"Generated-By: Babel 2.9.1\n"
|
||||
|
||||
#: invenio_theme_tugraz/config.py:13 invenio_theme_tugraz/config.py:62
|
||||
msgid "TU Graz Repository"
|
||||
@@ -239,6 +239,10 @@ msgstr "Dies ist die Testumgebung des TU Graz Repositorys."
|
||||
msgid "Home"
|
||||
msgstr "Startseite"
|
||||
|
||||
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html:49
|
||||
msgid "My dashboard"
|
||||
msgstr "Meine Übersicht"
|
||||
|
||||
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:27
|
||||
msgid "Type and press enter to search"
|
||||
msgstr "Suchbegriff eingeben und “Enter” drücken (?)"
|
||||
@@ -482,3 +486,6 @@ msgstr "Mit Ihren Repository Daten registrieren"
|
||||
#~ msgid "Reason"
|
||||
#~ msgstr "Grund"
|
||||
|
||||
#~ msgid "Dashboard"
|
||||
#~ msgstr ""
|
||||
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
# Translations template for invenio-theme-tugraz.
|
||||
# Copyright (C) 2021 Graz University of Technology
|
||||
# Copyright (C) 2022 Graz University of Technology
|
||||
# This file is distributed under the same license as the
|
||||
# invenio-theme-tugraz project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: invenio-theme-tugraz 3.6.1\n"
|
||||
"Project-Id-Version: invenio-theme-tugraz 3.7.0\n"
|
||||
"Report-Msgid-Bugs-To: mojib.wali@tugraz.at\n"
|
||||
"POT-Creation-Date: 2021-11-02 15:12+0100\n"
|
||||
"POT-Creation-Date: 2022-03-03 10:34+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.9.0\n"
|
||||
"Generated-By: Babel 2.9.1\n"
|
||||
|
||||
#: invenio_theme_tugraz/config.py:13 invenio_theme_tugraz/config.py:62
|
||||
msgid "TU Graz Repository"
|
||||
@@ -227,6 +228,10 @@ msgstr ""
|
||||
msgid "Home"
|
||||
msgstr ""
|
||||
|
||||
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html:49
|
||||
msgid "My dashboard"
|
||||
msgstr ""
|
||||
|
||||
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:27
|
||||
msgid "Type and press enter to search"
|
||||
msgstr ""
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2020-2021 Graz University of Technology.
|
||||
#
|
||||
# invenio-theme-tugraz is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||
# details.
|
||||
|
||||
"""Version information for invenio-theme-tugraz.
|
||||
|
||||
This file is imported by ``invenio_theme_tugraz.__init__``,
|
||||
and parsed by ``setup.py``.
|
||||
"""
|
||||
|
||||
__version__ = "3.7.0"
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
"""invenio module for TUGRAZ theme."""
|
||||
|
||||
import binascii
|
||||
from os import environ
|
||||
from typing import Dict
|
||||
|
||||
from elasticsearch_dsl.utils import AttrDict
|
||||
@@ -18,34 +16,36 @@ from invenio_rdm_records.resources.serializers import UIJSONSerializer
|
||||
|
||||
from .search import FrontpageRecordsSearch
|
||||
|
||||
blueprint = Blueprint(
|
||||
"invenio_theme_tugraz",
|
||||
__name__,
|
||||
template_folder="templates",
|
||||
static_folder="static",
|
||||
)
|
||||
|
||||
|
||||
@blueprint.app_template_filter("make_dict_like")
|
||||
def make_dict_like(value: str, key: str) -> Dict[str, str]:
|
||||
"""Convert the value to a dict like structure.
|
||||
|
||||
in the form of a key -> value pair.
|
||||
"""
|
||||
return {key: value}
|
||||
|
||||
|
||||
@blueprint.app_template_filter("cast_to_dict")
|
||||
def cast_to_dict(attr_dict):
|
||||
"""Return the dict structure of AttrDict variable."""
|
||||
return AttrDict.to_dict(attr_dict)
|
||||
|
||||
|
||||
def ui_blueprint(app):
|
||||
"""Blueprint for the routes and resources provided by Invenio-theme-tugraz."""
|
||||
routes = app.config.get("TUG_ROUTES")
|
||||
|
||||
blueprint = Blueprint(
|
||||
"invenio_theme_tugraz",
|
||||
__name__,
|
||||
template_folder="templates",
|
||||
static_folder="static",
|
||||
)
|
||||
|
||||
blueprint.add_url_rule(routes["index"], view_func=index)
|
||||
blueprint.add_url_rule(routes["comingsoon"], view_func=comingsoon)
|
||||
|
||||
@blueprint.app_template_filter("make_dict_like")
|
||||
def make_dict_like(value: str, key: str) -> Dict[str, str]:
|
||||
"""Convert the value to a dict like structure.
|
||||
|
||||
in the form of a key -> value pair.
|
||||
"""
|
||||
return {key: value}
|
||||
|
||||
@blueprint.app_template_filter("cast_to_dict")
|
||||
def cast_to_dict(attr_dict):
|
||||
"""Return the dict structure of AttrDict variable."""
|
||||
return AttrDict.to_dict(attr_dict)
|
||||
|
||||
return blueprint
|
||||
|
||||
|
||||
@@ -53,7 +53,9 @@ def records_serializer(records=None):
|
||||
"""Serialize list of records."""
|
||||
record_list = []
|
||||
for record in records:
|
||||
record_list.append(UIJSONSerializer().serialize_object_to_dict(record.to_dict()))
|
||||
record_list.append(
|
||||
UIJSONSerializer().serialize_object_to_dict(record.to_dict())
|
||||
)
|
||||
return record_list
|
||||
|
||||
|
||||
@@ -62,8 +64,7 @@ def index():
|
||||
records = FrontpageRecordsSearch()[:5].sort("-created").execute()
|
||||
|
||||
return render_template(
|
||||
"invenio_theme_tugraz/index.html",
|
||||
records=records_serializer(records)
|
||||
"invenio_theme_tugraz/index.html", records=records_serializer(records)
|
||||
)
|
||||
|
||||
|
||||
|
||||
3
pyproject.toml
Normal file
3
pyproject.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["setuptools", "wheel", "babel>2.8"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
12
pytest.ini
12
pytest.ini
@@ -1,12 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2020-2021 Graz University of Technology.
|
||||
#
|
||||
# invenio-theme-tugraz is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||
# details.
|
||||
|
||||
[pytest]
|
||||
addopts = --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_theme_tugraz --cov-report=term-missing tests invenio_theme_tugraz
|
||||
testpaths = tests invenio_theme_tugraz
|
||||
live_server_scope = module
|
||||
@@ -16,17 +16,8 @@ set -o errexit
|
||||
# Quit on unbound symbols
|
||||
set -o nounset
|
||||
|
||||
# Always bring down docker services
|
||||
|
||||
function cleanup() {
|
||||
eval "$(docker-services-cli down --env)"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
|
||||
python -m check_manifest --ignore ".*-requirements.txt"
|
||||
python -m sphinx.cmd.build -qnN docs docs/_build/html
|
||||
eval "$(docker-services-cli up --db ${DB:-postgresql} --search ${SEARCH:-elasticsearch} --cache ${CACHE:-redis} --env)"
|
||||
python -m pytest
|
||||
tests_exit_code=$?
|
||||
python -m sphinx.cmd.build -qnN -b doctest docs docs/_build/doctest
|
||||
|
||||
78
setup.cfg
78
setup.cfg
@@ -6,6 +6,63 @@
|
||||
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||
# details.
|
||||
|
||||
[metadata]
|
||||
name = invenio-theme-tugraz
|
||||
version = attr: invenio_theme_tugraz.__version__
|
||||
description = "Invenio module for TUGRAZ theme."
|
||||
long_description = file: README.rst, CHANGES.rst
|
||||
keywords = invenio theme invenioRDM TU-Graz
|
||||
license = MIT
|
||||
author = "Graz University of Technology"
|
||||
author_email = mojib.wali@tugraz.at
|
||||
url = https://github.com/tu-graz-library/invenio-theme-tugraz
|
||||
platforms = any
|
||||
classifiers =
|
||||
Environment :: Web Environment
|
||||
Intended Audience :: Developers
|
||||
License :: OSI Approved :: MIT License
|
||||
Operating System :: OS Independent
|
||||
Programming Language :: Python
|
||||
Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Topic :: Software Development :: Libraries :: Python Modules
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Development Status :: 3 - Alpha
|
||||
|
||||
[options]
|
||||
include_package_data = True
|
||||
packages = find:
|
||||
python_requires = >=3.8
|
||||
zip_safe = False
|
||||
install_requires =
|
||||
Flask-BabelEx>=0.9.4
|
||||
Flask-WebpackExt>=1.0.0
|
||||
invenio-assets>=1.2.7,<1.3.0
|
||||
invenio-i18n>=1.3.1,<1.4.0
|
||||
invenio_config_tugraz>=0.9.0,<0.10.0
|
||||
|
||||
[options.extras_require]
|
||||
tests =
|
||||
pytest-black>=0.3.0,<0.3.10
|
||||
sphinx>=4.2.0,<5
|
||||
pytest-invenio>=1.4.7
|
||||
invenio-app>=1.3.0,<2.0.0
|
||||
elasticsearch7 =
|
||||
invenio-search[elasticsearch7]>=1.4.2,<2.0
|
||||
|
||||
[options.entry_points]
|
||||
invenio_base.apps =
|
||||
invenio_theme_tugraz = invenio_theme_tugraz:InvenioThemeTugraz
|
||||
invenio_base.blueprints =
|
||||
invenio_theme_tugraz = invenio_theme_tugraz.views:ui_blueprint
|
||||
invenio_i18n.translations =
|
||||
messages = invenio_theme_tugraz
|
||||
invenio_assets.webpack =
|
||||
invenio_theme_tugraz_theme = invenio_theme_tugraz.webpack:theme
|
||||
invenio_config.module =
|
||||
invenio_theme_tugraz = invenio_theme_tugraz.config
|
||||
|
||||
[aliases]
|
||||
test = pytest
|
||||
|
||||
@@ -22,6 +79,7 @@ add_ignore = D401
|
||||
|
||||
[compile_catalog]
|
||||
directory = invenio_theme_tugraz/translations/
|
||||
use-fuzzy = True
|
||||
|
||||
[extract_messages]
|
||||
copyright_holder = Graz University of Technology
|
||||
@@ -37,20 +95,10 @@ output-dir = invenio_theme_tugraz/translations/
|
||||
[update_catalog]
|
||||
input-file = invenio_theme_tugraz/translations/messages.pot
|
||||
output-dir = invenio_theme_tugraz/translations/
|
||||
|
||||
[flake8]
|
||||
max-line-length = 88
|
||||
extend-ignore = E203
|
||||
select = C,E,F,W,B,B950
|
||||
ignore = E501
|
||||
|
||||
[isort]
|
||||
multi_line_output = 3
|
||||
include_trailing_comma = True
|
||||
force_grid_wrap = 0
|
||||
use_parentheses = True
|
||||
ensure_newline_before_comments = True
|
||||
line_length = 88
|
||||
profile=black
|
||||
|
||||
[pycodestyle]
|
||||
ignore = E203,E501
|
||||
[tool:pytest]
|
||||
addopts = --black --isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_theme_tugraz --cov-report=term-missing tests invenio_theme_tugraz
|
||||
testpaths = tests invenio_theme_tugraz
|
||||
live_server_scope = module
|
||||
|
||||
113
setup.py
113
setup.py
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2020-2021 Graz University of Technology.
|
||||
# Copyright (C) 2020-2022 Graz University of Technology.
|
||||
#
|
||||
# invenio-theme-tugraz is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||
@@ -8,113 +8,6 @@
|
||||
|
||||
"""invenio module for TUGRAZ theme."""
|
||||
|
||||
import os
|
||||
from setuptools import setup
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
readme = open("README.rst").read()
|
||||
history = open("CHANGES.rst").read()
|
||||
|
||||
tests_require = [
|
||||
"pytest-invenio>=1.4.0",
|
||||
"invenio-app>=1.3.0,<2.0.0",
|
||||
]
|
||||
|
||||
# Should follow invenio-app-rdm
|
||||
invenio_search_version = ">=1.4.0,<1.5.0"
|
||||
invenio_db_version = ">=1.0.9,<1.1.0"
|
||||
|
||||
extras_require = {
|
||||
"elasticsearch7": [f"invenio-search[elasticsearch7]{invenio_search_version}"],
|
||||
"mysql": [f"invenio-db[mysql,versioning]{invenio_db_version}"],
|
||||
"postgresql": [f"invenio-db[postgresql,versioning]{invenio_db_version}"],
|
||||
"sqlite": [f"invenio-db[versioning]{invenio_db_version}"],
|
||||
"docs": [
|
||||
"Sphinx==4.2.0",
|
||||
],
|
||||
"tests": tests_require,
|
||||
}
|
||||
|
||||
extras_require["all"] = []
|
||||
for name, reqs in extras_require.items():
|
||||
if name[0] == ":" or name in (
|
||||
"elasticsearch7",
|
||||
"mysql",
|
||||
"postgresql",
|
||||
"sqlite",
|
||||
):
|
||||
continue
|
||||
extras_require["all"].extend(reqs)
|
||||
|
||||
setup_requires = [
|
||||
"Babel>=1.3",
|
||||
"pytest-runner>=3.0.0,<5",
|
||||
]
|
||||
|
||||
install_requires = [
|
||||
"Flask-BabelEx>=0.9.4",
|
||||
"Flask-WebpackExt>=1.0.0",
|
||||
"invenio-assets>=1.2.0",
|
||||
"invenio-i18n>=1.2.0",
|
||||
"invenio_config_tugraz>=0.7.0,<0.8.0",
|
||||
]
|
||||
|
||||
packages = find_packages()
|
||||
|
||||
|
||||
# Get the version string. Cannot be done with import!
|
||||
g = {}
|
||||
with open(os.path.join("invenio_theme_tugraz", "version.py"), "rt") as fp:
|
||||
exec(fp.read(), g)
|
||||
version = g["__version__"]
|
||||
|
||||
setup(
|
||||
name="invenio-theme-tugraz",
|
||||
version=version,
|
||||
description=__doc__,
|
||||
long_description=readme + "\n\n" + history,
|
||||
keywords="invenio, theme, invenioRDM, TU-Graz, Graz University of Technology, statistics",
|
||||
license="MIT",
|
||||
author="Graz University of Technology",
|
||||
author_email="mojib.wali@tugraz.at",
|
||||
url="https://github.com/tu-graz-library/invenio-theme-tugraz",
|
||||
packages=packages,
|
||||
zip_safe=False,
|
||||
include_package_data=True,
|
||||
platforms="any",
|
||||
entry_points={
|
||||
"invenio_base.apps": [
|
||||
"invenio_theme_tugraz = invenio_theme_tugraz:InvenioThemeTugraz",
|
||||
],
|
||||
"invenio_base.blueprints": [
|
||||
"invenio_theme_tugraz = invenio_theme_tugraz.views:ui_blueprint",
|
||||
],
|
||||
"invenio_i18n.translations": [
|
||||
"messages = invenio_theme_tugraz",
|
||||
],
|
||||
"invenio_assets.webpack": [
|
||||
"invenio_theme_tugraz_theme = invenio_theme_tugraz.webpack:theme",
|
||||
],
|
||||
"invenio_config.module": [
|
||||
"invenio_theme_tugraz = invenio_theme_tugraz.config",
|
||||
],
|
||||
},
|
||||
extras_require=extras_require,
|
||||
install_requires=install_requires,
|
||||
setup_requires=setup_requires,
|
||||
tests_require=tests_require,
|
||||
classifiers=[
|
||||
"Environment :: Web Environment",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python",
|
||||
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Development Status :: 3 - Alpha",
|
||||
],
|
||||
)
|
||||
setup()
|
||||
|
||||
@@ -12,62 +12,21 @@ See https://pytest-invenio.readthedocs.io/ for documentation on which test
|
||||
fixtures are available.
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
from flask import Flask
|
||||
from flask_babelex import Babel
|
||||
from invenio_db import InvenioDB, db
|
||||
from invenio_i18n import InvenioI18N
|
||||
from invenio_search import InvenioSearch
|
||||
from sqlalchemy_utils.functions import create_database, database_exists, drop_database
|
||||
|
||||
from invenio_theme_tugraz import InvenioThemeTugraz
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def celery_config():
|
||||
"""Override pytest-invenio fixture.
|
||||
|
||||
TODO: Remove this fixture if you add Celery support.
|
||||
"""
|
||||
return {}
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def app(request):
|
||||
"""Basic Flask application."""
|
||||
instance_path = tempfile.mkdtemp()
|
||||
app = Flask("testapp")
|
||||
DB = os.getenv("SQLALCHEMY_DATABASE_URI", "sqlite://")
|
||||
app.config.update(
|
||||
I18N_LANGUAGES=[("en", "English"), ("de", "German")],
|
||||
SQLALCHEMY_DATABASE_URI=DB,
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS=False,
|
||||
)
|
||||
Babel(app)
|
||||
InvenioDB(app)
|
||||
InvenioSearch(app)
|
||||
InvenioThemeTugraz(app)
|
||||
InvenioI18N(app)
|
||||
|
||||
with app.app_context():
|
||||
db_url = str(db.engine.url)
|
||||
if db_url != "sqlite://" and not database_exists(db_url):
|
||||
create_database(db_url)
|
||||
db.create_all()
|
||||
|
||||
def teardown():
|
||||
with app.app_context():
|
||||
db_url = str(db.engine.url)
|
||||
db.session.close()
|
||||
if db_url != "sqlite://":
|
||||
drop_database(db_url)
|
||||
shutil.rmtree(instance_path)
|
||||
|
||||
request.addfinalizer(teardown)
|
||||
app.test_request_context().push()
|
||||
|
||||
return app
|
||||
|
||||
@@ -35,4 +35,4 @@ def test_init():
|
||||
|
||||
def test_app(app):
|
||||
"""Test extension initialization."""
|
||||
theme = InvenioThemeTugraz(app)
|
||||
_ = InvenioThemeTugraz(app)
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2020-2021 Graz University of Technology.
|
||||
#
|
||||
# invenio-theme-tugraz is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||
# details.
|
||||
|
||||
"""Pytest configuration.
|
||||
|
||||
See https://pytest-invenio.readthedocs.io/ for documentation on which test
|
||||
fixtures are available.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from invenio_app.factory import create_ui
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def create_app(instance_path):
|
||||
"""Application factory fixture."""
|
||||
return create_ui
|
||||
@@ -1,33 +0,0 @@
|
||||
# # -*- coding: utf-8 -*-
|
||||
# #
|
||||
# # Copyright (C) 2020-2021 Graz University of Technology.
|
||||
# #
|
||||
# # invenio-theme-tugraz is free software; you can redistribute it and/or
|
||||
# # modify it under the terms of the MIT License; see LICENSE file for more
|
||||
# # details.
|
||||
|
||||
# """Test views."""
|
||||
|
||||
# from elasticsearch_dsl.utils import AttrDict
|
||||
|
||||
# from invenio_theme_tugraz.views import cast_to_dict, make_dict_like
|
||||
|
||||
|
||||
# def test_make_dict_like():
|
||||
# """Test make_dict_like."""
|
||||
# access = {
|
||||
# "access_right" : "open"
|
||||
# }
|
||||
# dicts = make_dict_like("open", "access_right")
|
||||
# assert access == dicts
|
||||
|
||||
|
||||
# def test_cast_to_dict():
|
||||
# """Test cast_to_dict."""
|
||||
# resource_type = {
|
||||
# "subtype" : "publication-datamanagementplan",
|
||||
# "type" : "publication"
|
||||
# }
|
||||
# expected = {'subtype': 'publication-datamanagementplan', 'type': 'publication'}
|
||||
# attr = cast_to_dict(AttrDict(resource_type))
|
||||
# assert expected == attr
|
||||
Reference in New Issue
Block a user