Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

37 changes: 30 additions & 7 deletions cms/sass/components/_input-group.scss
Original file line number Diff line number Diff line change
@@ -1,31 +1,54 @@
/* Input groups */

.input-group {
width: 100%;
margin: 0 0 1rem 0;
position: relative;
display: flex;
flex-direction: row;
border-collapse: separate;
width: 100%;
align-items: stretch;
flex-wrap: wrap;

input, select, .select2-container {
flex: 1 1 0;
min-width: 37.5%;
margin-top: 0;
margin-bottom: $spacing-02;
overflow: hidden;
text-overflow: ellipsis;

input, select, button, .select2-container {
button, a.button {
flex: 0 1 auto;
min-width: 10%;
margin-top: 0;
margin-bottom: $spacing-02;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

&:not(:first-child) {
margin-left: -1px;
}
}

input, select, .select2-container {
width: 50%;
}

&:last-of-type {
margin: 0;
}
}

@media (max-width: 600px) {
.container {
flex-direction: column;
}

.container input,
.container button {
flex: 1 1 auto;
width: 100%;
}
}

.input-group-authors {
flex-flow: column;
}
Expand Down
1 change: 0 additions & 1 deletion cms/sass/themes/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@
}

.remove_field__button {
margin-bottom: $spacing-03;
white-space: nowrap;
}
}
Expand Down
1 change: 0 additions & 1 deletion cms/sass/themes/_editorial-form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
}

.remove_field__button {
margin-bottom: $spacing-03;
white-space: nowrap;
}

Expand Down
1 change: 1 addition & 0 deletions doajtest/fixtures/v2/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def build_flags_form_expanded(assignee=None, deadline="", setter=None, created_d
"keywords": ["word", "key"],
"labels": ["s2o"],
"language": ["EN", "FR"],
"language_editions": [{"pissn": "000X-000X", "eissn": "111X-111X", "language": "fr", "id": "frlanguageedition"}],
"license": [
{
"type": "Publisher's own license",
Expand Down
19 changes: 19 additions & 0 deletions doajtest/unit/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from doajtest.helpers import DoajTestCase, patch_history_dir, save_all_block_last
from portality import constants
from portality import models
from portality.bll.exceptions import NoSuchObjectException, ArgumentException
from portality.constants import BgjobOutcomeStatus
from portality.lib import dataobj
from portality.lib import seamless
Expand Down Expand Up @@ -71,6 +72,10 @@ def test_02_journal_model_rw(self):
j.add_contact("richard", "[email protected]")
j.add_note("testing", "2005-01-01T00:00:00Z")
j.set_bibjson({"title": "test"})
jbib = j.bibjson()
jbib.language_editions = [{"id": "polishedition", "language": "pl"},
{"id": "englishedition", "language": "en"},
{"id": "germanedition", "language": "de"}]

assert j.id == "abcd"
assert j.created_date == "2001-01-01T00:00:00Z"
Expand All @@ -88,11 +93,25 @@ def test_02_journal_model_rw(self):
assert j.get_latest_contact_email() == "[email protected]"
assert len(j.notes) == 1
assert j.bibjson().title == "test"
assert len(jbib.language_editions) == 3

j.remove_owner()
j.remove_editor_group()
j.remove_editor()
j.remove_contact()
with self.assertRaises(ValueError):
jbib.remove_language_edition("frenchedition")

jbib.remove_language_edition("polishedition")
assert len(jbib.language_editions) == 2

jbib.clear_language_editions()
assert len(jbib.language_editions) == 0

jbib.add_language_edition({"id": "originaljournalrecord", "language": "fr"})
assert len(jbib.language_editions) == 1
assert jbib.language_editions[0]["id"] == "originaljournalrecord"
assert jbib.language_editions[0]["language"] == "fr"

assert j.owner is None
assert j.editor_group is None
Expand Down
16 changes: 16 additions & 0 deletions portality/crosswalks/journal_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,13 @@ def form2bibjson(cls, form, bibjson):
if getattr(form, "discontinued_date", None):
bibjson.discontinued_date = form.discontinued_date.data

# language editions
if form.language_editions.data:
editions = []
for le in form.language_editions.data:
editions.append({"id":le["lang_edition_id"], "language":le["lang_edition_language"]})
bibjson.language_editions = editions

# subject information
if getattr(form, "subject", None):
new_subjects = []
Expand All @@ -259,6 +266,7 @@ def form2bibjson(cls, form, bibjson):

@classmethod
def form2admin(cls, form, obj):

if getattr(form, "notes", None):
for formnote in form.notes.data:
if formnote["note"]:
Expand Down Expand Up @@ -440,6 +448,14 @@ def bibjson2form(cls, bibjson, forminfo):
forminfo["continued_by"] = bibjson.is_replaced_by
forminfo["discontinued_date"] = bibjson.discontinued_date

# language editions information
forminfo["language_editions"] = []
for le in bibjson.language_editions:
forminfo["language_editions"].append({
"lang_edition_id": le.get("id"),
"lang_edition_language": le.get("language")
})

# subject classifications
forminfo['subject'] = []
for s in bibjson.subject:
Expand Down
14 changes: 14 additions & 0 deletions portality/dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,26 @@ def pull(cls, id_):

@classmethod
def pull_by_key(cls, key, value):
"""
attr: key, value
returns:
- if 1 result: the record;
- if <1 or >1 results: None
"""
res = cls.query(q={"query": {"term": {key + app.config['FACET_FIELD']: value}}})
if res.get('hits', {}).get('total', {}).get('value', 0) == 1:
return cls.pull(res['hits']['hits'][0]['_source']['id'])
else:
return None

@classmethod
def search_by_key(cls, key: str, value: str) -> list:
"""
returns: [ids] of the found records
"""
res = cls.query(q={"query": {"term": {key + app.config['FACET_FIELD']: value}}})
return [cls(**r.get("_source")) for r in res.get("hits", {}).get("hits", [])]

@classmethod
def object_query(cls, q=None, **kwargs):
result = cls.query(q, **kwargs)
Expand Down
Loading