Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option in preferences to use custom URL base for DOI generation #7480

Merged
merged 11 commits into from
Mar 8, 2021

Conversation

BJaroszkowski
Copy link
Contributor

Added option in preferences to allow users to choose custom base of DOI address whenever trying to access article via DOI field as requested in #7337 . This is a draft pull request since placement in GUI and functionality are still up for discussion.

custom_doi

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.

Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

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

Hi @BJaroszkowski , thanks for your contribution. Codewise the changes already very good.
One thing I personally would prefer would be to move this setting out of the GeneralTab to a new PreferenceTab ("Import" or likewise. Creating a new tab should be straightforward, there are plenty of examples). I'm sure, there are other settings in the preferences dialog, that can later be moved there too, to clean the dialog a bit up - but this would not be the focus of this PR.

@calixtus
Copy link
Member

calixtus commented Mar 4, 2021

Be aware, that there is still a localization test failing. Please add this string (Use custom DOI base URI for article access) to the english resource file. (see https://devdocs.jabref.org/getting-into-the-code/code-howtos#using-localization-correctly)

@BJaroszkowski
Copy link
Contributor Author

I moved the settings to new Preference tab and moved some of the logic to IdentifierEditorViewModel. The name of the tab is more of a placeholder for the moment. I don't think that "Import" is suitable since this particular setting deals with access to external resources.

I still need to update tests to reflect the changes to IdentifierEditor and IdentifierEditorViewModel.

@calixtus
Copy link
Member

calixtus commented Mar 5, 2021

Maybe it suits somewhere else in the preferences dialog? Maybe some more options can later be collected in this new tab?

@BJaroszkowski BJaroszkowski marked this pull request as ready for review March 6, 2021 11:29
@BJaroszkowski
Copy link
Contributor Author

I think the pull request in the current state is ready for review. The other options I could see being included in the new tab are:

  • Entry Owner
  • Merge in Custom editor tabs Tab
  • Perhaps also Custom import/export formats although the tab could get slightly crowded

Copy link
Member

@Siedlerchr Siedlerchr left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution in general I think this already looks good. Just a few minor remarks

@@ -78,6 +94,18 @@ public void openExternalLink() {
);
}

public void openDOIWithCustomBase(String baseURI) {
identifier.get().map(x -> (DOI) x).flatMap(x -> x.getExternalURIWithCustomBase(baseURI)).ifPresent(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
identifier.get().map(x -> (DOI) x).flatMap(x -> x.getExternalURIWithCustomBase(baseURI)).ifPresent(
identifier.get().map(identifier-> (DOI) identifier).flatMap(DOI::getExternalURIWithCustomBase(baseURI)).ifPresent(

please no single char variable name like x, use a meaninfgul variable and inside the flatmap you should be able to use a static syntax like DOI::getExternalUriWithCustomBase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct me if I'm wrong but since flatMap requires Function and we have two input arguments (String baseUri and DOI) is it not impossible to implement the static syntax? IntelliJ seems to agree with that.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, overlooked that, you are right

@@ -1,297 +1,159 @@
Unable\ to\ monitor\ file\ changes.\ Please\ close\ files\ and\ processes\ and\ restart.\ You\ may\ encounter\ errors\ if\ you\ continue\ with\ this\ session.=Unable to monitor file changes. Please close files and processes and restart. You may encounter errors if you continue with this session.
%0\ contains\ the\ regular\ expression\ <b>%1</b>=%0 contains the regular expression <b>%1</b>

Copy link
Member

Choose a reason for hiding this comment

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

Please revert the deletion of the blank lines, just add the new keys at the bottom

<CheckBox fx:id="useCustomDOI" text="%Use custom DOI base URI for article access"/>
<TextField fx:id="useCustomDOIName" HBox.hgrow="ALWAYS"/>
</HBox>
</fx:root>
Copy link
Member

Choose a reason for hiding this comment

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

missing newline at the end of the file

@calixtus calixtus added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Mar 6, 2021
Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. Looks good to me to.
One thing I'm not yet sure ist the wording for the customization tab, but this can also maybe changed in some other PR.

@calixtus calixtus merged commit 2c7715c into JabRef:master Mar 8, 2021
@BJaroszkowski BJaroszkowski deleted the fix-for-issue-7337 branch March 8, 2021 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants