From de06337ae2d30c4227fda4fbaa7d620352007c00 Mon Sep 17 00:00:00 2001 From: mb Date: Fri, 17 Jul 2020 15:12:30 +0200 Subject: [PATCH 1/6] frontpage data first draft designing the frontpage with recent uploads and segment for contact us. --- .../less/invenio_theme_tugraz/frontpage.less | 30 +++ .../less/invenio_theme_tugraz/theme.less | 1 + invenio_theme_tugraz/config.py | 2 +- invenio_theme_tugraz/search.py | 30 +++ .../templates/invenio_theme_tugraz/index.html | 189 ++++++++---------- .../invenio_theme_tugraz/macros/authors.html | 26 +++ invenio_theme_tugraz/views.py | 7 +- setup.py | 12 ++ 8 files changed, 190 insertions(+), 107 deletions(-) create mode 100644 invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/frontpage.less create mode 100644 invenio_theme_tugraz/search.py create mode 100644 invenio_theme_tugraz/templates/invenio_theme_tugraz/macros/authors.html 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..ddae5b5 --- /dev/null +++ b/invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/frontpage.less @@ -0,0 +1,30 @@ +/* + * 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: 1.33em; + margin-block-end: 1.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; +} + +p{ + display: block; + margin-block-start: 1em; + margin-block-end: 1em; + margin-inline-start: 0px; + margin-inline-end: 0px; +} 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..03b19e2 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,7 @@ @import "header"; @import "footer"; @import "overrides"; +@import "frontpage"; @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..c1719cb 100644 --- a/invenio_theme_tugraz/config.py +++ b/invenio_theme_tugraz/config.py @@ -43,7 +43,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/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index c273cfa..79ed2c5 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -9,122 +9,103 @@ {%- extends config.INVENIO_THEME_TUGRAZ_BASE_TEMPLATE %} +{%- from "invenio_theme_tugraz/macros/authors.html" import authors -%} + + {%- block page_body %}
- {{_('Welcome to %(module_name)s', module_name=module_name)}} - -

- - Features -

+
-
+
+

{{_('Recent uploads')}}

-
-
-
-

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.

+ {%- 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')}}
+ +

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

+

{{ authors(r.creators) }}

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

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.

+ + + +
+ + +
+

Need help?

+ +

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

+

We can help with:

+ +
    +
  • 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.
  • +
+
-
-

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.

+ +
+

Why use {{config.THEME_SITENAME}}?

+
    +
  • Safe — your research is stored safely for the future in CERN’s Data Centre for as long as + CERN exists.
  • +
  • Trusted — built and operated by CERN and OpenAIRE to ensure that everyone can join in + Open Science.
  • +
  • Citeable — every upload is assigned a Digital Object Identifier (DOI), to make them + citable and trackable.
  • +
  • No waiting time — Uploads are made available online as soon as you hit publish, and your + DOI is registered within seconds.
  • +
  • Open or closed — Share e.g. anonymized clinical trial data with only medical + professionals via our restricted access mode.
  • +
  • Versioning — Easily update your dataset with our versioning feature.
  • +
  • Usage statisics — All uploads display standards compliant usage statistics
  • +
+ +
-
- - -
- - -

- - Statistic -

- - -
- -
-
-
- 15000 -
-
- Recorda -
-
- - -
-
- 30 -
-
- Communities -
-
- -
-
- 500 -
-
- Users -
-
- -
-
- 50 -
-
- Members -
-
- - -
- - -
- -
-{%- 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..4105f32 --- /dev/null +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/macros/authors.html @@ -0,0 +1,26 @@ +{# + 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 authors(authors_list) %} +{%- for author in authors_list %} +{%- if author.orcid %} + +{%- endif %} +{{author.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..7e556cb 100644 --- a/invenio_theme_tugraz/views.py +++ b/invenio_theme_tugraz/views.py @@ -14,6 +14,8 @@ from flask import Blueprint, render_template from flask_babelex import gettext as _ +from .search import FrontpageRecordsSearch + blueprint = Blueprint( 'invenio_theme_tugraz', __name__, @@ -24,7 +26,8 @@ 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')) + module_name=_('invenio-theme-tugraz'), + records=FrontpageRecordsSearch()[:10].sort('-_created').execute(),) diff --git a/setup.py b/setup.py index f0f18fa..3e5db2a 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,15 @@ 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 +55,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() From 347f3edc030b772404a5b5591423100b6a49aea0 Mon Sep 17 00:00:00 2001 From: mb Date: Fri, 17 Jul 2020 22:13:36 +0200 Subject: [PATCH 2/6] fixed mapping on creators for authors.html fixed margin of h2,h4 plus added some css style. --- .../less/invenio_theme_tugraz/frontpage.less | 11 ++------- .../less/invenio_theme_tugraz/macros.less | 18 ++++++++++++++ .../less/invenio_theme_tugraz/theme.less | 1 + invenio_theme_tugraz/static/orcid.png | Bin 0 -> 566 bytes .../invenio_theme_tugraz/benefits.html | 10 ++++++++ .../templates/invenio_theme_tugraz/index.html | 23 ++++-------------- .../invenio_theme_tugraz/macros/authors.html | 17 ++++++++----- setup.py | 5 ++-- 8 files changed, 50 insertions(+), 35 deletions(-) create mode 100644 invenio_theme_tugraz/assets/semantic-ui/less/invenio_theme_tugraz/macros.less create mode 100644 invenio_theme_tugraz/static/orcid.png create mode 100644 invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html 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 index ddae5b5..fc1c1b5 100644 --- 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 @@ -8,8 +8,8 @@ h4{ display: block; - margin-block-start: 1.33em; - margin-block-end: 1.33em; + margin-block-start: 0.33em; + margin-block-end: 0.33em; margin-inline-start: 0px; margin-inline-end: 0px; } @@ -21,10 +21,3 @@ h2{ margin-inline-end: 0px; } -p{ - display: block; - margin-block-start: 1em; - margin-block-end: 1em; - 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 03b19e2..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 @@ -10,6 +10,7 @@ @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/static/orcid.png b/invenio_theme_tugraz/static/orcid.png new file mode 100644 index 0000000000000000000000000000000000000000..78e605055d01b04d897bcf0c3118da58a83d96fb GIT binary patch literal 566 zcmV-60?GY}P)=?v&41w5) z9A6Yb&17JK3d~1Waqh`PhF71@Gu(f-mE52LnW@MEO^O&13UWQj7q7mYWBB#`HaNJ@ z!TayGz>awG@etOC2bs+RP3IVZhg}kE2`e)%+`?afzc73NS_T5#Y!YBGbP%_hlUB$Lk|!*9o6tJH}i2L%pHB&K&1@b%Yopvx=3 zKERP66qp#O0B*io38uw)4H*dLWO4wOu&1sCpa{oj!2?PRXJh7JP!|gav!8sxNUjf< zphYfO02HZC(BkCg>y^NKaT{I90Z=mCNNfQIN-2?s$1o!qXgDb6V*wi(p=Hs1^yCV1 z9Vk`Yd%F#s9Cam=F(dcS7jP~H$z!V{fTgM;tSm}|)&Xz;Dk4A_1};CJOKJ!v!c!5n zCYr!NJum@QyV0-0f%+toLZ3`PHk>Y%J|nH0EdT)q0QA7Oe=K+?{r~^~07*qoM6N<$ Ef>fj8`v3p{ literal 0 HcmV?d00001 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 @@ + +
    +
  • {{_('Safe')}} — {{_('your research is stored safely for the future in CERN’s Data Centre for as long as CERN exists.')}}
  • +
  • {{_('Trusted')}} — {{_('built and operated by CERN and OpenAIRE to ensure that everyone can join in Open Science.')}}
  • +
  • {{_('Citeable')}} — {{_('every upload is assigned a Digital Object Identifier (DOI), to make them citable and trackable.')}}
  • +
  • {{_('No waiting time')}} — {{_('Uploads are made available online as soon as you hit publish, and your DOI is registered within seconds.')}}
  • +
  • {{_('Open or closed')}} — {{_('Share e.g. anonymized clinical trial data with only medical professionals via our restricted access mode.')}}
  • +
  • {{_('Versioning')}} — {{_("Easily update your dataset with our versioning feature.")}}
  • +
  • {{_('Usage statisics')}} — {{_("All uploads display standards compliant usage statistics")}}
  • +
\ 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 79ed2c5..cd80cc9 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -9,7 +9,7 @@ {%- extends config.INVENIO_THEME_TUGRAZ_BASE_TEMPLATE %} -{%- from "invenio_theme_tugraz/macros/authors.html" import authors -%} +{%- from "invenio_theme_tugraz/macros/authors.html" import creators -%} {%- block page_body %} @@ -46,12 +46,12 @@

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

-

{{ authors(r.creators) }}

+

{{ creators(r.creators) }}

-
{% trans user=userprofile, date=creation_date|dateformat('long') %}Uploaded on - {{date}}{% endtrans %}
+ {% trans user=userprofile, date=creation_date|dateformat('long') %}Uploaded on + {{date}}{% endtrans %} {%- if not loop.last %}
@@ -85,20 +85,7 @@

Why use {{config.THEME_SITENAME}}?

-
    -
  • Safe — your research is stored safely for the future in CERN’s Data Centre for as long as - CERN exists.
  • -
  • Trusted — built and operated by CERN and OpenAIRE to ensure that everyone can join in - Open Science.
  • -
  • Citeable — every upload is assigned a Digital Object Identifier (DOI), to make them - citable and trackable.
  • -
  • No waiting time — Uploads are made available online as soon as you hit publish, and your - DOI is registered within seconds.
  • -
  • Open or closed — Share e.g. anonymized clinical trial data with only medical - professionals via our restricted access mode.
  • -
  • Versioning — Easily update your dataset with our versioning feature.
  • -
  • Usage statisics — All uploads display standards compliant usage statistics
  • -
+ {% include "invenio_theme_tugraz/benefits.html" %}
diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/macros/authors.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/macros/authors.html index 4105f32..d3a9d63 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/macros/authors.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/macros/authors.html @@ -8,16 +8,21 @@ details. #} -{%- macro authors(authors_list) %} -{%- for author in authors_list %} -{%- if author.orcid %} - +{%- macro creators (authors_list) %} + +{%- for creators in authors_list %} + +{%- if creators.identifiers.Orcid %} + {%- endif %} -{{author.name}}{% if not loop.last %}; {% 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)
diff --git a/setup.py b/setup.py index 3e5db2a..2128e88 100644 --- a/setup.py +++ b/setup.py @@ -17,12 +17,13 @@ history = open('CHANGES.rst').read() tests_require = [ 'check-manifest>=0.25', - 'coverage>=4.0', + # coverage pinned because of https://github.com/nedbat/coveragepy/issues/716 + 'coverage>=4.0,<5.0.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 = { From aa21a8ad22a1217369d297d776ce06c4b8c4bd08 Mon Sep 17 00:00:00 2001 From: mb Date: Sat, 18 Jul 2020 16:33:36 +0200 Subject: [PATCH 3/6] orcid logo added orcid logo to static --- invenio_theme_tugraz/static/{ => extra}/orcid.png | Bin .../templates/invenio_theme_tugraz/index.html | 8 +++++--- 2 files changed, 5 insertions(+), 3 deletions(-) rename invenio_theme_tugraz/static/{ => extra}/orcid.png (100%) diff --git a/invenio_theme_tugraz/static/orcid.png b/invenio_theme_tugraz/static/extra/orcid.png similarity index 100% rename from invenio_theme_tugraz/static/orcid.png rename to invenio_theme_tugraz/static/extra/orcid.png diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index cd80cc9..ac8656c 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -18,6 +18,7 @@
+

{{_('Recent uploads')}}

@@ -60,9 +61,9 @@ {%- endif %} {%- endfor %}
- + - +
@@ -90,9 +91,10 @@
+
-
+ {%- endblock %} \ No newline at end of file From 141df29666da6af203d875578fd56d22783ddfd1 Mon Sep 17 00:00:00 2001 From: Mojib Date: Mon, 20 Jul 2020 09:24:08 +0200 Subject: [PATCH 4/6] version badge seperated version badge from publication_date --- .../templates/invenio_theme_tugraz/index.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index ac8656c..94646ca 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -18,7 +18,7 @@
- +

{{_('Recent uploads')}}

@@ -35,6 +35,10 @@ {{ r.publication_date }} + + + + {{ (' | ' ~ r.version ~ '') if r.version else ' | Version' }} @@ -44,9 +48,11 @@ {{_('Open Access')}} +

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

+

{{ creators(r.creators) }}

@@ -54,6 +60,9 @@ {% trans user=userprofile, date=creation_date|dateformat('long') %}Uploaded on {{date}}{% endtrans %} + + {%- if not loop.last %}
{%- else%} @@ -61,7 +70,7 @@ {%- endif %} {%- endfor %}
- +
@@ -94,6 +103,8 @@
+
+
From 46faf1a7a566f5301925eeda76a8ff464cd725b7 Mon Sep 17 00:00:00 2001 From: mb Date: Tue, 21 Jul 2020 08:29:54 +0200 Subject: [PATCH 5/6] adjustment to module isort fixed this closes #53 --- .tx/config | 17 ----------------- MANIFEST.in | 8 -------- invenio_theme_tugraz/views.py | 4 ---- run-tests.sh | 2 +- setup.py | 21 +-------------------- tests/test_invenio_theme_tugraz.py | 7 ------- 6 files changed, 2 insertions(+), 57 deletions(-) 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/views.py b/invenio_theme_tugraz/views.py index 7e556cb..8216ed7 100644 --- a/invenio_theme_tugraz/views.py +++ b/invenio_theme_tugraz/views.py @@ -8,9 +8,6 @@ """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 _ @@ -29,5 +26,4 @@ def index(): """Render frontpage view.""" return render_template( "invenio_theme_tugraz/index.html", - module_name=_('invenio-theme-tugraz'), records=FrontpageRecordsSearch()[:10].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 2128e88..3d86f9d 100644 --- a/setup.py +++ b/setup.py @@ -16,13 +16,6 @@ readme = open('README.rst').read() history = open('CHANGES.rst').read() tests_require = [ - 'check-manifest>=0.25', - # coverage pinned because of https://github.com/nedbat/coveragepy/issues/716 - 'coverage>=4.0,<5.0.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.3.2', ] @@ -100,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, @@ -129,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) From 00145cc0eeb8f7d839b4f71dbfcaec4c407288ea Mon Sep 17 00:00:00 2001 From: mb Date: Tue, 21 Jul 2020 14:28:29 +0200 Subject: [PATCH 6/6] enhancement reduced recent_uploads to 5 records, added searchbar to frontpage. This closes #47 --- invenio_theme_tugraz/config.py | 3 +++ .../templates/invenio_theme_tugraz/index.html | 25 ++++++++++++++++++- invenio_theme_tugraz/views.py | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/invenio_theme_tugraz/config.py b/invenio_theme_tugraz/config.py index c1719cb..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""" diff --git a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html index 94646ca..8350109 100644 --- a/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html +++ b/invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html @@ -14,6 +14,25 @@ {%- block page_body %} + +{%- block frontpage_search %} + + {%- block frontpage_form %} +
+
+
+
+ + +
+
+
+
+ + {%- endblock frontpage_form %} + +{%- endblock frontpage_search %} +
@@ -66,7 +85,11 @@ {%- if not loop.last %}
{%- else%} - {{_('More')}} +
+ +
{%- endif %} {%- endfor %}
diff --git a/invenio_theme_tugraz/views.py b/invenio_theme_tugraz/views.py index 8216ed7..ff5d20c 100644 --- a/invenio_theme_tugraz/views.py +++ b/invenio_theme_tugraz/views.py @@ -26,4 +26,4 @@ def index(): """Render frontpage view.""" return render_template( "invenio_theme_tugraz/index.html", - records=FrontpageRecordsSearch()[:10].sort('-_created').execute(),) + records=FrontpageRecordsSearch()[:5].sort('-_created').execute(),)