jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Show compound patterns in the dropdown for citation key patterns

Open priyanshu16095 opened this issue 9 months ago • 23 comments

Follow-up for #12516

This PR enhances the citation key dropdown feature by adding a submenu for compound patterns.

Mandatory checks

  • [x] I own the copyright of the code submitted and I licence it under the MIT license
  • [/ ] Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [x] Tests created for changes (if applicable)
  • [x] Manually tested changed features in running JabRef (always required)
  • [x] Screenshots added in PR description (for UI changes)
  • [x] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [x] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

https://github.com/user-attachments/assets/9d7ed724-e5b7-4fe0-99e9-16add673f27d

priyanshu16095 avatar Feb 27 '25 00:02 priyanshu16095

https://github.com/user-attachments/assets/b79035a9-aced-47ba-ac65-952a5256e7e9

@koppor Thanks for your insights! I’ve come up with a different solution that addresses the concerns and removes the overhead of an algorithm, maintaining it, and making it more efficient. Instead, I used a UI-based solution (similar to your modal solution) that provides a much better approach, as the user doesn't have to type different keywords to find a pattern. The UX is perfect, for a two-click process—it takes only two clicks.

priyanshu16095 avatar Feb 28 '25 13:02 priyanshu16095

Another improvement in the code: For better UX, the position of the sub-menu items under 'All patterns' and 'Create compound pattern' has been fixed, as it was not fixed before.

Before:

before

After:

after

priyanshu16095 avatar Feb 28 '25 13:02 priyanshu16095

Sorry, I am a little low on time to test this - What does the menu "Create compound pattern" do? Why is it needed if we can create compound patterns by taking patterns from the "All patterns" list? As far as I understand, only thing it does is add underscores in between patterns - the choice of that separator can be arbitrary for a user. @koppor do we wish to make underscore a default for this? Or is it a wider convention? This user, for example, was using colons (:) as a separator.

Also: image

@priyanshu16095 Can you move the black arrows of the first menu (first two items having sublists) to the extreme right of the cell (like in the sublist menu)?

(Updated)

subhramit avatar Mar 03 '25 13:03 subhramit

Just like a dropdown that shows generated compound patterns, it allows the user to create any pattern on their own. Regarding your concern about symbols, it could have a submenu displaying symbols that can be added or, by default - can be used.

priyanshu16095 avatar Mar 03 '25 15:03 priyanshu16095

Screenshot (188)

The width of the menu cannot be set in JavaFX, as it is managed by the system. However, I can change the width of the labels instead.

priyanshu16095 avatar Mar 03 '25 19:03 priyanshu16095

Sorry, I am a little low on time to test this - What does the menu "Create compound pattern" do? Why is it needed if we can create compound patterns by taking patterns from the "All patterns" list? As far as I understand, only thing it does is add underscores in between patterns - the choice of that separator can be arbitrary for a user. @koppor do we wish to make underscore a default for this? Or is it a wider convention? This user, for example, was using colons (:) as a separator.

@koppor ping

subhramit avatar Mar 04 '25 13:03 subhramit

Just like a dropdown that shows generated compound patterns, it allows the user to create any pattern on their own. Regarding your concern about symbols, it could have a submenu displaying symbols that can be added or, by default - can be used.

Good idea! _ can be the default.

koppor avatar Mar 07 '25 17:03 koppor

Just like a dropdown that shows generated compound patterns, it allows the user to create any pattern on their own. Regarding your concern about symbols, it could have a submenu displaying symbols that can be added or, by default - can be used.

The functionality is unclear because of the wording. The options need to be "parallel", like this:

Example 1

Choose pattern ⏵
Build pattern ⏵

Example 2

Basic pattern ⏵
Advanced pattern ⏵

Example 3

Simple pattern ⏵
Complex pattern ⏵

What about modifiers? These could be available after the first field or field marker has been selected, maybe like this.

Example 4

[title]
Add to pattern ⏵ ...
Add modifier ⏵ :abbr
               :lower
               :upper
               :titlecase

Another possibility for modifiers and even more detail would be to include an "expert" option linking to documentation or just add View documentation 🔗 to the list. I don't think JabRef already has a convention for context-sensitive help on menus, but I could be wrong.

ryan-carpenter avatar Mar 13 '25 21:03 ryan-carpenter

@ryan-carpenter I was unable to convey this properly. What I mean to say is that, without writing much additional code and by simply adding a few lines in the UI, it significantly improves the user experience. This is because there's no need to read any documentation or manually reopen the dropdown. I will improve this based on the review.

