Compare commits

..

3 Commits

Author SHA1 Message Date
mb-wali
1455cb8670 v3.7.1.dev2 2022-01-13 11:55:40 +01:00
David Eckhard
0bb5885a95 test: add invenio-app-rdm to test requirements 2022-01-13 11:43:44 +01:00
David Eckhard
dbfda0cc00 modify: override record deposit template and increase upload size 2022-01-13 11:43:44 +01:00
41 changed files with 1082 additions and 440 deletions

View File

@@ -15,6 +15,15 @@ insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
charset = utf-8 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 files (used by sphinx)
[*.rst] [*.rst]
indent_size = 4 indent_size = 4

View File

@@ -1 +0,0 @@
cd71ecd24b8fc2253a58c60082c80a87c8085601

View File

@@ -15,7 +15,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install setuptools wheel babel pip install setuptools wheel
- name: Build package - name: Build package
run: | run: |
python setup.py compile_catalog sdist bdist_wheel python setup.py compile_catalog sdist bdist_wheel

View File

@@ -1,11 +1,3 @@
# -*- 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 name: CI
on: on:
@@ -28,18 +20,42 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
python-version: [3.8, 3.9] python-version: [3.6, 3.7, 3.8, 3.9]
requirements-level: [pypi] requirements-level: [min, pypi]
db-service: [postgresql13] db-service: [postgresql12]
search-service: [elasticsearch7] 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: include:
- db-service: postgresql12
DB_EXTRAS: "postgresql"
- search-service: elasticsearch7 - search-service: elasticsearch7
SEARCH_EXTRAS: "elasticsearch7" SEARCH_EXTRAS: "elasticsearch7"
env: env:
DB: ${{ matrix.db-service }} DB: ${{ matrix.db-service }}
SEARCH: ${{ matrix.search-service }} SEARCH: ${{ matrix.search-service }}
EXTRAS: tests,${{ matrix.SEARCH_EXTRAS }} EXTRAS: all,${{ matrix.DB_EXTRAS }},${{ matrix.SEARCH_EXTRAS }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@@ -51,7 +67,7 @@ jobs:
- name: Generate dependencies - name: Generate dependencies
run: | run: |
pip install wheel requirements-builder python -m pip install --upgrade pip setuptools py wheel requirements-builder
requirements-builder -e "$EXTRAS" --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt requirements-builder -e "$EXTRAS" --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt
- name: Cache pip - name: Cache pip
uses: actions/cache@v2 uses: actions/cache@v2

View File

@@ -5,11 +5,6 @@
# invenio-theme-tugraz is free software; you can redistribute it and/or # 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 # modify it under the terms of the MIT License; see LICENSE file for more
# details. # details.
#
# 1) Create message catalog:
# $ python setup.py extract_messages
# $ python setup.py update_catalog -l de
# $ python setup.py compile_catalog
[main] [main]
host = https://www.transifex.com host = https://www.transifex.com

View File

@@ -7,45 +7,9 @@
Changes Changes
======= =======
Version 3.7.1.dev2 (released 2022-01-13)
Version v4.0.2 (release 2022-09-09) - modify: override record deposit template and increase upload size #256
- release v4.0.1
- update translation
- improve wording on search options
Version v4.0.1 (release 2022-08-05)
- update translation
- improve wording on search options
Version v4.0.0 (release 2022-07-29)
- remove unnecessary html code for header-search-bar
- fix warning from semantic-ui-react Search component
- add marc21 and lom to the searchbar
- change searchbar layout and use invenio-app-rdm searchbar
- remove grey color of community block and reduce size
- migrate js to use prettier
Version 3.9.2 (released 2022-06-28)
- fix: adopt renaming of serialize function (#269)
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) Version 3.7.0 (released 2021-12-07)

View File

@@ -41,4 +41,3 @@ recursive-include tests *.py
recursive-include invenio_theme_tugraz *.jpg recursive-include invenio_theme_tugraz *.jpg
recursive-include invenio_theme_tugraz *.gitkeep recursive-include invenio_theme_tugraz *.gitkeep
recursive-include .github/workflows *.yml recursive-include .github/workflows *.yml
include .git-blame-ignore-revs

View File

@@ -15,6 +15,7 @@ encoding = utf-8
[jinja2: **/templates/**.html] [jinja2: **/templates/**.html]
encoding = utf-8 encoding = utf-8
extensions = jinja2.ext.autoescape, jinja2.ext.with_
# Extraction from JavaScript files # Extraction from JavaScript files

View File

@@ -8,7 +8,7 @@
"""Sphinx configuration.""" """Sphinx configuration."""
from invenio_theme_tugraz import __version__ import os
# -- General configuration ------------------------------------------------ # -- General configuration ------------------------------------------------
@@ -44,9 +44,9 @@ source_suffix = ".rst"
master_doc = "index" master_doc = "index"
# General information about the project. # General information about the project.
project = "invenio-theme-tugraz" project = u"invenio-theme-tugraz"
copyright = "2020, Graz University of Technology" copyright = u"2020, Graz University of Technology"
author = "Graz University of Technology" author = u"Graz University of Technology"
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
@@ -54,8 +54,17 @@ author = "Graz University of Technology"
# #
# The short X.Y version. # 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. # The full version, including alpha/beta/rc tags.
release = __version__ release = version
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
@@ -241,8 +250,8 @@ latex_documents = [
( (
master_doc, master_doc,
"invenio-theme-tugraz.tex", "invenio-theme-tugraz.tex",
"invenio-theme-tugraz Documentation", u"invenio-theme-tugraz Documentation",
"Graz University of Technology", u"Graz University of Technology",
"manual", "manual",
), ),
] ]
@@ -276,7 +285,7 @@ man_pages = [
( (
master_doc, master_doc,
"invenio-theme-tugraz", "invenio-theme-tugraz",
"invenio-theme-tugraz Documentation", u"invenio-theme-tugraz Documentation",
[author], [author],
1, 1,
) )
@@ -295,7 +304,7 @@ texinfo_documents = [
( (
master_doc, master_doc,
"invenio-theme-tugraz", "invenio-theme-tugraz",
"invenio-theme-tugraz Documentation", u"invenio-theme-tugraz Documentation",
author, author,
"invenio-theme-tugraz", "invenio-theme-tugraz",
"invenio module for TUGRAZ theme.", "invenio module for TUGRAZ theme.",

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (C) 2020-2022 Graz University of Technology. # Copyright (C) 2020-2021 Graz University of Technology.
# #
# invenio-theme-tugraz is free software; you can redistribute it and/or # 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 # modify it under the terms of the MIT License; see LICENSE file for more
@@ -9,7 +9,6 @@
"""invenio module for TUGRAZ theme.""" """invenio module for TUGRAZ theme."""
from .ext import InvenioThemeTugraz from .ext import InvenioThemeTugraz
from .version import __version__
__version__ = "4.0.2"
__all__ = ("__version__", "InvenioThemeTugraz") __all__ = ("__version__", "InvenioThemeTugraz")

View File

@@ -0,0 +1,398 @@
// This file is part of InvenioRDM
// Copyright (C) 2020 CERN.
// Copyright (C) 2020 Northwestern University.
// Copyright (C) 2022 Graz University of Technology.
//
// Invenio App RDM 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 _get from "lodash/get";
import React, { Component, createRef, Fragment } from "react";
import {
AccessRightField,
CreatibutorsField,
DatesField,
DeleteButton,
DepositFormApp,
DepositFormTitle,
DescriptionsField,
FileUploader,
FormFeedback,
IdentifiersField,
LanguagesField,
SubjectsField,
LicenseField,
PIDField,
PreviewButton,
PublicationDateField,
PublishButton,
PublisherField,
RelatedWorksField,
ResourceTypeField,
SaveButton,
TitlesField,
VersionField,
} from "react-invenio-deposit";
import { AccordionField } from "react-invenio-forms";
import { Card, Container, Divider, Grid, Ref, Sticky } from "semantic-ui-react";
import { i18next } from "@translations/invenio_app_rdm/i18next";
export class RDMDepositForm extends Component {
constructor(props) {
super(props);
this.config = props.config || {};
// TODO: retrieve from backend
this.config["canHaveMetadataOnlyRecords"] = true;
// TODO: Make ALL vocabulary be generated by backend.
// Currently, some vocabulary is generated by backend and some is
// generated by frontend here. Iteration is faster and abstractions can be
// discovered by generating vocabulary here. Once happy with vocabularies,
// then we can generate it in the backend.
this.vocabularies = {
metadata: {
...this.config.vocabularies,
creators: {
...this.config.vocabularies.creators,
type: [
{ text: "Person", value: "personal" },
{ text: "Organization", value: "organizational" },
],
},
contributors: {
...this.config.vocabularies.creators,
type: [
{ text: "Person", value: "personal" },
{ text: "Organization", value: "organizational" },
],
},
// TODO: Replace with an API backend
funding: {
funder: [
{
name: "National Institutes of Health (US)",
identifier: "funder1",
scheme: "funderScheme1",
},
{
name: "European Commission (EU)",
identifier: "funder2",
scheme: "funderScheme2",
},
],
award: [
{
title: "CANCER &AIDS DRUGS--PRECLIN PHARMACOL/TOXICOLOGY",
number: "N01CM037835-016",
identifier: "awardA",
scheme: "awardSchemeA",
parentScheme: "funderScheme1",
parentIdentifier: "funder1",
},
{
title:
"Beyond the Standard Model at the LHC and with Atom Interferometers.",
number: "228169",
identifier: "awardB1",
scheme: "awardSchemeB",
parentScheme: "funderScheme2",
parentIdentifier: "funder2",
},
{
title: "ENvironmental COnditions in GLAucoma Patients",
number: "747441",
identifier: "awardB2",
scheme: "awardSchemeB",
parentScheme: "funderScheme2",
parentIdentifier: "funder2",
},
],
},
identifiers: {
...this.config.vocabularies.identifiers,
},
},
};
// check if files are present
this.noFiles = false;
if (
!Array.isArray(this.props.files.entries) ||
(!this.props.files.entries.length && this.props.record.is_published)
) {
this.noFiles = true;
}
}
formFeedbackRef = createRef();
sidebarRef = createRef();
accordionStyle = {
header: { className: "inverted brand", style: { cursor: "pointer" } },
};
render() {
return (
<DepositFormApp
config={this.config}
record={this.props.record}
files={this.props.files}
permissions={this.props.permissions}
>
<FormFeedback fieldPath="message" />
<Container style={{ marginTop: "10px" }}>
<DepositFormTitle />
<Grid>
<Grid.Row>
<Grid.Column width={11}>
<AccordionField
fieldPath=""
active={true}
label={i18next.t("Files")}
ui={this.accordionStyle}
>
{this.noFiles && this.props.record.is_published && (
<p
style={{
textAlign: "center",
opacity: "0.5",
cursor: "default !important",
}}
>
<em>{i18next.t("The record has no files.")}</em>
</p>
)}
<FileUploader
isDraftRecord={!this.props.record.is_published}
quota={{
maxFiles: 100,
maxStorage: 10 ** 11,
}}
/>
</AccordionField>
<AccordionField
fieldPath=""
active={true}
label={i18next.t("Basic information")}
ui={this.accordionStyle}
>
{this.config.pids.map((pid) => (
<Fragment key={pid.scheme}>
<PIDField
btnLabelDiscardPID={pid.btn_label_discard_pid}
btnLabelGetPID={pid.btn_label_get_pid}
canBeManaged={pid.can_be_managed}
canBeUnmanaged={pid.can_be_unmanaged}
fieldPath={`pids.${pid.scheme}`}
fieldLabel={pid.field_label}
isEditingPublishedRecord={
this.props.record.is_published === true // is_published is `null` at first upload
}
managedHelpText={pid.managed_help_text}
pidLabel={pid.pid_label}
pidPlaceholder={pid.pid_placeholder}
pidType={pid.scheme}
unmanagedHelpText={pid.unmanaged_help_text}
required
/>
<Divider />
</Fragment>
))}
<ResourceTypeField
options={this.vocabularies.metadata.resource_type}
required
/>
<TitlesField
options={this.vocabularies.metadata.titles}
recordUI={this.props.record.ui}
required
/>
<PublicationDateField required />
<CreatibutorsField
label={i18next.t("Creators")}
labelIcon={"user"}
fieldPath={"metadata.creators"}
roleOptions={this.vocabularies.metadata.creators.role}
schema="creators"
required
/>
<DescriptionsField
options={this.vocabularies.metadata.descriptions}
recordUI={_get(this.props.record, "ui", null)}
editorConfig={{
removePlugins: [
"Image",
"ImageCaption",
"ImageStyle",
"ImageToolbar",
"ImageUpload",
"MediaEmbed",
"Table",
"TableToolbar",
"TableProperties",
"TableCellProperties",
],
}}
/>
<LicenseField
fieldPath="metadata.rights"
searchConfig={{
searchApi: {
axios: {
headers: {
Accept: "application/vnd.inveniordm.v1+json",
},
url: "/api/vocabularies/licenses",
withCredentials: false,
},
},
initialQueryState: {
filters: [["tags", "recommended"]],
},
}}
serializeLicenses={(result) => ({
title: result.title_l10n,
description: result.description_l10n,
id: result.id,
link: result.props.url,
})}
/>
<br />
</AccordionField>
<AccordionField
fieldPath=""
active={true}
label={i18next.t("Recommended information")}
ui={this.accordionStyle}
>
<CreatibutorsField
addButtonLabel={i18next.t("Add contributor")}
label={i18next.t("Contributors")}
labelIcon={"user plus"}
fieldPath={"metadata.contributors"}
roleOptions={this.vocabularies.metadata.contributors.role}
schema="contributors"
modal={{
addLabel: "Add contributor",
editLabel: "Edit contributor",
}}
/>
<SubjectsField
initialOptions={_get(
this.props.record,
"ui.subjects",
null
)}
limitToOptions={
this.vocabularies.metadata.subjects.limit_to
}
/>
<LanguagesField
initialOptions={_get(
this.props.record,
"ui.languages",
[]
).filter((lang) => lang !== null)} // needed because dumped empty record from backend gives [null]
serializeSuggestions={(suggestions) =>
suggestions.map((item) => ({
text: item.title_l10n,
value: item.id,
key: item.id,
}))
}
/>
<DatesField options={this.vocabularies.metadata.dates} />
<VersionField />
<PublisherField />
<br />
</AccordionField>
{/**TODO: uncomment to use FundingField*/}
{/* <AccordionField
fieldPath=""
active={true}
label={"Funding"}
ui={this.accordionStyle}
>
<FundingField options={this.vocabularies.metadata.funding} />
<ComingSoonField
fieldPath="metadata.funding"
label="Awards"
labelIcon="money bill alternate outline"
/>
<br />
</AccordionField> */}
<AccordionField
fieldPath=""
active={true}
label={i18next.t("Alternate identifiers")}
ui={this.accordionStyle}
>
<IdentifiersField
fieldPath="metadata.identifiers"
label={i18next.t("Alternate identifier(s)")}
labelIcon="barcode"
schemeOptions={
this.vocabularies.metadata.identifiers.scheme
}
/>
</AccordionField>
<AccordionField
fieldPath=""
active={true}
label={i18next.t("Related works")}
ui={this.accordionStyle}
>
<RelatedWorksField
options={this.vocabularies.metadata.identifiers}
/>
<br />
</AccordionField>
</Grid.Column>
<Ref innerRef={this.sidebarRef}>
<Grid.Column width={5} className="deposit-sidebar">
<Sticky context={this.sidebarRef} offset={20}>
<Card className="actions">
<Card.Content>
<div className="sidebar-buttons">
<SaveButton fluid className="save-button" />
<PreviewButton fluid className="preview-button" />
</div>
<PublishButton fluid />
</Card.Content>
</Card>
<Card className="actions">
<Card.Content>
<DeleteButton
fluid
// TODO: make is_published part of the API response
// so we don't have to do this
isPublished={this.props.record.is_published}
/>
</Card.Content>
</Card>
<AccessRightField
label={i18next.t("Visibility")}
labelIcon={"shield"}
/>
</Sticky>
</Grid.Column>
</Ref>
</Grid.Row>
</Grid>
</Container>
</DepositFormApp>
);
}
}

