Closed karfau closed 6 years ago
On saving: This is because the plugin has to phone the repo. It could be possibly to separate the logic so that saving does a regular filesystem-write of the file, and a background-task handles updating Git. This requires some functionality for performing this in the background, though, which might be tricky to handle robustly.
On storing temporarily: I'm unaware of whether this has made it into Admin, but its been suggested to leverage LocalStorage in the browser to auto-save changes - and of course indicate this with a "Last stored X mins ago" - to allow easier editing without saving. The mechanism has very good cross-browser support now, and is reliable unless the user clears their cache, which would allow writing without saving.
In the mean time I added an hourly cronjob calling bin/plugin git-sync sync
.
But I can imagine it can be valuable to have options for the following:
What do you guys think about this approach?
I was waiting for admin to include an actions area for the sidebar where 3rd party plugins can create their actions that are always available. With that approach I wanted to make the sync on save optional so that the user could manually sync from the sidebar at wish.
The action bar is something @rhukster and I discussed a while back and the slow saving of gitsync is what inspired it.
Cool, just say a word if there is anything I can help with.
I was waiting for admin to include an actions area for the sidebar where 3rd party plugins can create their actions that are always available. With that approach I wanted to make the sync on save optional so that the user could manually sync from the sidebar at wish.
Hi! Now that this is possible (and even implemented on GitSync side), any updates? I would be interested (and I can do it myself and open a PR if you want). I love this plugin, but I'm a little bit sick of the loading time when I save a page…
Hi @AmauryCarrade , I am experimenting with some minor customizations to the Git Sync blueprint and PHP files to provide an option to disable page-saves and only sync manually. You can see this in action if you download my newest Open Matter Course Hub skeleton at https://getgrav.org/downloads/skeletons
Customized blueprint file: https://gist.github.com/paulhibbitts/8e4a2c330d2fbc3ac82225be33ac6c3e
Customized PHP file: https://gist.github.com/paulhibbitts/5517ea998ba149754dfc7340fa1616fc
Hope the above might be of help to you too.
Sounds great! By looking at the code, I was to submit a PR somewhat like your code (with a few differences like disabling sync for all CRUD operations, not only saves). I could use your code as a base to spare me some time, if you're okay with that :)
Thanks for the PR!
I submitted the PR, do what you want with it :p
Hi @AmauryCarrade , thanks again for your helpful PR. As a first step I've included your PR code (with a few minor UI text tweaks) in my newest Open Course Hub skeleton https://getgrav.org/downloads/skeletons Please take a look-see and let me know what you think.
Everything works fine in my configuration, but saving a page takes "forever" when the plugin is enabled vs. when I disable it.
I assume this is because the plugin waits for the git command to finish, before responding.
Is it possible to change something (configuration wise, or by modifying the plugin) to let git do its thing and already respond with the page anyway after it si stored locally?
I'm also thinking about adding a button somewhere to allow the user to store his work when done, instead of on every change, but I couldn't find an option for this either.
Any Ideas welcome, I'm willing to contribute back to the plugin.
Best Christian