Kirby Revisions 2 - Poll about what to do with it

It’s named Kirby Revisions 2 but it’s not even the same plugin anymore.

Version 2.0 beta - For version 1, see version-1 branch.

I do not guarantee that this is a safe way to backup and restore backups.

Screenshots

Page with revisions

Revisions archive

A revision

1. Install

Kirby CLI

Run this command:

kirby plugin:install jenstornell/kirby-revisions

Manually

Add the folder kirby-revisions into /site/plugins/.

2. Setup

To show the revisions on the page you need to add a field for it.

Blueprint

fields:
  revisions:
    label: Revisions
    type: revisions

3. Remove revisions in the queries

Every page that has revisions will have a folder called revisions. In your templates and snippets you need to remove it from your query.

To do that you can use a collection filter:

https://getkirby.com/docs/developer-guide/objects/collections
An example might be added in a later point of time.

Changelog

2.0

  • Completely rewritten
  • Kirby uses pages as revisions

Misc

Requirements: Kirby 2.3.2
License: MIT

5 Likes

I’m giving this a try tonight. Can’t wait. It looks great and I can think of a lot of people for whom it’d come really handy!
Thanks for this fantastic contribution. Have you used this version in production yet?

Thanks! :slight_smile:

Have you used this version in production yet?

No but I’ve tested it quite well I hope. The first screenshot says 76 revisions and yes, I’ve saved that page 76 times. Hopefully that’s enough for a first version. The only possible danger should be if the rollback don’t work (but it should work just fine).

I expect it to be even more reliable with each new version.

I also have many things on my todolist that I will probably add in the next versions.

Examples of possible new features:

  • Rollback warning
  • Restore a just single field
  • Revision clean up buttons
  • Translations for other languages
  • Statistic information (filesize, number of positive/negative diff etc)

I’m volunteering for the French version :slight_smile: When can I start?

I already release the first bugfix version.

I renamed the folder from revisions to kirby-revisions right before uploading it to the repo yesterday but forgot to rename the file. So the plugin will probably not have worked at all.

Sorry about that! :flushed:

2.1

  • Bugfix: Renamed revisions.php to kirby-revisions.php to match the folder name.
  • Renamed type to action.

I’m volunteering for the French version :slight_smile: When can I start?

Probably not today. :wink: I think it’s important to nail the core features that I have in mind first. But great to have some French help! :smiley:

1 Like

Hi Jens
Thanks for this awesome plugin. I was waiting for something like that. Today I did a quick test, but I didn’t get it to work.
I used a fresh kirby 2.3.2 installation and installed revision manually, added the blueprint field and wanted to start.
But my panel page was empty, no fields shown at all. In my php log a found a fatal error:
PHP Fatal error: Method RevisionsField::__toString() must not throw an exception in /Users/Sites/github/kirbytest/kirby/toolkit/lib/brick.php on line 0

I’m not so used to php so I can’t do anything with this error.

I’m using MAMP with PHP 7.

Thanks for your help and your great work for the kirby community.

Not a very good start but I’ve been hunting bugs this morning and we are now at version 2.4.

I tested it with a fresh starterkit with Kirby CLI with both multi language and without. Everything works like expected. Hopefully it will work for the rest of you as well.

Changelog

2.4

  • Bugfix: Fixed issue with rollback in multi language

2.3

  • Bugfix: Fixed an issue so it also work without multi language

2.2

  • Bugfix: Corrected an error in package.json
  • Bugfix: Added fix for pages that don’t have revisions yet
  • Feature: Added filesize to revisions fields

The reason I released so many versions was that I wanted to fix the major bugs quickly

Nice, with the new version it works great.

What is a bit confusing form the users perspective is that the latest entry is actually the current version. So if I want to rollback one step I have to go the the second version.

Maybe we can hide the latest entry? Or am I thinking the wrong way?

Yes, I’m aware of this and I agree! :slight_smile:

But I still want to show that the latest/current version is saved as well. But I added an issue about it here.

I will think about a UI solution to not make it confusing and at the same time somehow show that the current revision is saved as well.

Can the action be something else than “Update” or “Create” ?

Yes, there is a Rollback action as well. It’s created after a revision is rolled back.

Did you have something in mind regarding to this?

I just wondered why the action is prominently displayed, even though in the screenshots it’s always the same one. Now I understand why :slight_smile: I’ll have to use the plugin a bit before I make suggestions :wink:

Yes, I should probably improve the screenshots. :slight_smile:

In the revisions list I wanted to show as much as possible, except the actual revision content. One part of that is to show the action.

It might change in the future.

For example, I have plans to show the number of inserts and deletions in that list somewhere. Maybe something like this:

@jonathanhess I want to involve at least one more person into this issue. Do you agree with my suggestion or @Malvese on this one? Other people can vote as well. Thanks!

I like both. But I prefere your version, where the current is not listed.
If you go for Malvese’s one, I would deactivate the link so its not clickable.

2 Likes

Hi Jens
I installed the plugin on a website where I use

c::set('date.handler', 'strftime');

Obviously this breaks the date in revisions. Is there a way to tell the plugin to use also strftime?

And a small improvement would be, if it would use the field label instead of the field name. On the detail page the titles are the fieldnames so that could be confusing. This should be changed to the blueprints label name.

Thanks for your report! I added an issue about it here.

Version 2.5 released

Page field

When visiting a page these changes will appear:

  • Icons removed to save screen space
  • The current revision which is equal to the current page is now moved to the bottom
  • Delete all deletes all revisions for the page
  • Diff shows how many inserts and deletions there are

Revision sidebar

See screenshot above. When visiting a revision in the panel there is a Revision info section. It shows template, action and diff.

Missing in blueprint warning

Below the fields diff in the revision there can be a warning if there are fields that are missing in the blueprint. This can be good to know about because these fields is probably not visible on the panel page, even if they are restored in the content file.

Template diff warning

See screenshot above. If the revision template is different than the original page there is also a warning about it.

Complete changelog

2.5

  • Feature: Added latest/current revision as a date in the field footer
  • Feature: Added option plugin.revisions.panel.root.url to set if the panel is installed in another location than default
  • Feature: Delete revision from inside revision
  • Feature: Delete all revisions from page
  • Feature: Delete all in revision archive
  • Feature: Confirm warning before delete added on all revision fields
  • Feature: Sidebar added with template, action and diff
  • Feature: Diff numbers added to field tables
  • Feature: Warning if template name differs to original
  • Feature: Show fields not in blueprint separated
  • Enhancement: Moved css from inline to assets/css
  • Enhancement: Fields now share the same snippets where possible
  • Enhancement: Renamed Updated to Modified in the page field
  • Enhancement: Removed icons to get more space in page field
  • Enhancement: Uses own table CSS instead of borrowing the structure field style
  • Fix: Revisions per page in revision archive are now 25 instead of 5
  • Fix: Hide latest/current revision to prevent rollback to itself
  • Fix: Added site()->errorPage() instead of error to go
4 Likes

This is becoming more and more awesome… I love that you added a custom sidebar section. I’ll dig into that soon.

1 Like

Hi!

First of all, i want to say your plugin is awesome! From now on it’s going to be one of my basics installations :slight_smile:

I’m about to upload to a production server but i’ve a doubt about the Missing in blueprint warning.

I’m not sure why it’s appearing in my revisions page because actually the coverImage exists in the blueprint, and i use it in the template later.

Why is this message appearing then?

Thank you so much!