Multilingual fields always expanded

Using OJS 3.3.0.4.
Multilingual (pt_PT, es_ES, en_US)

Some authors reported a small issue while making a submission: when they open the Abstract field the multilingual fields “pop-out” and cover the “Add Contributor” button. When they finish inserting data in the Abstract fields, they jump to the lower fields, because they do not see the covered objects.

So they asked if the multilingual fields could be always expanded (like the keywords, subjects, etc…).

I managed to do that by forcing the localization_popover_container_focus_forced class in the textInput.tpl and textArea.tpl files (/lib/pkp/templates/form/).

So, my questions are:

  • Is this a issue for someone else? If more users would like to have the multilingual fields always expanded, it would be great to have that option somewhere in the backend
  • We’d like to keep this change in our journal. So, what’s the best way to do it?

And, related do this, can you please validate my perception of how things work:

  • We can make a plugin doing that change. Pros: it will probably work after a system update; Cons: It’s harder to make a plugin than to change directly the code and the plugin could need an update after a system update.
  • We can change directly in the code after every system update. Pros: Easier way to do it. Cons: if there is a OJS code change that modifies how that class works, we’ll need to dig it again in it to see how to make our change work again
  • We can make the files change (textInput.tpl and textArea.tpl) in our child theme (we use a healthSciences child theme). Pros: The change will still be active even after a system update; Cons: if a new OJS version changes the original files, our child theme will override them and keep us from getting the latest version of those files.

I’m I correct or I’m I getting the wrong picture?

Thank you very much, it’s being really satisfying to learn so much about programing while digging into the great, great work behind OJS (my sincere congratulations to PKP team!).

Rui Pedro Silva

Hi @Rui_Pedro_Silva,

This is a problem with the existing form fields and one of the reasons that we are rolling out a new approach to forms. You can see the newer forms in the settings and the publication forms. We plan to refactor the submission wizard for our next major version, 3.4, so this issue should be addressed then.

I’m I correct or I’m I getting the wrong picture?

That sounds about right to me. Where you put your customization will depend on what you think will be the easiest to maintain.

Hi @NateWr , that’s great news!!!

Ok, I’ll leave it as it is for now and I’ll wait for OJS 3.4.

That sounds about right to me. Where you put your customization will depend on what you think will be the easiest to maintain.

Ok, great! I’ll keep changing it directly in the code for now, until 3.4 comes out.

Kind regards,

Rui Pedro Silva

So… I found a little problem… :sweat_smile: :sweat_smile: :sweat_smile:

With the text fields always expanded, adding or editing an user will cause the name fields to require data in all languages…

@NateWr , is there a problem if I manually set the name fields multilingual=“false” in userDetails.tpl?

Rui Pedro Silva

I don’t know but I would guess that it will cause a problem. It’s likely to change the name of the input field to drop the [en] locale extension.

Ok, it’s a dead-end then…

I apologize for abusing your patience, is there a way to force the localization_popover_container_focus_forced class in textInput.tpl and textArea.tpl only when they are “called” by step 3 of the submission?

By other words, is it possible to get the multilingual fields “auto-expanded” only in the submission forms, keeping userDetails.tpl to expand the name fileds and, in consequence, prevent the name fileds to ask for data in all languages?

Thank you!

Rui Pedro Silva

You can try doing this with a CSS selector:

#submitStep3Form .localization_popover {
  display: block;
  position: relative;
}

Hi @NateWr ,

I’ve being trying to get the CSS selector to work, but without success; I’m adding your code to our styleSheet.css, Im I doing the right thing?

I’ve tried multiple versions, and none of them worked…

Meanwhile, I edited the /lib/pkp/templates/submission/submissionMetadataFormTitleFields.tpl file, addind class=“localization_popover_container_focus_forced” to each fbv/FormSection line:

<div class="pkp_helpers_clear">
	{fbvFormSection for="title" title="common.prefix" inline="true" size=$fbvStyles.size.SMALL class="localization_popover_container_focus_forced"}
		{fbvElement label="common.prefixAndTitle.tip" type="text" multilingual=true name="prefix" id="prefix" value=$prefix readonly=$readOnly maxlength="32" class="localization_popover_container_focus_forced"}
	{/fbvFormSection}
	{fbvFormSection for="title" title="common.title" inline="true" size=$fbvStyles.size.LARGE required=true class="localization_popover_container_focus_forced"}
		{fbvElement type="text" multilingual=true name="title" id="title" value=$title readonly=$readOnly maxlength="255" required=true}
	{/fbvFormSection}
</div>
{fbvFormSection title="common.subtitle" for="subtitle" class="localization_popover_container_focus_forced"}
	{fbvElement type="text" multilingual=true name="subtitle" id="subtitle" value=$subtitle readonly=$readOnly}
{/fbvFormSection}

And I’m getting “auto-expanded” fields only in the Submission form, solving the user details issue.

Have a nive weekend!

Rui Pedro Silva

1 Like