View File

@@ -0,0 +1,23 @@
// This file is part of InvenioRDM
// Copyright (C) 2020 CERN.
// Copyright (C) 2020 Northwestern University.
//
// Invenio App RDM 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 React from "react";
import ReactDOM from "react-dom";
import "semantic-ui-css/semantic.min.css";
import { i18next } from "@translations/invenio_app_rdm/i18next";
import { getInputFromDOM } from "react-invenio-deposit";
import { RDMDepositForm } from "./RDMDepositForm";
ReactDOM.render(
<RDMDepositForm
record={getInputFromDOM("deposits-record")}
files={getInputFromDOM("deposits-record-files")}
config={getInputFromDOM("deposits-config")}
permissions={getInputFromDOM("deposits-record-permissions")}
/>,
document.getElementById("deposit-form")
);

View File

@@ -1,9 +1,5 @@
import $ from "jquery"; import $ from 'jquery';
import "semantic-ui-css"; import 'semantic-ui-css';
import { MultipleOptionsSearchBar } from "@js/invenio_search_ui/components";
import { i18next } from "@translations/invenio_app_rdm/i18next";
import ReactDOM from "react-dom";
import React from "react";
// called on document ready // called on document ready
$(function() { $(function() {
@@ -17,21 +13,23 @@ function importZammadScript() {
document.head.appendChild(scriptNode); document.head.appendChild(scriptNode);
$.getScript("https://ub-support.tugraz.at/assets/form/form.js", () => { $.getScript("https://ub-support.tugraz.at/assets/form/form.js", () => {
$("#feedback-form").ZammadForm({ $('#feedback-form').ZammadForm({
messageTitle: "Contact us", messageTitle: 'Contact us',
showTitle: true, showTitle: true,
messageSubmit: "Submit", messageSubmit: 'Submit',
messageThankYou: messageThankYou: 'Thank you for your message, (#%s). We will get back to you as quickly as possible!',
"Thank you for your message, (#%s). We will get back to you as quickly as possible!", modal: true
modal: true,
}); });
}); });
} }
// used for sticky test instance notification // used for sticky test instance notification
$(".ui.sticky.test-instance").sticky({ $('.ui.sticky.test-instance')
context: "body", .sticky({
}); context: 'body'
})
;
export function toggleVisibility(id) { export function toggleVisibility(id) {
var element = document.getElementById(id); var element = document.getElementById(id);
@@ -41,14 +39,3 @@ export function toggleVisibility(id) {
} }
window.toggleVisibility = toggleVisibility; window.toggleVisibility = toggleVisibility;
const headerSearchbar = document.getElementById("header-search-bar");
const searchBarOptions = JSON.parse(headerSearchbar.dataset.options);
ReactDOM.render(
<MultipleOptionsSearchBar
options={searchBarOptions}
placeholder={i18next.t("Search records...")}
/>,
headerSearchbar
);

View File

@@ -1,14 +0,0 @@
/*
* Copyright (C) 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.
*/
.ui.container.page-subheader-outer {
background-color: unset;
}
.ui.fluid.container {
width: fit-content;
}

View File

@@ -255,10 +255,3 @@ span.home-inline{
border: solid @notificationBorder 1px; border: solid @notificationBorder 1px;
z-index: 100000; z-index: 100000;
} }
#skip-to-main {
background-color: @primaryButton;
&:focus {
background-color: @primaryButtonInverted;
}
}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020-2022 Graz University of Technology. * Copyright (C) 2020-2021 Graz University of Technology.
* *
* invenio-theme-tugraz is free software; you can redistribute it and/or modify it * 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. * under the terms of the MIT License; see LICENSE file for more details.
@@ -15,7 +15,6 @@
@import "macros"; @import "macros";
@import "login"; @import "login";
@import "deposit"; @import "deposit";
@import "communities";
/*** /***
**TODO: **TODO:
@@ -33,7 +32,3 @@
transition: background-color 0.15s ease 0s, color 0.15s ease 0s; transition: background-color 0.15s ease 0s, color 0.15s ease 0s;
outline: none; outline: none;
} }
.nowrap-link {
white-space: nowrap;
}

View File

@@ -46,7 +46,7 @@
@primaryLinkHoverBackground : @primaryText; @primaryLinkHoverBackground : @primaryText;
@primaryButton : @primaryBackground; @primaryButton : @primaryBackground;
@primaryButtonHoverBackground : @primaryText; @primaryButtonHoverBackground : @primaryText;
@primaryButtonInverted : @primaryText; @primaryButtonInverted : #000f;

View File

@@ -16,7 +16,9 @@ INVENIO_THEME_TUGRAZ_DEFAULT_VALUE = _("TU Graz Repository")
INVENIO_THEME_TUGRAZ_BASE_TEMPLATE = "invenio_theme_tugraz/base.html" INVENIO_THEME_TUGRAZ_BASE_TEMPLATE = "invenio_theme_tugraz/base.html"
"""TU Graz Default base template""" """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""" """TU Graz Default account base template"""
INVENIO_THEME_TUGRAZ_ICON = "images/icon_use.png" INVENIO_THEME_TUGRAZ_ICON = "images/icon_use.png"
@@ -73,7 +75,9 @@ THEME_SITENAME = _("Repository")
SECURITY_LOGIN_USER_TEMPLATE = "invenio_theme_tugraz/accounts/login_user.html" SECURITY_LOGIN_USER_TEMPLATE = "invenio_theme_tugraz/accounts/login_user.html"
"""Login template""" """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""" """Sigup template"""
# Invenio-app-rdm # Invenio-app-rdm

View File

@@ -0,0 +1,50 @@
# -*- 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.
"""Routes for record-related pages provided by Invenio-App-RDM."""
from flask import render_template
from flask_login import login_required
from invenio_app_rdm.records_ui.views.decorators import pass_draft, pass_draft_files
from invenio_app_rdm.records_ui.views.deposits import (
get_form_config,
get_search_url,
new_record,
)
from invenio_rdm_records.resources.serializers import UIJSONSerializer
@login_required
def deposit_create():
"""Create a new deposit."""
return render_template(
"invenio_theme_tugraz/records/deposit.html",
forms_config=get_form_config(createUrl=("/api/records")),
searchbar_config=dict(searchUrl=get_search_url()),
record=new_record(),
files=dict(
default_preview=None, entries=[], links={}
),
)
@login_required
@pass_draft
@pass_draft_files
def deposit_edit(draft=None, draft_files=None, pid_value=None):
"""Edit an existing deposit."""
record = UIJSONSerializer().serialize_object_to_dict(draft.to_dict())
return render_template(
"invenio_theme_tugraz/records/deposit.html",
forms_config=get_form_config(apiUrl=f"/api/records/{pid_value}/draft"),
record=record,
files=draft_files.to_dict(),
searchbar_config=dict(searchUrl=get_search_url()),
permissions=draft.has_permissions_to(['new_version'])
)

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- 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 # 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 # modify it under the terms of the MIT License; see LICENSE file for more
@@ -8,6 +8,8 @@
"""invenio module for TUGRAZ theme.""" """invenio module for TUGRAZ theme."""
from invenio_theme_tugraz.deposits import deposit_create, deposit_edit
from . import config from . import config
from .views import index from .views import index
@@ -25,6 +27,8 @@ class InvenioThemeTugraz(object):
# add index route rule # add index route rule
# https://flask.palletsprojects.com/en/1.1.x/api/#flask.Flask.add_url_rule # https://flask.palletsprojects.com/en/1.1.x/api/#flask.Flask.add_url_rule
app.add_url_rule("/", "index", index) app.add_url_rule("/", "index", index)
app.add_url_rule("/uploads/new", "deposit_create", deposit_create)
app.add_url_rule("/uploads/<pid_value>", "deposit_edit", deposit_edit)
self.init_config(app) self.init_config(app)
app.extensions["invenio-theme-tugraz"] = self app.extensions["invenio-theme-tugraz"] = self

View File

@@ -8,6 +8,8 @@
"""Frontpage records.""" """Frontpage records."""
from __future__ import absolute_import, print_function
from elasticsearch_dsl.query import Q from elasticsearch_dsl.query import Q
from invenio_search.api import RecordsSearch from invenio_search.api import RecordsSearch
@@ -20,6 +22,5 @@ class FrontpageRecordsSearch(RecordsSearch):
index = "rdmrecords-records" index = "rdmrecords-records"
default_filter = Q( default_filter = Q(
"query_string", "query_string", query=(
query=("access.record:public " "AND versions.is_latest:true"), "access.record:public " "AND versions.is_latest:true"))
)

View File

@@ -53,9 +53,9 @@
{%- with form = login_user_form %} {%- with form = login_user_form %}
{%- set accordion_active = "active" if form.errors else "" %} {%- set accordion_active = "active" if form.errors else "" %}
<div class="ui styled accordion"> <div class="ui styled accordion">
<div class="title trigger {{ accordion_active }}"> <div class="title {{ accordion_active }}">
{{ _('Log in with repository credentials') }} {{ _('Log in with repository credentials') }}
<i class="user icon button"></i> <i class="user icon"></i>
</div> </div>
<div class="content {{ accordion_active }}"> <div class="content {{ accordion_active }}">
<form action="{{ url_for_security('login') }}" method="POST" name="login_user_form" class="ui large form"> <form action="{{ url_for_security('login') }}" method="POST" name="login_user_form" class="ui large form">

View File

@@ -61,9 +61,9 @@
{%- set accordion_active = "active" if form.errors else "" %} {%- set accordion_active = "active" if form.errors else "" %}
<div class="ui padded centered large form"> <div class="ui padded centered large form">
<div class="ui styled accordion"> <div class="ui styled accordion">
<div class="title trigger {{ accordion_active }}"> <div class="title {{ accordion_active }}">
{{ _('Sign up with repository credentials') }} {{ _('Sign up with repository credentials') }}
<i class="user icon button"></i> <i class="user icon"></i>
</div> </div>
<div class="content {{ accordion_active }}"> <div class="content {{ accordion_active }}">
<form class="ui large form" action="{{ url_for_security('register') }}" method="POST" name="register_user_form"> <form class="ui large form" action="{{ url_for_security('register') }}" method="POST" name="register_user_form">

View File

@@ -13,7 +13,6 @@
</div> </div>
{% endif %} {% endif %}
<div>
<header> <header>
{%- block navbar %} {%- block navbar %}
<nav> <nav>
@@ -41,20 +40,11 @@
</span> </span>
</a> </a>
</div> </div>
{%- for item in current_menu.submenu('main').children|sort(attribute='order') if item.visible recursive %} {%- for item in current_menu.submenu('main').children|sort(attribute='order') if item.visible recursive %}
<div class="two wide column main-menu-entry"> <div class="two wide column main-menu-entry">
<a role="menuitem" href="{{ item.url }}" class="no-decoration">{{ item.text|safe }}</a> <a href="{{ item.url }}" class="no-decoration">{{ item.text|safe }}</a>
</div> </div>
{% endfor %} {%- 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>
<div id="margin-divider" class="ui divider main-menu-underline-line"> <div id="margin-divider" class="ui divider main-menu-underline-line">
@@ -72,11 +62,9 @@
{%- from "invenio_theme/macros/messages.html" import flashed_messages with context -%} {%- from "invenio_theme/macros/messages.html" import flashed_messages with context -%}
{{ flashed_messages() }} {{ flashed_messages() }}
{%- endblock %} {%- endblock %}
</header>
{# {#
{%- block breadcrumbs %} {%- block breadcrumbs %}
{%- include "invenio_theme/breadcrumbs.html" %} {%- include "invenio_theme/breadcrumbs.html" %}
{%- endblock breadcrumbs %} {%- endblock breadcrumbs %}
#} #}
</div> </header>

View File

@@ -17,8 +17,25 @@
{%- block page_body %} {%- block page_body %}
<div class="ui container"> <div class="ui container">
<div class="ui divider hidden"></div> {%- block frontpage_search %}
{%- block frontpage_form %}
<div class="ui center aligned grid">
<div class="sixteen wide column">
<form action="{{config.THEME_SEARCH_ENDPOINT}}" class="ui form" role="search">
<div class="ui fluid big action icon input">
<input type="text" name="q" autofocus="autofocus" placeholder="{{ _("Type and press enter to search") }}">
<button type="submit" class="ui icon search button">
<i class="icon search"></i>
</button>
</div>
</form>
</div>
</div>
<div class="ui divider hidden"></div>
{%- endblock frontpage_form %}
{%- endblock frontpage_search %}
<div class="ui stackable grid"> <div class="ui stackable grid">
<!---Recent uploads--> <!---Recent uploads-->

View File

@@ -1,43 +1,18 @@
{# {#
Copyright (C) 2020-2022 Graz University of Technology. Copyright (C) 2020-2021 Graz University of Technology.
invenio-theme-tugraz is free software; you can redistribute it and/or 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 modify it under the terms of the MIT License; see LICENSE file for more
details. details.
#} #}
{% set options = [
{
"key": "records",
"text": _("All") + " " + config.THEME_SITENAME,
"value": url_for("invenio_search_ui.search"),
"title": "repo",
},{
"key": "marc21",
"text": _("Publications"),
"value": url_for("invenio_records_marc21.search"),
"title": "publication",
},{
"key": "lom",
"text": _("Open Educational Resources"),
"value": url_for("invenio_records_lom.search"),
"title": "oer",
}
]
%}
<div class="ui container"> <div class="ui container">
<div class="short-menu" id="all-menu-top-table"> <div class="short-menu" id="all-menu-top-table">
<div class="short-menu-left"> <div class="short-menu-left">
<div id="all-menu-top-left-item"> <div id="all-menu-top-left-item">
<div class="short-menu-left-search"> <div class="short-menu-left-search">
<div style="display: inline-block;"> {%- if config.I18N_LANGUAGES %}
<div class="item p-0 search-bar rel-mr-1"> <div class="short-menu-left-lang" style="margin-right:10px; font-size:18px;">
<div id="header-search-bar" data-options='{{ options | tojson }}'></div>
</div>
</div>
<div class="short-menu-left-lang">
{%- for l in current_i18n.get_locales() %} {%- for l in current_i18n.get_locales() %}
{%- if current_i18n.language != l.language %} {%- if current_i18n.language != l.language %}
<a <a
@@ -45,6 +20,21 @@
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
</div> </div>
{%- endif %}
<div class="search-icon-header">
<a href="{{url_for('invenio_search_ui.search')}}" class="no-decoration">
<svg class="short-menu-icon" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg" height="26.015" width="26.015" version="1.1"
xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"
viewBox="0 0 26.01515 26.01515">
<g stroke-miterlimit="10" transform="translate(1,1)">
<circle cy="8.5" cx="8.5" r="8" style="stroke-miterlimit:10;stroke-width:2"></circle>
<path style="stroke-width:2;stroke-miterlimit:10;stroke-linecap:round" d="m14.156 14.156 9.344 9.344">
</path>
</g>
</svg>
</a>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,38 @@
{#
Copyright (C) 2020 CERN.
Copyright (C) 2020 Northwestern University.
Copyright (C) 2022 Graz University of Technology.
Invenio App RDM is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}
{%- if not record.is_published and record.versions.index and record.versions.index > 1%}
{%- set title = _("New version") %}
{%- elif not record.is_published %}
{%- set title = _("New upload") %}
{% else %}
{%- set title = _("Edit upload") %}
{%- endif %}
{%- extends config.BASE_TEMPLATE %}
{%- block page_body %}
{%- if record %}
<input id="deposits-record" type="hidden" name="deposits-record" value='{{record | tojson }}'></input>
{%- endif %}
{%- if files %}
<input id="deposits-record-files" type="hidden" name="deposits-record-files" value='{{files | tojson }}'></input>
{%- endif %}
{%- if forms_config %}
<input type="hidden" name="deposits-config" value='{{forms_config | tojson }}'></input>
{%- endif %}
{%- if permissions %}
<input id="deposits-record-permissions" type="hidden" name="deposits-record-permissions" value='{{permissions | tojson }}'></input>
{%- endif %}
<div id="deposit-form"></div>
{%- endblock page_body %}
{%- block javascript %}
{{ super() }}
{{ webpack['invenio-theme-tugraz-rdm-deposit.js'] }}
{%- endblock %}

View File

@@ -8,23 +8,22 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: invenio-theme-tugraz 1.0.4\n" "Project-Id-Version: invenio-theme-tugraz 1.0.4\n"
"Report-Msgid-Bugs-To: mojib.wali@tugraz.at\n" "Report-Msgid-Bugs-To: mojib.wali@tugraz.at\n"
"POT-Creation-Date: 2022-08-05 10:15+0200\n" "POT-Creation-Date: 2021-11-02 15:12+0100\n"
"PO-Revision-Date: 2022-08-05 10:21+0200\n" "PO-Revision-Date: 2020-10-06 10:27+0200\n"
"Last-Translator: \n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: de <LL@li.org>\n"
"Language: de\n" "Language: de\n"
"Language-Team: de <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Generated-By: Babel 2.9.0\n"
"Generated-By: Babel 2.9.1\n"
"X-Generator: Poedit 2.3.1\n"
#: invenio_theme_tugraz/config.py:13 invenio_theme_tugraz/config.py:60 #: invenio_theme_tugraz/config.py:13 invenio_theme_tugraz/config.py:62
msgid "TU Graz Repository" msgid "TU Graz Repository"
msgstr "TU Graz Repository" msgstr "TU Graz Repository"
#: invenio_theme_tugraz/config.py:63 #: invenio_theme_tugraz/config.py:65
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html:30 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html:30
msgid "Repository" msgid "Repository"
msgstr "Repository" msgstr "Repository"
@@ -40,8 +39,8 @@ msgstr "Sicher"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:3 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:3
msgid "" msgid ""
"your research is stored safely for the future in TU Graz library for as long " "your research is stored safely for the future in TU Graz library for as "
"as TU Graz library exists." "long as TU Graz library exists."
msgstr "" msgstr ""
"Ihre Forschung ist in der Bibliothek der TU Graz für die Zukunft " "Ihre Forschung ist in der Bibliothek der TU Graz für die Zukunft "
"gespeichert, solange die Bibliothek der TU Graz existiert." "gespeichert, solange die Bibliothek der TU Graz existiert."
@@ -52,8 +51,8 @@ msgstr "Vertrauenswürdig"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:4 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:4
msgid "" msgid ""
"built and operated by CERN and OpenAIRE to ensure that everyone can join in " "built and operated by CERN and OpenAIRE to ensure that everyone can join "
"Open Science." "in Open Science."
msgstr "" msgstr ""
"Aufgebaut und betrieben von CERN und OpenAIRE, um sicherzustellen, dass " "Aufgebaut und betrieben von CERN und OpenAIRE, um sicherzustellen, dass "
"jeder an Open Science teilnehmen kann." "jeder an Open Science teilnehmen kann."
@@ -67,8 +66,8 @@ msgid ""
"every upload is assigned a Digital Object Identifier (DOI), to make them " "every upload is assigned a Digital Object Identifier (DOI), to make them "
"citable and trackable." "citable and trackable."
msgstr "" msgstr ""
"Jeder Upload wird mit einem Digital Object Identifier (DOI) versehen,um ihn " "Jeder Upload wird mit einem Digital Object Identifier (DOI) versehen,um "
"zitierfähig und nachverfolgbar zu" "ihn zitierfähig und nachverfolgbar zu"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:6 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:6
msgid "No waiting time" msgid "No waiting time"
@@ -76,11 +75,11 @@ msgstr "Keine Wartezeit"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:6 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:6
msgid "" msgid ""
"Uploads are made available online as soon as you hit publish, and your DOI " "Uploads are made available online as soon as you hit publish, and your "
"is registered within seconds." "DOI is registered within seconds."
msgstr "" msgstr ""
"Uploads stehen sofort nach drücken auf “Veröffentlichen” zur Verfügung. Ihre " "Uploads stehen sofort nach drücken auf “Veröffentlichen” zur Verfügung. "
"DOI wird innerhalb von Sekunden registriert." "Ihre DOI wird innerhalb von Sekunden registriert."
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:7 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:7
msgid "Open or closed" msgid "Open or closed"
@@ -91,8 +90,8 @@ msgid ""
"Share e.g. anonymized clinical trial data with only medical professionals" "Share e.g. anonymized clinical trial data with only medical professionals"
" via our restricted access mode." " via our restricted access mode."
msgstr "" msgstr ""
"Teilen Sie z.B. anonymisierte klinische Studiendaten nur mit medizinischem " "Teilen Sie z.B. anonymisierte klinische Studiendaten nur mit "
"Fachpersonal über unseren eingeschränkten Zugriffsmodus." "medizinischem Fachpersonal über unseren eingeschränkten Zugriffsmodus."
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:8 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/benefits.html:8
msgid "Versioning" msgid "Versioning"
@@ -198,10 +197,9 @@ msgstr "Um die Schriftgröße zu ändern."
#, fuzzy, python-format #, fuzzy, python-format
msgid "" msgid ""
"<strong>Powered by</strong>\n" "<strong>Powered by</strong>\n"
" <a href=\"%(invenio_rdm)s\" target=\"_blank\" title=\"invenioRDM" " <a href=\"%(invenio_rdm)s\" target=\"_blank\" "
"\">" "title=\"invenioRDM\">"
msgstr "" msgstr "<strong>Powered by</strong> <a href=\"%(invenio_rdm)s\" target=\"_blank\">"
"<strong>Powered by</strong> <a href=\"%(invenio_rdm)s\" target=\"_blank\">"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html:126 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html:126
#, fuzzy, python-format #, fuzzy, python-format
@@ -209,8 +207,7 @@ msgid ""
"<strong>Enabled by</strong>\n" "<strong>Enabled by</strong>\n"
" <a href=\"%(fair_data)s\" target=\"_blank\" title=\"Fair Data" " <a href=\"%(fair_data)s\" target=\"_blank\" title=\"Fair Data"
" Austria\">" " Austria\">"
msgstr "" msgstr "<strong>Enabled by</strong> <a href=\"%(fair_data)s\" target=\"_blank\">"
"<strong>Enabled by</strong> <a href=\"%(fair_data)s\" target=\"_blank\">"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html:140 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html:140
#, python-format #, python-format
@@ -238,109 +235,99 @@ msgstr "Testumgebung"
msgid "This is the test instance of the TU Graz Repository." msgid "This is the test instance of the TU Graz Repository."
msgstr "Dies ist die Testumgebung des TU Graz Repositorys." msgstr "Dies ist die Testumgebung des TU Graz Repositorys."
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html:40 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html:39
msgid "Home" msgid "Home"
msgstr "Startseite" msgstr "Startseite"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:26 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:27
msgid "Type and press enter to search"
msgstr "Suchbegriff eingeben und “Enter” drücken (?)"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:43
msgid "Recent uploads" msgid "Recent uploads"
msgstr "Kürzlich hochgeladene Dateien" msgstr "Kürzlich hochgeladene Dateien"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:30 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:47
msgid "There are no public records to show." msgid "There are no public records to show."
msgstr "Es sind keine öffentlich zugänglichen Datensätze vorhanden." msgstr "Es sind keine öffentlich zugänglichen Datensätze vorhanden."
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:44 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:61
msgid "Publication date" msgid "Publication date"
msgstr "Datum der Veröffentlichung" msgstr "Datum der Veröffentlichung"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:49 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:66
msgid "Resource type" msgid "Resource type"
msgstr "Art der Veröffentlichung" msgstr "Art der Veröffentlichung"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:87 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:104
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
" Uploaded on %(date)s\n" " Uploaded on %(date)s\n"
" " " "
msgstr "" msgstr "Hochgeladen am %(date)s\n"
"\n"
"\t\tHochgeladen am %(date)s"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:101 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:118
msgid "More" msgid "More"
msgstr "Mehr" msgstr "Mehr"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:111 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:128
msgid "Need help?" msgid "Need help?"
msgstr "Brauchen Sie Hilfe?" msgstr "Brauchen Sie Hilfe?"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:115 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:132
msgid "Contact us" msgid "Contact us"
msgstr "Kontaktiere uns" msgstr "Kontaktiere uns"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:120 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:137
msgid "prioritizes all Recent uploads." msgid "prioritizes all Recent uploads."
msgstr "reiht die neuesten Uploads vor." msgstr "reiht die neuesten Uploads vor."
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:123 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:140
msgid "We can help with:" msgid "We can help with:"
msgstr "Dabei können wir helfen:" msgstr "Dabei können wir helfen:"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:128 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:145
msgid "Uploading your research data, software, preprints, etc." msgid "Uploading your research data, software, preprints, etc."
msgstr "Hochladen Ihrer Forschungsdaten, Software, Preprints usw." msgstr "Hochladen Ihrer Forschungsdaten, Software, Preprints usw."
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:129 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:146
msgid "One-on-one with" msgid "One-on-one with"
msgstr "One-on-one mit" msgstr "One-on-one mit"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:129 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:146
msgid "supporters." msgid "supporters."
msgstr "Unterstützern" msgstr "Unterstützern"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:130 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:147
msgid "Quota increases beyond our default policy." msgid "Quota increases beyond our default policy."
msgstr "Quota Erhöhungen über unsere Standard Policy hinaus." msgstr "Quota Erhöhungen über unsere Standard Policy hinaus."
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:131 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:148
msgid "Scripts for automated uploading of larger datasets." msgid "Scripts for automated uploading of larger datasets."
msgstr "Skripte zum automatisierten Hochladen größerer Datensätze." msgstr "Skripte zum automatisierten Hochladen größerer Datensätze."
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:136 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:153
msgid "Why use" msgid "Why use"
msgstr "Warum" msgstr "Warum"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:12 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:66
msgid "All"
msgstr "Alle"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:17
msgid "Publications"
msgstr "Publikationen"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:22
msgid "Open Educational Resources"
msgstr "Open Educational Resources"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:76
msgid "REPOSITORY" msgid "REPOSITORY"
msgstr "Repository" msgstr "Repository"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:78 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:68
msgid "LIBRARY & ARCHIVES" msgid "LIBRARY & ARCHIVES"
msgstr "Bibliothek und Archiv" msgstr "Bibliothek und Archiv"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:88 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:78
msgid "SCIENCE" msgid "SCIENCE"
msgstr "WISSEN" msgstr "WISSEN"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:89 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:79
msgid "PASSION" msgid "PASSION"
msgstr "TECHNIK" msgstr "TECHNIK"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:90 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:80
msgid "TECHNOLOGY" msgid "TECHNOLOGY"
msgstr "LEIDENSCHAFT" msgstr "LEIDENSCHAFT"
@@ -402,7 +389,8 @@ msgid ""
"Uploads get a Digital Object Identifier (DOI) to make them easily and " "Uploads get a Digital Object Identifier (DOI) to make them easily and "
"uniquely citeable." "uniquely citeable."
msgstr "" msgstr ""
"Uploads erhalten eine DOI und werden damit leichtauffindbar und zitierfähig." "Uploads erhalten eine DOI und werden damit leichtauffindbar und "
"zitierfähig."
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/accounts/register_user.html:28 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/accounts/register_user.html:28
msgid "Communities." msgid "Communities."
@@ -410,8 +398,8 @@ msgstr "Communities"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/accounts/register_user.html:30 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/accounts/register_user.html:30
msgid "" msgid ""
"Accept or reject uploads to your own community (e.g workshops, EU projects, " "Accept or reject uploads to your own community (e.g workshops, EU "
"institutions or entire disciplines)." "projects, institutions or entire disciplines)."
msgstr "" msgstr ""
"Annehmen oder Ablehnen von Uploads in Ihrer eigenen Community (z.B. " "Annehmen oder Ablehnen von Uploads in Ihrer eigenen Community (z.B. "
"workshop, EU-Projekt, Forschungseinrichtung, Disziplin)" "workshop, EU-Projekt, Forschungseinrichtung, Disziplin)"
@@ -422,8 +410,8 @@ msgstr "Vertrauenswürdiges Forschungsdatenmanagement"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/accounts/register_user.html:34 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/accounts/register_user.html:34
msgid "" msgid ""
"Built on top of TU Graz expertise in managing of the research data from the " "Built on top of TU Graz expertise in managing of the research data from "
"Graz University of Technology." "the Graz University of Technology."
msgstr "Gebaut basierend auf Expertise derTU Graz im Bereich Data Management" msgstr "Gebaut basierend auf Expertise derTU Graz im Bereich Data Management"
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/accounts/register_user.html:48 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/accounts/register_user.html:48
@@ -434,12 +422,6 @@ msgstr "Mit Ihrem TUGonline-Account registrieren"
msgid "Sign up with repository credentials" msgid "Sign up with repository credentials"
msgstr "Mit Ihren Repository Daten registrieren" msgstr "Mit Ihren Repository Daten registrieren"
#~ msgid "My dashboard"
#~ msgstr "Meine Übersicht"
#~ msgid "Type and press enter to search"
#~ msgstr "Suchbegriff eingeben und “Enter” drücken (?)"
#~ msgid "Version" #~ msgid "Version"
#~ msgstr "Version" #~ msgstr "Version"
@@ -458,6 +440,17 @@ msgstr "Mit Ihren Repository Daten registrieren"
#~ msgid "DOI" #~ msgid "DOI"
#~ msgstr "DOI" #~ msgstr "DOI"
#~ msgid "Open Access"
#~ msgstr ""
#~ msgid "No minted DOI"
#~ msgstr ""
#~ msgid ""
#~ "Enabled by\n"
#~ " <a href=\"%(fair_data)s\" target=\"_blank\">"
#~ msgstr ""
#~ msgid "Uploads" #~ msgid "Uploads"
#~ msgstr "Hochladen" #~ msgstr "Hochladen"
@@ -475,15 +468,17 @@ msgstr "Mit Ihren Repository Daten registrieren"
#~ msgid "" #~ msgid ""
#~ "\n" #~ "\n"
#~ " There is a %(link_start)snewer version%(link_end)s of the " #~ " There is a %(link_start)snewer "
#~ "record available.\n" #~ "version%(link_end)s of the record available."
#~ "\n"
#~ " " #~ " "
#~ msgstr "" #~ msgstr ""
#~ "Es ist eine %(link_start)sneuere Version%(link_end)s des Eintrags " #~ "Es ist eine %(link_start)sneuere "
#~ "verfügbar." #~ "Version%(link_end)s des Eintrags verfügbar."
#~ msgid "Files" #~ msgid "Files"
#~ msgstr "Dateien" #~ msgstr "Dateien"
#~ msgid "Reason" #~ msgid "Reason"
#~ msgstr "Grund" #~ msgstr "Grund"

View File

@@ -1,28 +1,27 @@
# Translations template for invenio-theme-tugraz. # Translations template for invenio-theme-tugraz.
# Copyright (C) 2022 Graz University of Technology # Copyright (C) 2021 Graz University of Technology
# This file is distributed under the same license as the # This file is distributed under the same license as the
# invenio-theme-tugraz project. # invenio-theme-tugraz project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022. # FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
# #
#, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: invenio-theme-tugraz 4.0.0\n" "Project-Id-Version: invenio-theme-tugraz 3.6.1\n"
"Report-Msgid-Bugs-To: mojib.wali@tugraz.at\n" "Report-Msgid-Bugs-To: mojib.wali@tugraz.at\n"
"POT-Creation-Date: 2022-08-05 10:15+0200\n" "POT-Creation-Date: 2021-11-02 15:12+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.3\n" "Generated-By: Babel 2.9.0\n"
#: invenio_theme_tugraz/config.py:13 invenio_theme_tugraz/config.py:60 #: invenio_theme_tugraz/config.py:13 invenio_theme_tugraz/config.py:62
msgid "TU Graz Repository" msgid "TU Graz Repository"
msgstr "" msgstr ""
#: invenio_theme_tugraz/config.py:63 #: invenio_theme_tugraz/config.py:65
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html:30 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/footer.html:30
msgid "Repository" msgid "Repository"
msgstr "" msgstr ""
@@ -224,27 +223,31 @@ msgstr ""
msgid "This is the test instance of the TU Graz Repository." msgid "This is the test instance of the TU Graz Repository."
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html:40 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/header.html:39
msgid "Home" msgid "Home"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:26 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:27
msgid "Type and press enter to search"
msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:43
msgid "Recent uploads" msgid "Recent uploads"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:30 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:47
msgid "There are no public records to show." msgid "There are no public records to show."
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:44 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:61
msgid "Publication date" msgid "Publication date"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:49 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:66
msgid "Resource type" msgid "Resource type"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:87 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:104
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
@@ -252,79 +255,67 @@ msgid ""
" " " "
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:101 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:118
msgid "More" msgid "More"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:111 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:128
msgid "Need help?" msgid "Need help?"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:115 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:132
msgid "Contact us" msgid "Contact us"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:120 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:137
msgid "prioritizes all Recent uploads." msgid "prioritizes all Recent uploads."
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:123 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:140
msgid "We can help with:" msgid "We can help with:"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:128 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:145
msgid "Uploading your research data, software, preprints, etc." msgid "Uploading your research data, software, preprints, etc."
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:129 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:146
msgid "One-on-one with" msgid "One-on-one with"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:129 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:146
msgid "supporters." msgid "supporters."
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:130 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:147
msgid "Quota increases beyond our default policy." msgid "Quota increases beyond our default policy."
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:131 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:148
msgid "Scripts for automated uploading of larger datasets." msgid "Scripts for automated uploading of larger datasets."
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:136 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/index.html:153
msgid "Why use" msgid "Why use"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:12 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:66
msgid "All"
msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:17
msgid "Publications"
msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:22
msgid "Open Educational Resources"
msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:76
msgid "REPOSITORY" msgid "REPOSITORY"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:78 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:68
msgid "LIBRARY & ARCHIVES" msgid "LIBRARY & ARCHIVES"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:88 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:78
msgid "SCIENCE" msgid "SCIENCE"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:89 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:79
msgid "PASSION" msgid "PASSION"
msgstr "" msgstr ""
#: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:90 #: invenio_theme_tugraz/templates/invenio_theme_tugraz/navbar.html:80
msgid "TECHNOLOGY" msgid "TECHNOLOGY"
msgstr "" msgstr ""

View File

@@ -0,0 +1,15 @@
# -*- 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.1.dev2"

View File

@@ -8,6 +8,8 @@
"""invenio module for TUGRAZ theme.""" """invenio module for TUGRAZ theme."""
import binascii
from os import environ
from typing import Dict from typing import Dict
from elasticsearch_dsl.utils import AttrDict from elasticsearch_dsl.utils import AttrDict
@@ -16,6 +18,11 @@ from invenio_rdm_records.resources.serializers import UIJSONSerializer
from .search import FrontpageRecordsSearch from .search import FrontpageRecordsSearch
def ui_blueprint(app):
"""Blueprint for the routes and resources provided by Invenio-theme-tugraz."""
routes = app.config.get("TUG_ROUTES")
blueprint = Blueprint( blueprint = Blueprint(
"invenio_theme_tugraz", "invenio_theme_tugraz",
__name__, __name__,
@@ -23,6 +30,8 @@ blueprint = Blueprint(
static_folder="static", 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") @blueprint.app_template_filter("make_dict_like")
def make_dict_like(value: str, key: str) -> Dict[str, str]: def make_dict_like(value: str, key: str) -> Dict[str, str]:
@@ -32,20 +41,11 @@ def make_dict_like(value: str, key: str) -> Dict[str, str]:
""" """
return {key: value} return {key: value}
@blueprint.app_template_filter("cast_to_dict") @blueprint.app_template_filter("cast_to_dict")
def cast_to_dict(attr_dict): def cast_to_dict(attr_dict):
"""Return the dict structure of AttrDict variable.""" """Return the dict structure of AttrDict variable."""
return AttrDict.to_dict(attr_dict) 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.add_url_rule(routes["index"], view_func=index)
blueprint.add_url_rule(routes["comingsoon"], view_func=comingsoon)
return blueprint return blueprint
@@ -53,7 +53,7 @@ def records_serializer(records=None):
"""Serialize list of records.""" """Serialize list of records."""
record_list = [] record_list = []
for record in records: for record in records:
record_list.append(UIJSONSerializer().dump_obj(record.to_dict())) record_list.append(UIJSONSerializer().serialize_object_to_dict(record.to_dict()))
return record_list return record_list
@@ -62,7 +62,8 @@ def index():
records = FrontpageRecordsSearch()[:5].sort("-created").execute() records = FrontpageRecordsSearch()[:5].sort("-created").execute()
return render_template( return render_template(
"invenio_theme_tugraz/index.html", records=records_serializer(records) "invenio_theme_tugraz/index.html",
records=records_serializer(records)
) )

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (C) 2020 TUGRAZ. # Copyright (C) 2022 TUGRAZ.
# #
# invenio-theme-tugraz is free software. # invenio-theme-tugraz is free software.
@@ -17,6 +17,7 @@ theme = WebpackThemeBundle(
entry={ entry={
"invenio-theme-tugraz-theme": "./less/invenio_theme_tugraz/theme.less", "invenio-theme-tugraz-theme": "./less/invenio_theme_tugraz/theme.less",
"invenio-theme-tugraz-js": "./js/invenio_theme_tugraz/theme.js", "invenio-theme-tugraz-js": "./js/invenio_theme_tugraz/theme.js",
"invenio-theme-tugraz-rdm-deposit": "./js/invenio_theme_tugraz/deposit/index.js",
}, },
dependencies={ dependencies={
# add any additional npm dependencies here... # add any additional npm dependencies here...

View File

@@ -1,3 +0,0 @@
[build-system]
requires = ["setuptools", "wheel", "babel>2.8"]
build-backend = "setuptools.build_meta"

12
pytest.ini Normal file
View File

@@ -0,0 +1,12 @@
# -*- 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

View File

@@ -16,8 +16,17 @@ set -o errexit
# Quit on unbound symbols # Quit on unbound symbols
set -o nounset 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 check_manifest --ignore ".*-requirements.txt"
python -m sphinx.cmd.build -qnN docs docs/_build/html 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 python -m pytest
tests_exit_code=$? tests_exit_code=$?
python -m sphinx.cmd.build -qnN -b doctest docs docs/_build/doctest python -m sphinx.cmd.build -qnN -b doctest docs docs/_build/doctest

View File

@@ -6,63 +6,6 @@
# modify it under the terms of the MIT License; see LICENSE file for more # modify it under the terms of the MIT License; see LICENSE file for more
# details. # 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] [aliases]
test = pytest test = pytest
@@ -79,7 +22,6 @@ add_ignore = D401
[compile_catalog] [compile_catalog]
directory = invenio_theme_tugraz/translations/ directory = invenio_theme_tugraz/translations/
use-fuzzy = True
[extract_messages] [extract_messages]
copyright_holder = Graz University of Technology copyright_holder = Graz University of Technology
@@ -95,10 +37,20 @@ output-dir = invenio_theme_tugraz/translations/
[update_catalog] [update_catalog]
input-file = invenio_theme_tugraz/translations/messages.pot input-file = invenio_theme_tugraz/translations/messages.pot
output-dir = invenio_theme_tugraz/translations/ output-dir = invenio_theme_tugraz/translations/
[isort]
profile=black
[tool:pytest] [flake8]
addopts = --black --isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_theme_tugraz --cov-report=term-missing tests invenio_theme_tugraz max-line-length = 88
testpaths = tests invenio_theme_tugraz extend-ignore = E203
live_server_scope = module 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
[pycodestyle]
ignore = E203,E501

114
setup.py
View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright (C) 2020-2022 Graz University of Technology. # Copyright (C) 2020-2021 Graz University of Technology.
# #
# invenio-theme-tugraz is free software; you can redistribute it and/or # 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 # modify it under the terms of the MIT License; see LICENSE file for more
@@ -8,6 +8,114 @@
"""invenio module for TUGRAZ theme.""" """invenio module for TUGRAZ theme."""
from setuptools import setup import os
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",
"invenio-app-rdm>=7.0.1,<8.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",
],
)

View File

@@ -12,21 +12,62 @@ See https://pytest-invenio.readthedocs.io/ for documentation on which test
fixtures are available. fixtures are available.
""" """
import os
import shutil
import tempfile
import pytest import pytest
from flask import Flask from flask import Flask
from flask_babelex import Babel
from invenio_db import InvenioDB, db
from invenio_i18n import InvenioI18N 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 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() @pytest.fixture()
def app(request): def app(request):
"""Basic Flask application.""" """Basic Flask application."""
instance_path = tempfile.mkdtemp()
app = Flask("testapp") app = Flask("testapp")
DB = os.getenv("SQLALCHEMY_DATABASE_URI", "sqlite://")
app.config.update( app.config.update(
I18N_LANGUAGES=[("en", "English"), ("de", "German")], I18N_LANGUAGES=[("en", "English"), ("de", "German")],
SQLALCHEMY_DATABASE_URI=DB,
SQLALCHEMY_TRACK_MODIFICATIONS=False,
) )
Babel(app)
InvenioDB(app)
InvenioSearch(app)
InvenioThemeTugraz(app) InvenioThemeTugraz(app)
InvenioI18N(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 return app

View File

@@ -35,4 +35,4 @@ def test_init():
def test_app(app): def test_app(app):
"""Test extension initialization.""" """Test extension initialization."""
_ = InvenioThemeTugraz(app) theme = InvenioThemeTugraz(app)

22
tests/ui/conftest.py Normal file
View File

@@ -0,0 +1,22 @@
# -*- 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

33
tests/ui/test_views.py Normal file
View File

@@ -0,0 +1,33 @@
# # -*- 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