Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
80 changes: 69 additions & 11 deletions cms/sass/layout/_page-header.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,76 @@
/* Page header */

.page-header {
min-height: 150px;
min-height: 150px;

@media screen and (max-width: 768px) {
min-height: 100px;
}
@media screen and (max-width: 768px) {
min-height: 100px;
}

/* do not underline the links, unless in an alert */
a:not(.alert a) {
text-decoration: none;
}
/* do not underline the links, unless in an alert */
a:not(.alert a) {
text-decoration: none;
}

.feather {
position: relative;
}
.feather {
position: relative;
}
}

.above_the_fold--title {
margin-bottom: 1rem;
}

.above_the_fold h2 {
margin-top: 0;
margin-bottom: 1rem;
}

.above_the_fold--url {
color: #5c5956;
}

.above_the_fold--issns {
font-size: 0.9rem;
font-weight: bold;
color: $sanguine;
margin-top: 0;
margin-bottom: 1rem !important;
}

.button.button--tertiary.see_in_doaj {
margin-bottom: 0;
}

@media (max-width: 1279px) and (min-width: 768px) {
.button.button--tertiary.see_in_doaj {
margin-top: 1rem;
}
}

@media (min-height: calc((10rem + 105px) * 2.5)) {
main:has(> .main-header.fixed) {
margin-top: 10rem;
@media (max-width: 1279px) and (min-width: 768px) {
&:has(.button.button--tertiary.see_in_doaj){
margin-top: 13rem;
}
.button.button--tertiary.see_in_doaj {
margin-top: 1rem;
}
}
.button.button--tertiary.see_in_doaj {
margin-top: 1rem;
}

.main-header.fixed {
position: fixed;
top: 75px;
left: 75px;
z-index: 1000;
background-color: white;
width: calc(100% - 75px);
padding: 25px 30px;
}
}
}
4 changes: 0 additions & 4 deletions cms/sass/themes/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
.dashboard {
font-size: 18px;

h1 {
margin-top: 0;
}

> header:first-of-type {
height: 75px;
}
Expand Down
56 changes: 56 additions & 0 deletions doajtest/testbook/new_application_form/new_header.yml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that introducing a new layout to the form requires a separate test. This is the new layout for the form, so I would just fold the check for this into the general application form tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not a separate test, this would require the team to test the whole application form. We don't change any logic of the form itself, isn't that excessive?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing the whole application form when a change has been made to it is a sensible thing to do, as it tests both the feature and any regressions.

The flip-side is that if there's a specific test for this specific aspect of the application form it will take longer to do regression tests in the future, as this could just be part of the application form test rather than an entirely separate test in its own right.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
suite: New Header in Editorial Forms
testset: New Header in Editorial Forms

tests:
- title: Admin Review Form Layout
setup:
- Go to /testdrive/new_editorial_form_layout
context:
role: admin
steps:
- step: Log in as BaronVonBurp, the admin
- step: Access the journal form at /admin/<journal_id>
results:
- The top section displays the journal title, URL, and ISSN(s)
- Each item has a copy button next to it
- Click each copy button and paste the value somewhere (e.g., Notepad) to confirm the correct value is copied
- The top section stays visible while scrolling, unless the screen is very short and the header takes more than 40% of the viewport
- step: Access the application form at /application/<application_id>
results:
- Same checks as above
- step: Access the update request form at /application/<update_request_id>
results:
- Same checks as above
- step: Click "Unlock & Close" on the update request page
- step: Log out of the admin account

- title: Editor Review Form Layout
setup:
- Go to /testdrive/new_editorial_form_layout
context:
role: editor
steps:
- step: Log in using as LadyGigglesworth, the editor
- step: Access the application form at /editor/application/<application_id>
results:
- The top section displays the journal title, URL, and ISSN(s)
- Each item has a copy button next to it
- Click each copy button and paste the value somewhere to confirm correctness
- The top section remains visible while scrolling (unless the screen is very short)
- step: Click "Unlock & Close" on the update request page
- step: Log out of the editor account

- title: Publisher Form Layout
setup:
- Go to /testdrive/new_editorial_form_layout
context:
role: publisher
steps:
- step: Log in using as SirSneezesALot, the publisher
- step: Access the update request form at /publisher/update_request/<journal_id>
results:
- The top section displays only the journal title
- There is no fixed/sticky section
- The form has not changed from the currently published version
- step: Click "Unlock & Close"
- step: Log out of the publisher account
90 changes: 90 additions & 0 deletions doajtest/testdrive/new_editorial_form_layout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
from portality import constants
from doajtest.testdrive.factory import TestDrive
from doajtest.fixtures.v2.journals import JournalFixtureFactory
from doajtest.fixtures.v2.applications import ApplicationFixtureFactory
from portality import models


class NewEditorialFormLayout(TestDrive):
def setup(self) -> dict:
publisher_un = "SirSneezesALot"
publisher_pw = self.create_random_str()
publisher_acc = models.Account.make_account(publisher_un + "@example.com", publisher_un, "Publisher " + publisher_un, [constants.ROLE_PUBLISHER])
publisher_acc.set_password(publisher_pw)
publisher_acc.save()

admin_un = "BaronVonBurp"
admin_pw = self.create_random_str()
admin_acc = models.Account.make_account(admin_un + "@example.com", admin_un,
"Admin " + admin_un,
[constants.ROLE_ADMIN])
admin_acc.set_password(admin_pw)
admin_acc.save()

editor_un = "LadyGigglesworth"
editor_pw = self.create_random_str()
editor_acc = models.Account.make_account(editor_un + "@example.com", editor_un,
"Editor " + editor_un,
[constants.ROLE_EDITOR])
editor_acc.set_password(editor_pw)
editor_acc.save()

source = JournalFixtureFactory.make_journal_source(in_doaj=True)
j = models.Journal(**source)
j.remove_current_application()
j.set_id(j.makeid())
j.set_owner(publisher_acc.id)
j.bibjson().eissn = "1987-0007"
j.bibjson().pissn = "3141-5926"
j.bibjson().title = "Annals of Interspecies Etiquette"
j.bibjson().journal_url = "https://mind-your-penguin-manners.com"
j.save(blocking=True)

source = ApplicationFixtureFactory.make_application_source()
a = models.Application(**source)
a.remove_current_journal()
a.remove_related_journal()
a.application_type = constants.APPLICATION_TYPE_NEW_APPLICATION
a.set_id(a.makeid())
a.set_editor(editor_acc.id)
a.set_owner(publisher_acc.id)
a.bibjson().eissn = "2718-2818"
a.bibjson().title = "Journal of Hypothetical Entomology"
a.bibjson().journal_url = "https://does-it-bite.com"
a.set_application_status(constants.APPLICATION_STATUS_IN_PROGRESS)
a.save(blocking=True)

source = ApplicationFixtureFactory.make_update_request_source()
ur = models.Application(**source)
ur.set_id(ur.makeid())
ur.set_editor(editor_acc.id)
ur.set_owner(publisher_acc.id)
ur.bibjson().pissn = "0042-2718"
ur.bibjson().title = "Annals of Temporal Mechanics"
ur.bibjson().journal_url = "https://time-loops-and-tea.com"
ur.save(blocking=True)

return {
"accounts": {
"admin": {"username": admin_acc.id,
"password": admin_pw},
"editor": {"username": editor_acc.id,
"password": editor_pw},
"publisher": {"username": publisher_acc.id,
"password": publisher_pw},
},
"journals": {j.bibjson().title: j.id},
"applications": {a.bibjson().title: a.id},
"update_requests": {ur.bibjson().title :ur.id}
}

def teardown(self, params) -> dict:
for accid in ["admin", "editor", "publisher"]:
models.Account.remove_by_id(params["accounts"][accid]["username"])
for title, id in params["journals"].items():
models.Journal.remove_by_id(id)
for title, id in params["applications"].items():
models.Application.remove_by_id(id)
for title, id in params["update_requests"].items():
models.Application.remove_by_id(id)
return {"status": "success"}
2 changes: 1 addition & 1 deletion portality/lib/seamless.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def __init__(self, **kwargs):
__SEAMLESS_APPLY_STRUCT_ON_INIT__ = True
__SEAMLESS_CHECK_REQUIRED_ON_INIT__ = True
__SEAMLESS_SILENT_PRUNE__ = False
__SEAMLESS_ALLOW_OTHER_FIELDS__ = False
__SEAMLESS_ALLOW_OTHER_FIELDS__ = True

def __init__(self,
raw=None, # The raw data
Expand Down
67 changes: 67 additions & 0 deletions portality/templates-v2/includes/_click_to_copy.html
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I think I see what you are struggling with here - you want to include a block of styles, html and css into the page before the js has loaded. I don't want to reorganise how we deliver JS for the entire site for this, instead we should do this differently.

I'd:

  • add the styles to the sas
  • add the js to the doaj.js module, or extend doaj.js in the bottom of the relevant application form pages inside the management_js block
  • Have the JS build the html dynamically for elements that need click-to-copy

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<style>
.click-to-copy {
cursor: pointer;
margin: 0;
padding: 0;
width: 1.5em;
height: 1.5em;
display: inline-flex;
justify-content: center;
border: none;
}
.click-to-copy:hover,
.click-to-copy:focus,
.click-to-copy:active {
background-color: transparent;
}

.click-to-copy:hover .feather,
.click-to-copy:focus .feather,
.click-to-copy:active .feather {
stroke: #FD5A3B;
}
.click-to-copy--confirmation {
font-size: 0.75em;
display: inline;
position: relative;
bottom: .25rem;
left: 0;
font-family: 'Source Sans Pro', sans-serif;
font-weight: normal;
color: #5c5956;
}
</style>

<button type="button" class="click-to-copy" id="click-to-copy--{{ value_elem_id }}" aria-label="Copy {{ value_elem_id }} to clipboard">
<i data-feather="copy" aria-hidden="true"></i><span id="click-to-copy--confirmation" style="display: none">Value copied!</span>
</button>

<script type="text/javascript">
(function waitForJQuery() {
if (window.jQuery) {
$(function() {
var $copySpan = $('#click-to-copy--{{ value_elem_id }}');
var $valueElem = $('#{{ value_elem_id }}');

$copySpan.on('click', function() {
if (!$valueElem.length) return;

var textToCopy = $valueElem.val() || $valueElem.text();

navigator.clipboard.writeText(textToCopy).then(function() {
var $msg = $('<span class="click-to-copy--confirmation">Value copied!</span>');
$copySpan.after($msg);

setTimeout(function() {
$msg.remove();
}, 3000);
}).catch(function(err) {
console.error('Failed to copy:', err);
});
});
});
} else {
setTimeout(waitForJQuery, 50); // check again in 50ms
}
})();
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

{% if obj and (obj.es_type == 'journal' and obj.is_in_doaj()) %}
{{ _msg.build_journal_withdrawn_deleted_msg(obj) }}
<a class="button button--tertiary" href="{{ url_for('doaj.toc', identifier=obj.id) }}" target="_blank">See this journal in DOAJ</a>
{% endif %}


Expand Down
4 changes: 2 additions & 2 deletions portality/templates-v2/management/admin/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{% block page_title %}Managing Editor Dashboard{% endblock %}

{% block page_header %}
Hi, {% if current_user.name %}{{ current_user.name }}{% else %}
{{ current_user.id }}{% endif %}!
<h1>Hi, {% if current_user.name %}{{ current_user.name }}{% else %}
{{ current_user.id }}{% endif %}!</h1>
{% endblock %}

{% block admin_content %}
Expand Down
13 changes: 12 additions & 1 deletion portality/templates-v2/management/admin/maned_application.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
{% set notabs = true %}
{% set diff_table = true %}
{% set quick_reject = true %}
{% block fixed_header %}fixed{% endblock %}

{% block page_header %}
{% include "management/includes/_fixed_form_header.html" with context %}
{% endblock %}

{% block page_title %}{% if obj.application_type == constants.APPLICATION_TYPE_UPDATE_REQUEST %}Update Request{% else %}Application{% endif %}: {{ obj.bibjson().title }}{% endblock %}
{% block body_id %}apply{% endblock %}

{% block admin_content scoped %}
Expand Down Expand Up @@ -53,3 +57,10 @@ <h3 id="modalLabel-quick_reject" class="modal__title">
</script>
{% endif %}
{% endblock %}

{% block management_js %}
{{ super() }}
<script>
feather.replace()
</script>
{% endblock %}
5 changes: 4 additions & 1 deletion portality/templates-v2/management/admin/maned_journal.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
{% set quick_reject = false %}
{% set withdrawable = true %}

{% block page_title %}Journal: {{ obj.bibjson().title }}{% endblock %}
{% block fixed_header %}fixed{% endblock %}
{% block page_header %}
{% include "management/includes/_fixed_form_header.html" with context %}
{% endblock %}
{% block body_id %}apply{% endblock %}

{% block admin_content scoped %}
Expand Down
Loading