Skip to content

Commit

Permalink
Merge branch 'release/2023-03-07_author_rights_facet'
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven-Eardley committed Mar 7, 2023
2 parents 9397946 + ac850e8 commit 9317a86
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 7 deletions.
32 changes: 32 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,32 @@
version: 2.1
orbs:
python: circleci/python@2.1.1

jobs:
build-and-test:
docker:
- image: cimg/python:3.8.10
environment:
DOAJENV: test
- image: elasticsearch:7.10.1
environment:
- xpack.security.enabled: false
- transport.host: localhost
- discovery.type: single-node
steps:
- checkout
- run: git submodule update --init --recursive
- python/install-packages:
pkg-manager: pip-dist
pip-dependency-file: setup.py
path-args: .[test]
- run: |
echo "ELASTICSEARCH_HOSTS = [{'host': 'localhost', 'port': 9200}]" > test.cfg
python portality/cms/build_fragments.py
python portality/cms/build_sass.py
pytest -v --color=yes --code-highlight=yes --log-level=DEBUG doajtest/unit
workflows:
unit_tests:
jobs:
- build-and-test
2 changes: 1 addition & 1 deletion .python-version
@@ -1 +1 @@
3.7
3.8.10
7 changes: 7 additions & 0 deletions doajtest/testbook/public_site/public_search.yml
Expand Up @@ -14,6 +14,13 @@ tests:
results:
- The number of journals on the page increases and decreases and the number of
pages changes
- step: Choose filters on the left (one or more at the time)
results:
- Search results adjust accordingly
- The number of search results changes. You can still select values from other
facets and filters
- The filters you have selected appear as black lozenges at the top of the search
results
- step: Open and Collapse all the facets on the left
results:
- The facet opens and closes as expected
Expand Down
4 changes: 2 additions & 2 deletions portality/settings.py
Expand Up @@ -9,7 +9,7 @@
# Application Version information
# ~~->API:Feature~~

DOAJ_VERSION = "6.2.18"
DOAJ_VERSION = "6.2.19"
API_VERSION = "3.0.1"

######################################
Expand Down Expand Up @@ -1371,4 +1371,4 @@
## Public data dump settings

# how long should the temporary URL for public data dumps last
PUBLIC_DATA_DUMP_URL_TIMEOUT = 3600
PUBLIC_DATA_DUMP_URL_TIMEOUT = 3600
27 changes: 26 additions & 1 deletion portality/static/js/doaj.fieldrender.edges.js
Expand Up @@ -2320,7 +2320,20 @@ $.extend(true, doaj, {

var value = false;
if (ft === "terms" || ft === "term") {
value = el.attr("data-value");
val = el.attr("data-value");
// translate string value to a type required by a model
if (val === "true"){
value = true;
}
else if (val === "false"){
value = false;
}
else if (!isNaN(parseInt(val))){
value = parseInt(val);
}
else {
value = val;
}
} else if (ft === "range") {
value = {};

Expand Down Expand Up @@ -2602,6 +2615,15 @@ $.extend(true, doaj, {
}
apcs += '</li>';

var rights = "";
if (resultobj.bibjson.copyright) {
var copyright_url = resultobj.bibjson.copyright.url;
rights += '<a href="' + copyright_url + '" target="_blank" rel="noopener">';
rights += resultobj.bibjson.copyright.author_retains ? 'Author <strong> retains </strong> all rights' : 'Author <strong> doesn\'t retain </strong> all rights';
rights += '</a>';
}


var licenses = "";
if (resultobj.bibjson.license && resultobj.bibjson.license.length > 0) {
var terms_url = resultobj.bibjson.ref.license_terms;
Expand Down Expand Up @@ -2704,6 +2726,9 @@ $.extend(true, doaj, {
<li>\
' + apcs + '\
</li>\
<li>\
' + rights + '\
</li>\
<li>\
' + licenses + '\
</li>\
Expand Down
14 changes: 13 additions & 1 deletion portality/static/js/edges/public.journal.edge.js
Expand Up @@ -98,6 +98,16 @@ $.extend(true, doaj, {
value: false
})
]
},
{
id : "retains_copyrigths",
display: "Author retains all rights",
must : [
es.newTermFilter({
field: "bibjson.copyright.author_retains",
value: true
})
]
}
],
renderer : doaj.renderers.newFacetFilterSetterRenderer({
Expand Down Expand Up @@ -288,6 +298,7 @@ $.extend(true, doaj, {
"index.country.exact" : "Publishers' countries",
"index.language.exact" : "Languages",
"bibjson.editorial.review_process.exact" : "Peer review",
"bibjson.copyright.author_retains" : "Author retains all rights",
"created_date" : "Date added"
},
rangeFunctions : {
Expand All @@ -298,7 +309,8 @@ $.extend(true, doaj, {
},
renderer : doaj.renderers.newSelectedFiltersRenderer({
hideValues : [
"index.has_seal.exact"
"index.has_seal.exact",
"bibjson.copyright.author_retains"
],
omit : [
"bibjson.apc.has_apc",
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Expand Up @@ -5,7 +5,7 @@

setup(
name='doaj',
version='6.2.18',
version='6.2.19',
packages=find_packages(),
install_requires=[
"awscli==1.20.50",
Expand Down Expand Up @@ -55,7 +55,7 @@
"flask-swagger @ git+https://github.com/DOAJ/flask-swagger.git@f1dbf918d9903a588eed3cce2a87eeccc9f8cc0e#egg=flask-swagger"
] + (["setproctitle==1.1.10"] if "linux" in sys.platform else []),
extras_require={
"test": ["pytest", "pytest-cov", "pytest-xdist", "selenium",
"test": ["pytest", "pytest-cov", "pytest-xdist", "selenium==3.141", # prevent backtracking through all versions
"combinatrix @ git+https://github.com/CottageLabs/combinatrix.git@740d255f0050d53a20324df41c08981499bb292c#egg=combinatrix"],
"docs": [
"featuremap @ git+https://github.com/CottageLabs/FeatureMap.git@cb52c345b942e50726767b1a7190f1a01b81e722#egg=featuremap",
Expand Down

0 comments on commit 9317a86

Please sign in to comment.