diff --git a/.tx/config b/.tx/config index dbc8bf3..7d95f58 100644 --- a/.tx/config +++ b/.tx/config @@ -6,23 +6,6 @@ # modify it under the terms of the MIT License; see LICENSE file for more # details. -# TODO: Transifex integration -# -# 1) Create message catalog: -# $ python setup.py extract_messages -# $ python setup.py init_catalog -l -# $ python setup.py compile_catalog -# 2) Ensure project has been created on Transifex under the inveniosoftware -# organisation. -# 3) Install the transifex-client -# $ pip install transifex-client -# 4) Push source (.pot) and translations (.po) to Transifex -# $ tx push -s -t -# 5) Pull translations for a single language from Transifex -# $ tx pull -l -# 6) Pull translations for all languages from Transifex -# $ tx pull -a - [main] host = https://www.transifex.com diff --git a/MANIFEST.in b/MANIFEST.in index 818c013..a804211 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,14 +6,6 @@ # modify it under the terms of the MIT License; see LICENSE file for more # details. -# TODO: Generate this manifest file by running the following commands: -# (please sort the lines in this file after running below commands) -# -# git init -# git add -A -# pip install -e .[all] -# check-manifest -u - include .dockerignore include .editorconfig include .tx/config diff --git a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/frontpage.less b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/frontpage.less new file mode 100644 index 0000000..fc1c1b5 --- /dev/null +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/frontpage.less @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2020 TUGRAZ. + * Copyright (C) 2020 mojib wali. + * + * 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. + */ + +h4{ + display: block; + margin-block-start: 0.33em; + margin-block-end: 0.33em; + margin-inline-start: 0px; + margin-inline-end: 0px; +} + +h2{ + margin-block-start: 0.83em; + margin-block-end: 0.83em; + margin-inline-start: 0px; + margin-inline-end: 0px; +} + diff --git a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/macros.less b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/macros.less new file mode 100644 index 0000000..dc7072e --- /dev/null +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/macros.less @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2020 TUGRAZ. + * Copyright (C) 2020 mojib wali. + * + * 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. + */ + +/* +* authors.html +*/ +.inline-orcid { + height: 14px; +} + +.text-muted { + color: #777; +} diff --git a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/theme.less b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/theme.less index 0ad4ef5..db2edaa 100644 --- a/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/theme.less +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/theme.less @@ -9,6 +9,8 @@ @import "header"; @import "footer"; @import "overrides"; +@import "frontpage"; +@import "macros"; @import (css) url("https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap"); diff --git a/invenio_theme_tugraz/config.py b/invenio_theme_tugraz/config.py index 492a25c..eb6e51c 100644 --- a/invenio_theme_tugraz/config.py +++ b/invenio_theme_tugraz/config.py @@ -25,6 +25,9 @@ INVENIO_THEME_TUGRAZ_ICON = 'images/icon_use.png' THEME_LOGO = 'images/tug_logo.png' """TU Graz logo""" +THEME_SEARCHBAR = False +"""Enable or disable the header search bar.""" + THEME_HEADER_TEMPLATE = 'invenio_theme_tugraz/header.html' """TU Graz header template""" @@ -43,7 +46,7 @@ THEME_FOOTER_TEMPLATE = 'invenio_theme_tugraz/footer.html' THEME_FRONTPAGE_TITLE = _('Frontpage Title') """Frontpage title.""" -THEME_SITENAME = _('Application Name') +THEME_SITENAME = _('Repository') """Site name.""" # Invenio-accounts diff --git a/invenio_theme_tugraz/search.py b/invenio_theme_tugraz/search.py new file mode 100644 index 0000000..a956243 --- /dev/null +++ b/invenio_theme_tugraz/search.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2020 TU Graz. +# Copyright (C) 2020 mojib wali. +# +# 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. + +"""Frontpage records.""" + +from __future__ import absolute_import, print_function + +from elasticsearch_dsl.query import Q +from invenio_search.api import RecordsSearch + + +class FrontpageRecordsSearch(RecordsSearch): + """Search class for records that goes on the frontpage.""" + + class Meta: + """Default index and filter for frontpage search.""" + + index = 'records' + default_filter = Q( + 'query_string', + query=( + 'access_right:open ' + ) + ) diff --git a/invenio_theme_tugraz/static/extra/orcid.png b/invenio_theme_tugraz/static/extra/orcid.png new file mode 100644 index 0000000..78e6050 Binary files /dev/null and b/invenio_theme_tugraz/static/extra/orcid.png differ diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html new file mode 100644 index 0000000..94c6d87 --- /dev/null +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index c273cfa..8350109 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -9,122 +9,126 @@ {%- extends config.INVENIO_THEME_TUGRAZ_BASE_TEMPLATE %} +{%- from "invenio_theme_tugraz/macros/authors.html" import creators -%} + + {%- block page_body %} + +{%- block frontpage_search %} + + {%- block frontpage_form %} +
+
+
+
+ + +
+
+
+
+ + {%- endblock frontpage_form %} + +{%- endblock frontpage_search %} +
- {{_('Welcome to %(module_name)s', module_name=module_name)}} - -

