Skip to content

Improve <DeleteButton> and <UpdateButton> confirmation wording using record representation#10654

Merged
slax57 merged 9 commits intonextfrom
confirm-record-representation
Apr 18, 2025
Merged

Improve <DeleteButton> and <UpdateButton> confirmation wording using record representation#10654
slax57 merged 9 commits intonextfrom
confirm-record-representation

Conversation

@djhi
Copy link
Contributor

@djhi djhi commented Apr 9, 2025

Problem

<DeleteButton> and <UpdateButton> confirmation dialog titles show a very generic message but we can do better thanks to the record representation.

Solution

  • If a resource has a string record representation, use it.
  • To avoid breaking changes, introduce new translation keys where needed

How To Test

<DeleteButton>

<UpdateButton>

Screenshots

<DeleteButton>

Before
image
After
image

<UpdateButton>

Before
image
After
image

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)

@djhi djhi added the RFR Ready For Review label Apr 9, 2025
@fzaninotto
Copy link
Member

Can you please add a before/after screenshot in the PR description?

@djhi
Copy link
Contributor Author

djhi commented Apr 14, 2025

Can you please add a before/after screenshot in the PR description?

Added

@fzaninotto
Copy link
Member

I think the default translation should still contain the resource name:

Update post "Lorem Ipsum"

instead of

Update Lorem Ipsum

@fzaninotto fzaninotto changed the title Improve <DeleteButton> and <UpdateButton> confirmation using record representation Improve <DeleteButton> and <UpdateButton> confirmation wording using record representation Apr 15, 2025
@fzaninotto
Copy link
Member

We had a different approach with mutation success notifications: letting users provide a resource-specific translation, and defaulting to the generic one. I prefer that approach, it avoids problems with pluralization, capitalisation, etc.

notify(`resources.${resource}.notifications.created`, {
    type: 'info',
    messageArgs: {
        smart_count: 1,
        _: translate(`ra.notification.created`, {
            smart_count: 1,
        }),
    },
    undoable: mutationMode === 'undoable',
});

@djhi
Copy link
Contributor Author

djhi commented Apr 16, 2025

We had a different approach with mutation success notifications: letting users provide a resource-specific translation, and defaulting to the generic one. I prefer that approach, it avoids problems with pluralization, capitalisation, etc.

notify(`resources.${resource}.notifications.created`, {
    type: 'info',
    messageArgs: {
        smart_count: 1,
        _: translate(`ra.notification.created`, {
            smart_count: 1,
        }),
    },
    undoable: mutationMode === 'undoable',
});

Done

@slax57 slax57 self-requested a review April 17, 2025 13:45
@slax57 slax57 added this to the 5.8.0 milestone Apr 18, 2025
@slax57 slax57 merged commit d30278a into next Apr 18, 2025
1 of 2 checks passed
@slax57 slax57 deleted the confirm-record-representation branch April 18, 2025 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFR Ready For Review

Development

Successfully merging this pull request may close these issues.

4 participants