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

Default UserAction 'delete' should have a confirmation message #1082

Open
mkrecek234 opened this issue Dec 21, 2022 · 4 comments
Open

Default UserAction 'delete' should have a confirmation message #1082

mkrecek234 opened this issue Dec 21, 2022 · 4 comments

Comments

@mkrecek234
Copy link
Contributor

Steps to reproduce:

  • Click on a delete button in any Crud
  • Record will be deleted immediately

Expected behaviour:
By default, there should be a confirmation required before deletion

So adding 'confirmation' = 'Do you really want to delete this record?'here

$this->addUserAction('delete', [

@mvorisek
Copy link
Member

Completely agree, about two years ago it was removed when the actions were migrated to UA and since then I always patched in localy like:

abstract class MyModel extends Model
{
    protected function init(): void
    {
        parent::init();

        // ask user for confirmation when delete button is pressed
        $this->getUserAction('delete')->confirmation = 'Do you want to delete this record?';
    }
}

@mvorisek
Copy link
Member

If we add any text here in atk4/data, how is it supposed to work with translation in the future? We cannot import/support anything about translations in atk4/data.

@mkrecek234
Copy link
Contributor Author

mkrecek234 commented Feb 26, 2023

I would propose to add the possibility in atk4/data to add a (localised) text handling function. If not added, it uses its own hard-wired system texts. If it is defined, you can then set any localistion _t function - as extensively discussed with the community, the texts should have unique identifiers like model.delete.confirmation.

This is a separate topic, and not related to this PR: We have plenty of system texts in atk4/data that cannot be localised. As long as we do not have a localisation interface for atk4/data, we should continue implementing texts in hard-wired English in atk4/data.

@mvorisek
Copy link
Member

Feel free to send a PR for this, I fully agree the confirmation for delete should be in opt-out fashion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants