Propozycja: historia zmian szablonów i layoutów z przywracaniem poprzedniej wersji
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reading models/Template.php, models/Layout.php, traits/FollowsView.php:41-48, and October's Revisionable trait at vendor/october/rain/src/Database/Traits/Revisionable.php; the issue also points to #267 for the text-column limit. The proposed scope spans revision storage, history and restore actions in backend forms, permissions, and view-file synchronization. Done means the acceptance criteria are met, including bounded history and tests for recording, restoring, permissions, and synchronization.
Written by the indexing model from the issue text.
Description
Problem
Szablony i layouty edytują w panelu także osoby nietechniczne, a edytor to surowy HTML/Twig. Zapisanej zmiany nie da się cofnąć do poprzedniej wersji. Reset to Default przywraca tylko plik widoku z pluginu i działa wyłącznie dla rekordów z widoku. Szablony utworzone w panelu (is_custom) i layouty odłączone od widoku nie mają żadnej drogi powrotu.
Dowód
models/Template.phpimodels/Layout.phpnie używająRevisionableani niczego podobnego. Zapis nadpisujecontent_html/content_cssbez śladu.traits/FollowsView.php:41-48:resetToView()cofa do pliku widoku, nie do poprzedniego zapisu.- October ma gotowy trait
October\Rain\Database\Traits\Revisionablez tabeląsystem_revisions(vendor/october/rain/src/Database/Traits/Revisionable.php).
Skutek
Jedna błędna zmiana, np. usunięty fragment faktury albo zepsuty Twig zapisany razem z poprawną treścią, oznacza ręczne odtwarzanie z pamięci lub z backupu bazy. Nie wiadomo też, kto i kiedy zmienił dokument prawny.
Proponowane rozwiązanie
RevisionablenaTemplate(title,description,content_html,layout_id,size,orientation,sample_data) iLayout(name,content_html,content_css), z rozsądnym$revisionableLimitigetRevisionableUser()zwracającym administratora backendu.- Zakładka History w formularzu: lista zmian (data, administrator, pole) z podglądem starej treści.
- Akcja Restore za uprawnieniem Update, która przywraca wartości i oznacza szablon jako Customized.
- Uwaga:
system_revisions.old_value/new_valuetoTEXT, więc ma ten sam limit 64 KB co obecne kolumny treści (zob. #267).
Kryteria akceptacji
- Każdy zapis zmienionej treści tworzy rewizję z autorem i datą.
- Z formularza można obejrzeć i przywrócić wybraną wersję; przywrócenie wymaga Update.
- Synchronizacja z plikami widoków nie zapełnia historii zmianami z pluginu albo oznacza je osobno.
- Liczba rewizji na rekord jest ograniczona.
- Dominant language
- PHP
- Stars
- 30
- Forks
- 22
- Avg merge
- 5m
- Merged PRs (30d)
- 47
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#4355 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
agentic bug complete-verify
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
MagnaCapax/PMSS#1234 ·
Maintainers usually reply within 3 days
-
bug report
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
yiisoft/yii2-docker#193 ·