- - Features -

+
-
+ +
+

{{_('Recent uploads')}}

+ + {%- for r in records %} + {%- set creation_date = r._created|from_isodatetime -%} + {%- set record_url = url_for('invenio_records_ui.recid', pid_value=r['recid']) %} + + + {{_('View')}} + +
+ + + {{ r.publication_date }} + + + + + {{ (' | ' ~ r.version ~ '') if r.version else ' | Version' }} + + + {{r.resource_type.type}} + + + + + {{_('Open Access')}} -
-
-
-

Research-Data

-

- Research data can take many forms. It might be: - documents, spreadsheets - laboratory notebooks, field notebooks, diaries - questionnaires, transcripts, codebooks - audiotapes, videotapes - photographs, films - test responses - slides, artefacts, specimens, samples - collections of digital outputs - data files - database contents (video, audio, text, images) - models, algorithms, scripts - contents of an application (input, output, logfiles for analysis software, simulation software, schemas) - methodologies and workflows - standard operating procedures and protocols -

-
-

Open educational resources (OER)

-

Open educational resources (OER) are freely accessible, openly licensed text, media, and other digital assets - that are useful for teaching, learning, and assessing as well as for research purposes.

-
-
-
-
-

Thesis

-

A thesis statement focuses your ideas into one or two sentences. It should present the topic of your paper - and also make a comment about your position in relation to the topic. Your thesis statement should tell your - reader what the paper is about and also help guide your writing and keep your argument focused.

-
-
-

Publications

-

To publish is to make content available to the general public. While specific use of the term may vary among - countries, it is usually applied to text, images, or other audio-visual content, including paper. The word - publication means the act of publishing, and also refers to any printed copies.

-
-
-
- -
- - -
- - -

- - Statistic -

- - -
- -
-
-
- 15000 -
-
- Recorda + +

{{r.titles[0].title}}

+ +

{{ creators(r.creators) }}

+ + + + {% trans user=userprofile, date=creation_date|dateformat('long') %}Uploaded on + {{date}}{% endtrans %} + + + + {%- if not loop.last %} +
+ {%- else%} + + {%- endif %} + {%- endfor %}
-
-
- 30 -
-
- Communities -
-
+ +
-
-
- 500 -
-
- Users -
-
+ +
+

Need help?

+ +

{{config.THEME_SITENAME}} prioritizes all requested related to the COVID-19 outbreak.

+

We can help with:

-
-
- 50 -
-
- Members -
-
+
    +
  • Uploading your research data, software, preprints, etc.
  • +
  • One-on-one with {{config.THEME_SITENAME}} supporters.
  • +
  • Quota increases beyond our default policy.
  • +
  • Scripts for automated uploading of larger datasets.
  • +
+
+ +
+

Why use {{config.THEME_SITENAME}}?

+ {% include "invenio_theme_tugraz/benefits.html" %} +
+ + +
- -
- +
-{%- endblock %} + +{%- endblock %} \ No newline at end of file diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/macros/authors.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/macros/authors.html new file mode 100644 index 0000000..d3a9d63 --- /dev/null +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/macros/authors.html @@ -0,0 +1,31 @@ +{# + Copyright (C) 2020 Zenodo + Copyright (C) 2020 TUGRAZ + Copyright (C) 2020 mojib wali. + + 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. + #} + +{%- macro creators (authors_list) %} + +{%- for creators in authors_list %} + +{%- if creators.identifiers.Orcid %} + +{%- endif %} + +{{creators.name}} +{% if not loop.last %}; {% endif %} + +{%- endfor %} +{%- endmacro %} + + +{%- macro contributors(contributors_list) %} +{%- for group in contributors_list|groupby('type')%} +
{{group.grouper|contributortype_title}}(s)
+{{authors(group.list)}} +{%- endfor %} +{%- endmacro %} \ No newline at end of file diff --git a/invenio_theme_tugraz/views.py b/invenio_theme_tugraz/views.py index b7b4ad8..ff5d20c 100644 --- a/invenio_theme_tugraz/views.py +++ b/invenio_theme_tugraz/views.py @@ -8,12 +8,11 @@ """invenio module for TUGRAZ theme.""" -# TODO: This is an example file. Remove it if you do not need it, including -# the templates and static folders as well as the test case. - from flask import Blueprint, render_template from flask_babelex import gettext as _ +from .search import FrontpageRecordsSearch + blueprint = Blueprint( 'invenio_theme_tugraz', __name__, @@ -24,7 +23,7 @@ blueprint = Blueprint( @blueprint.route("/") def index(): - """Render a basic view.""" + """Render frontpage view.""" return render_template( "invenio_theme_tugraz/index.html", - module_name=_('invenio-theme-tugraz')) + records=FrontpageRecordsSearch()[:5].sort('-_created').execute(),) diff --git a/run-tests.sh b/run-tests.sh index cd0619c..09125cd 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -8,7 +8,7 @@ # details. pydocstyle invenio_theme_tugraz tests docs && \ -isort -rc -c -df && \ +isort --check-only --diff && \ check-manifest --ignore ".travis-*" && \ sphinx-build -qnNW docs docs/_build/html && \ python setup.py test diff --git a/setup.py b/setup.py index f0f18fa..3d86f9d 100644 --- a/setup.py +++ b/setup.py @@ -16,19 +16,22 @@ readme = open('README.rst').read() history = open('CHANGES.rst').read() tests_require = [ - 'check-manifest>=0.25', - 'coverage>=4.0', - 'isort>=4.3.3, <5.0.0', - 'pydocstyle>=2.0.0', - 'pytest-cov>=2.5.1', - 'pytest-pep8>=1.0.6', - 'pytest-invenio>=1.2.1', + 'pytest-invenio>=1.3.2', ] extras_require = { 'docs': [ 'Sphinx>=1.5.1', ], + 'mysql': [ + 'invenio-db[mysql]>=1.0.0', + ], + 'postgresql': [ + 'invenio-db[postgresql]>=1.0.0', + ], + 'sqlite': [ + 'invenio-db>=1.0.0', + ], 'tests': tests_require, } @@ -46,6 +49,9 @@ install_requires = [ 'Flask-WebpackExt>=1.0.0', 'invenio-assets>=1.2.0,<1.3.0', 'invenio-i18n>=1.2.0', + 'elasticsearch_dsl>=7.2.1', + 'invenio_search>=1.3.1', + ] packages = find_packages() @@ -87,18 +93,6 @@ setup( 'invenio_config.module': [ 'invenio_theme_tugraz = invenio_theme_tugraz.config', ], - - # TODO: Edit these entry points to fit your needs. - # 'invenio_access.actions': [], - # 'invenio_admin.actions': [], - # 'invenio_assets.bundles': [], - # 'invenio_base.api_apps': [], - # 'invenio_base.api_blueprints': [], - # 'invenio_base.blueprints': [], - # 'invenio_celery.tasks': [], - # 'invenio_db.models': [], - # 'invenio_pidstore.minters': [], - # 'invenio_records.jsonresolver': [], }, extras_require=extras_require, install_requires=install_requires, @@ -116,6 +110,6 @@ setup( 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', - 'Development Status :: 1 - Planning', + 'Development Status :: 3 - Alpha', ], ) diff --git a/tests/test_invenio_theme_tugraz.py b/tests/test_invenio_theme_tugraz.py index f72742e..462cbbd 100644 --- a/tests/test_invenio_theme_tugraz.py +++ b/tests/test_invenio_theme_tugraz.py @@ -30,10 +30,3 @@ def test_init(): assert 'invenio-theme-tugraz' not in app.extensions ext.init_app(app) assert 'invenio-theme-tugraz' in app.extensions - - -# def test_view(base_client): - # """Test view.""" - # res = base_client.get("/") - # assert res.status_code == 200 - # assert 'Welcome to invenio-theme-tugraz' in str(res.data)