priyanshu16095 avatar Mar 14 '25 21:03 priyanshu16095

What is described in the comment is too complex to be implemented with context menu. If adding a submenu for other symbols and an expert linked to documentation is sufficient, or else I should use any other thing for UI.

priyanshu16095 avatar Apr 02 '25 19:04 priyanshu16095

I am okay with doing what is described in the comment. Just want to know thoughts on this.

priyanshu16095 avatar Apr 02 '25 19:04 priyanshu16095

I am okay with doing what is described in the comment. Just want to know thoughts on this.

Lets do a follow-up on that in a separate PR. Is this otherwise ready? If it is, please resolve the merge conflicts and mark it ready for review.

subhramit avatar Apr 02 '25 19:04 subhramit

Done, resolved the conflicts, and it is ready.

priyanshu16095 avatar Apr 02 '25 19:04 priyanshu16095

Does it also require a changelog.md entry?

priyanshu16095 avatar Apr 02 '25 19:04 priyanshu16095

Note that your PR will not be reviewed/accepted until you have gone through the mandatory checks in the description and marked each of them them exactly in the format of [x] (done), [ ] (not done yet) or [/] (not applicable).

jabref-machine avatar Apr 02 '25 19:04 jabref-machine

Fixing the checks...

priyanshu16095 avatar Apr 02 '25 19:04 priyanshu16095

Does it also require a changelog.md entry?

No, if the previous one mentions "dropdowns". Else, you can edit it.

subhramit avatar Apr 02 '25 19:04 subhramit

You ticked that you modified CHANGELOG.md, but no new entry was found there.

If you made changes that are visible to the user, please add a brief description along with the issue number to the CHANGELOG.md file. If you did not, please replace the cross ([x]) by a slash ([/]) to indicate that no CHANGELOG.md entry is necessary. More details can be found in our Developer Documentation about the changelog.

jabref-machine avatar Apr 03 '25 11:04 jabref-machine

It's ready. Please take a look at the trag bot review and let me know what needs to be done in the follow-up.

priyanshu16095 avatar Apr 04 '25 16:04 priyanshu16095

This is complete.

priyanshu16095 avatar Apr 12 '25 14:04 priyanshu16095

@subhramit This is complete.

priyanshu16095 avatar Apr 18 '25 21:04 priyanshu16095

@ryan-carpenter I was unable to convey this properly. What I mean to say is that, without writing much additional code and by simply adding a few lines in the UI, it significantly improves the user experience. This is because there's no need to read any documentation or manually reopen the dropdown.

I think, my review even improves usability more - and should not be much code, either.

What ryan also mentioned are the modifiers - which I also mentioned in my comment. On the one hand, this is really advanced JabRef usage - and could be done in a follow up. On the other hand, if you start implementing context menus, this could be "easily" doable maybe.

koppor avatar Apr 19 '25 12:04 koppor

@ryan-carpenter I was unable to convey this properly. What I mean to say is that, without writing much additional code and by simply adding a few lines in the UI, it significantly improves the user experience. This is because there's no need to read any documentation or manually reopen the dropdown.

I think, my review even improves usability more - and should not be much code, either.

What ryan also mentioned are the modifiers - which I also mentioned in my comment. On the one hand, this is really advanced JabRef usage - and could be done in a follow up. On the other hand, if you start implementing context menus, this could be "easily" doable maybe.

My main intent was to point out that the wording "All patterns" and "Create compound pattern" could be improved. The first is a noun phrase and the second is a verb phrase, which takes a little longer to process than if they are both the same. Example 1 is a suggestion that uses only verb-phrases while Examples 2 and 3 are alternatives that using only noun-phrases.

I also noticed that it might not be clear that "Create compound pattern" would need to be used repeatedly to create the pattern. If I recall correctly the phrase "Add to pattern" would not make sense because the user needs to first pick an initial pattern, then repeat the action to append to it.

Example 4 was an additional idea for potentially extending the proposal from priyanshu to become a "complete" pattern builder without requiring a dedicated window/form (because the proposal is already so close to providing this). I agree that if this is to be done, it can be a follow-up issue.

Edit: These ideas are also covered in a practical way by koppor's remarks in https://github.com/JabRef/jabref/pull/12580#pullrequestreview-2779953780

ryan-carpenter avatar May 24 '25 02:05 ryan-carpenter

Housekeeping: Closing this due to inactivity. Thank you nevertheless for your efforts.

calixtus avatar Oct 09 '25 21:10 calixtus