Closed mgralikowski closed 2 years ago
I forked 1.0.12
version not intentionally (I forked from my local project). I will fix it if general idea will be accepted.
@mgralikowski https://github.com/kongulov/nova-tab-translatable/commit/64f0986cf029be0f91c4511eef93f3dae5f1ee28
Not everyone may want such a change, so I added a method with which you can save languages
You can use it by adding the code ->saveLastSelectedLang()
public function fields(Request $request)
{
return [
NovaTabTranslatable::make([
Trix::make('text'),
])->saveLastSelectedLang(),
];
}
It works like a charm.
Making optional this functionality was also my intention, I was thinking about config + inline:
->saveLastSelectedLang(bool|callback);
@mgralikowski config is a good idea, so as not to constantly add a method, but to register it once in the config for the entire project. Now I will make changes
Yes, and by allowing passing bool or callback it will be possible to adjust behaviour for specific resources (exclude). It is similar to other nova's features like disabled(true)
;.
At this moment, when we click "save and back", we will return to default/first language. It is annoying for end-users, especially when a specific person is responsible for one, the specific language of translations (I mean translators using CMS panel). My proposal is to preserve the last clicked tab globally for the plugin, but of course, it is easy to make resource-specific by prefixing session variable names.