mirror of
https://github.com/Cian-H/invenio-theme-iform.git
synced 2026-03-23 21:42:44 +00:00
Merge pull request #55 from mb-wali/recent_uploads
Frontpage *recent_uploads
This commit is contained in:
17
.tx/config
17
.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 <lang>
|
||||
# $ 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 <lang>
|
||||
# 6) Pull translations for all languages from Transifex
|
||||
# $ tx pull -a
|
||||
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2020 TUGRAZ.
|
||||
* Copyright (C) 2020 mojib wali.
|
||||
*
|
||||
* invenio-theme-tugraz is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the MIT License; see LICENSE file for more details.
|
||||
*/
|
||||
|
||||
h4{
|
||||
display: block;
|
||||
margin-block-start: 0.33em;
|
||||
margin-block-end: 0.33em;
|
||||
margin-inline-start: 0px;
|
||||
margin-inline-end: 0px;
|
||||
}
|
||||
|
||||
h2{
|
||||
margin-block-start: 0.83em;
|
||||
margin-block-end: 0.83em;
|
||||
margin-inline-start: 0px;
|
||||
margin-inline-end: 0px;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -9,6 +9,8 @@
|
||||
@import "header";
|
||||
@import "footer";
|
||||
@import "overrides";
|
||||
@import "frontpage";
|
||||
@import "macros";
|
||||
@import (css)
|
||||
url("https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap");
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ INVENIO_THEME_TUGRAZ_ICON = 'images/icon_use.png'
|
||||
THEME_LOGO = 'images/tug_logo.png'
|
||||
"""TU Graz logo"""
|
||||
|
||||
THEME_SEARCHBAR = False
|
||||
"""Enable or disable the header search bar."""
|
||||
|
||||
THEME_HEADER_TEMPLATE = 'invenio_theme_tugraz/header.html'
|
||||
"""TU Graz header template"""
|
||||
|
||||
@@ -43,7 +46,7 @@ THEME_FOOTER_TEMPLATE = 'invenio_theme_tugraz/footer.html'
|
||||
THEME_FRONTPAGE_TITLE = _('Frontpage Title')
|
||||
"""Frontpage title."""
|
||||
|
||||
THEME_SITENAME = _('Application Name')
|
||||
THEME_SITENAME = _('Repository')
|
||||
"""Site name."""
|
||||
|
||||
# Invenio-accounts
|
||||
|
||||
30
invenio_theme_tugraz/search.py
Normal file
30
invenio_theme_tugraz/search.py
Normal file
@@ -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 '
|
||||
)
|
||||
)
|
||||
BIN
invenio_theme_tugraz/static/extra/orcid.png
Normal file
BIN
invenio_theme_tugraz/static/extra/orcid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 566 B |
@@ -0,0 +1,10 @@
|
||||
|
||||
<ul>
|
||||
<li><strong>{{_('Safe')}}</strong> — {{_('your research is stored safely for the future in CERN’s Data Centre for as long as CERN exists.')}}</li>
|
||||
<li><strong>{{_('Trusted')}}</strong> — {{_('built and operated by CERN and OpenAIRE to ensure that everyone can join in Open Science.')}}</li>
|
||||
<li><strong>{{_('Citeable')}}</strong> — {{_('every upload is assigned a Digital Object Identifier (DOI), to make them citable and trackable.')}}</li>
|
||||
<li><strong>{{_('No waiting time')}}</strong> — {{_('Uploads are made available online as soon as you hit publish, and your DOI is registered within seconds.')}}</li>
|
||||
<li><strong>{{_('Open or closed')}}</strong> — {{_('Share e.g. anonymized clinical trial data with only medical professionals via our restricted access mode.')}}</li>
|
||||
<li><strong>{{_('Versioning')}}</strong> — {{_("Easily update your dataset with our versioning feature.")}}</li>
|
||||
<li><strong>{{_('Usage statisics')}}</strong> — {{_("All uploads display standards compliant usage statistics")}}</li>
|
||||
</ul>
|
||||
@@ -9,122 +9,126 @@
|
||||
|
||||
{%- extends config.INVENIO_THEME_TUGRAZ_BASE_TEMPLATE %}
|
||||
|
||||
{%- from "invenio_theme_tugraz/macros/authors.html" import creators -%}
|
||||
|
||||
|
||||
{%- block page_body %}
|
||||
|
||||
|
||||
{%- block frontpage_search %}
|
||||
|
||||
{%- block frontpage_form %}
|
||||
<div class="ui center aligned grid">
|
||||
<div class="eight wide column">
|
||||
<form action="/search" class="ui form">
|
||||
<div class="ui fluid big action input">
|
||||
<input type="text" name="q" class="form-control" placeholder="{{ _("Type and press enter to search") }}">
|
||||
<button type="submit" class="ui icon search button"><i class="search icon"></i></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui divider hidden"></div>
|
||||
{%- endblock frontpage_form %}
|
||||
|
||||
{%- endblock frontpage_search %}
|
||||
|
||||
<div class="ui container">
|
||||
|
||||
{{_('Welcome to %(module_name)s', module_name=module_name)}}
|
||||
|
||||
<h2 class="ui center aligned icon header">
|
||||
<i class="list icon"></i>
|
||||
Features
|
||||
</h2>
|
||||
<div class="ui stackable grid">
|
||||
|
||||
<div style="margin-bottom: 30px;"></div>
|
||||
<!---Recent uploads-->
|
||||
<div class="ten wide column">
|
||||
<h2>{{_('Recent uploads')}}</h2>
|
||||
|
||||
{%- for r in records %}
|
||||
{%- set creation_date = r._created|from_isodatetime -%}
|
||||
{%- set record_url = url_for('invenio_records_ui.recid', pid_value=r['recid']) %}
|
||||
|
||||
<!--btn view-->
|
||||
<a href="{{ record_url }}" class="ui right floated button">{{_('View')}}</a>
|
||||
<!--TODO:
|
||||
something with doi
|
||||
-->
|
||||
<div class="left floated left aligned column">
|
||||
|
||||
<!--Publication date badge-->
|
||||
<span class="ui label teal" title="{{_('Publication date')}}">{{ r.publication_date }}
|
||||
</span>
|
||||
|
||||
<!--Version badge-->
|
||||
<span class="label record-version" title="{{_('Version')}}">
|
||||
{{ (' | ' ~ r.version ~ '') if r.version else ' | Version' }}</span>
|
||||
|
||||
<!--Resource type badge-->
|
||||
<span class="ui label grey" title="{{_('Resource type')}}">{{r.resource_type.type}}</span>
|
||||
<span class="label record-version">
|
||||
<!--TODO: add subtype---></span>
|
||||
|
||||
<!--Access right badge-->
|
||||
<span class="ui label green">{{_('Open Access')}}</span>
|
||||
|
||||
<div class="ui two column divided grid">
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<h3>Research-Data</h3>
|
||||
<p>
|
||||
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
|
||||
</p>
|
||||
</div>
|
||||
<div class="column">
|
||||
<h3>Open educational resources (OER) </h3>
|
||||
<p>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.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<h3>Thesis</h3>
|
||||
<p>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.</p>
|
||||
</div>
|
||||
<div class="column">
|
||||
<h3>Publications</h3>
|
||||
<p>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.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 30px;"></div>
|
||||
|
||||
|
||||
<div class="ui divider"></div>
|
||||
|
||||
|
||||
<h2 class="ui center aligned icon header">
|
||||
<i class="chart line icon"></i>
|
||||
Statistic
|
||||
</h2>
|
||||
|
||||
|
||||
<div style="margin-bottom: 50px;"></div>
|
||||
|
||||
<div class="ui two statistics">
|
||||
<div class="statistic">
|
||||
<div class="value">
|
||||
<i class="file alternate card icon"></i> 15000
|
||||
</div>
|
||||
<div class="label">
|
||||
Recorda
|
||||
|
||||
<h4><a href="{{ record_url }}">{{r.titles[0].title}}</a></h4>
|
||||
|
||||
<p>{{ creators(r.creators) }}</p>
|
||||
|
||||
<p class="hidden-xs"><a href="{{record_url}}">{{ r.descriptions[0].description|striptags|truncate(300) }}</a></p>
|
||||
|
||||
<small>{% trans user=userprofile, date=creation_date|dateformat('long') %}Uploaded on
|
||||
{{date}}{% endtrans %}</small>
|
||||
|
||||
<!----TODO: more versions
|
||||
-->
|
||||
|
||||
{%- if not loop.last %}
|
||||
<div class="ui divider"></div>
|
||||
{%- else%}
|
||||
<div class="ui center aligned grid">
|
||||
<div class="eight wide column">
|
||||
<a href="{{url_for('invenio_search_ui.search')}}" class="ui right floated button">{{_('More')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="statistic">
|
||||
<div class="value">
|
||||
<i class="users icon"></i> 30
|
||||
</div>
|
||||
<div class="label">
|
||||
Communities
|
||||
</div>
|
||||
</div>
|
||||
<!---segments-->
|
||||
<div class="six wide column">
|
||||
|
||||
<div class="statistic">
|
||||
<div class="value">
|
||||
<i class="user icon"></i> 500
|
||||
</div>
|
||||
<div class="label">
|
||||
Users
|
||||
</div>
|
||||
</div>
|
||||
<!--contact us-->
|
||||
<div class="ui segment" style="padding-bottom: 10px;">
|
||||
<h4>Need help?</h4>
|
||||
<div style="padding-bottom: 10px;">
|
||||
<a href="{{ url_for('invenio_theme_tugraz.index')}}" class="fluid ui button">Contact us</a>
|
||||
</div>
|
||||
<p>{{config.THEME_SITENAME}} prioritizes all requested related to the COVID-19 outbreak.</p>
|
||||
<p>We can help with:</p>
|
||||
|
||||
<div class="statistic">
|
||||
<div class="value">
|
||||
<i class="address card icon"></i> 50
|
||||
</div>
|
||||
<div class="label">
|
||||
Members
|
||||
</div>
|
||||
</div>
|
||||
<ul>
|
||||
<li>Uploading your research data, software, preprints, etc.</li>
|
||||
<li>One-on-one with {{config.THEME_SITENAME}} supporters.</li>
|
||||
<li>Quota increases beyond our default policy.</li>
|
||||
<li>Scripts for automated uploading of larger datasets.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="ui segment" style="padding-bottom: 10px;">
|
||||
<h4>Why use {{config.THEME_SITENAME}}?</h4>
|
||||
{% include "invenio_theme_tugraz/benefits.html" %}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div style="margin-bottom: 50px;"></div>
|
||||
|
||||
<div style="padding-bottom: 10px;"></div>
|
||||
|
||||
</div>
|
||||
{%- endblock %}
|
||||
|
||||
|
||||
{%- endblock %}
|
||||
@@ -0,0 +1,31 @@
|
||||
{#
|
||||
Copyright (C) 2020 Zenodo
|
||||
Copyright (C) 2020 TUGRAZ
|
||||
Copyright (C) 2020 mojib wali.
|
||||
|
||||
invenio-theme-tugraz is free software; you can redistribute it and/or
|
||||
modify it under the terms of the MIT License; see LICENSE file for more
|
||||
details.
|
||||
#}
|
||||
|
||||
{%- macro creators (authors_list) %}
|
||||
|
||||
{%- for creators in authors_list %}
|
||||
|
||||
{%- if creators.identifiers.Orcid %}
|
||||
<a href="{{creators.identifiers.Orcid|pid_url('orcid')}}"><img class="inline-orcid" src="{{ url_for('static', filename='extra/orcid.png')}}" /></a>
|
||||
{%- endif %}
|
||||
|
||||
<span class="text-muted" {% if creators.affiliations %} {% for affiliation in creators.affiliations %} data-toggle="tooltip" title="{{affiliation.name}}" {%- endfor %} {% endif %}>{{creators.name}}</span>
|
||||
{% if not loop.last %}; {% endif %}
|
||||
|
||||
{%- endfor %}
|
||||
{%- endmacro %}
|
||||
|
||||
<!--TODO: contributers-->
|
||||
{%- macro contributors(contributors_list) %}
|
||||
{%- for group in contributors_list|groupby('type')%}
|
||||
<h5>{{group.grouper|contributortype_title}}(s)</h5>
|
||||
{{authors(group.list)}}
|
||||
{%- endfor %}
|
||||
{%- endmacro %}
|
||||
@@ -8,12 +8,11 @@
|
||||
|
||||
"""invenio module for TUGRAZ theme."""
|
||||
|
||||
# TODO: This is an example file. Remove it if you do not need it, including
|
||||
# the templates and static folders as well as the test case.
|
||||
|
||||
from flask import Blueprint, render_template
|
||||
from flask_babelex import gettext as _
|
||||
|
||||
from .search import FrontpageRecordsSearch
|
||||
|
||||
blueprint = Blueprint(
|
||||
'invenio_theme_tugraz',
|
||||
__name__,
|
||||
@@ -24,7 +23,7 @@ blueprint = Blueprint(
|
||||
|
||||
@blueprint.route("/")
|
||||
def index():
|
||||
"""Render a basic view."""
|
||||
"""Render frontpage view."""
|
||||
return render_template(
|
||||
"invenio_theme_tugraz/index.html",
|
||||
module_name=_('invenio-theme-tugraz'))
|
||||
records=FrontpageRecordsSearch()[:5].sort('-_created').execute(),)
|
||||
|
||||
@@ -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
|
||||
|
||||
34
setup.py
34
setup.py
@@ -16,19 +16,22 @@ readme = open('README.rst').read()
|
||||
history = open('CHANGES.rst').read()
|
||||
|
||||
tests_require = [
|
||||
'check-manifest>=0.25',
|
||||
'coverage>=4.0',
|
||||
'isort>=4.3.3, <5.0.0',
|
||||
'pydocstyle>=2.0.0',
|
||||
'pytest-cov>=2.5.1',
|
||||
'pytest-pep8>=1.0.6',
|
||||
'pytest-invenio>=1.2.1',
|
||||
'pytest-invenio>=1.3.2',
|
||||
]
|
||||
|
||||
extras_require = {
|
||||
'docs': [
|
||||
'Sphinx>=1.5.1',
|
||||
],
|
||||
'mysql': [
|
||||
'invenio-db[mysql]>=1.0.0',
|
||||
],
|
||||
'postgresql': [
|
||||
'invenio-db[postgresql]>=1.0.0',
|
||||
],
|
||||
'sqlite': [
|
||||
'invenio-db>=1.0.0',
|
||||
],
|
||||
'tests': tests_require,
|
||||
}
|
||||
|
||||
@@ -46,6 +49,9 @@ install_requires = [
|
||||
'Flask-WebpackExt>=1.0.0',
|
||||
'invenio-assets>=1.2.0,<1.3.0',
|
||||
'invenio-i18n>=1.2.0',
|
||||
'elasticsearch_dsl>=7.2.1',
|
||||
'invenio_search>=1.3.1',
|
||||
|
||||
]
|
||||
|
||||
packages = find_packages()
|
||||
@@ -87,18 +93,6 @@ setup(
|
||||
'invenio_config.module': [
|
||||
'invenio_theme_tugraz = invenio_theme_tugraz.config',
|
||||
],
|
||||
|
||||
# TODO: Edit these entry points to fit your needs.
|
||||
# 'invenio_access.actions': [],
|
||||
# 'invenio_admin.actions': [],
|
||||
# 'invenio_assets.bundles': [],
|
||||
# 'invenio_base.api_apps': [],
|
||||
# 'invenio_base.api_blueprints': [],
|
||||
# 'invenio_base.blueprints': [],
|
||||
# 'invenio_celery.tasks': [],
|
||||
# 'invenio_db.models': [],
|
||||
# 'invenio_pidstore.minters': [],
|
||||
# 'invenio_records.jsonresolver': [],
|
||||
},
|
||||
extras_require=extras_require,
|
||||
install_requires=install_requires,
|
||||
@@ -116,6 +110,6 @@ setup(
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Development Status :: 1 - Planning',
|
||||
'Development Status :: 3 - Alpha',
|
||||
],
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user