Transfer Draft Work to Client
I was looking for something completely different from what is described in this article but when I saw it, I immediately had to think of Vanillas drafts.
The article introduces a javascript library that saves form input into local storage. That way, it could be restored later if a page accidentally closes. As far as I've understood, that is what Drafts in Vanilla are good for. So Vanilla implemented it on the server and the script in the article uses the local storage.
Storing on the server costs a transfer via ajax and a database call. But the advantage is that drafts you've worked on from work could be finished at home - they are not bound to one pc.
If it would be solved with a local storage the advantage of the currently implemented way would be lost. I personally wouldn't miss it but instead would like to see the advantage of not querying the db and transferring data each X minutes.
Moreover I wouldn't miss the menu entry "Drafts".
What do you think about that?
Comments
Oh, just found that discussion: http://vanillaforums.org/discussion/comment/164629/#Comment_164629
I implemented something like that in the Yaga Badge administration screen. I save the input data to the form whenever a rules change is requested.
You can checkout the relevant JS here (it isn't pretty): https://github.com/hgtonight/Application-Yaga/blob/master/js/admin.badges.js#L24
It was a lot easier than I was initially expecting.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I do not know enough js to understand that code completely, but for me it seems as if your data is cached with an ajax query, isn't it? If so it is not the same as I was speaking about. HTML5 offers the local storage that uses the clients harddisk. Using that for drafts would completely eliminate the need for a connection to the server while writing. Sometimes there appear error messages when connection is lost and I guess it is because of the autosave feature.
Actually, I misread your post. The code I linked does not use the local storage feature of HTML5.
I just save any form data to the form markup as the default value before I save the form to cache.
Reading up on local storage, that sounds dead easy to use (detect if the browser has it and use
localStorage.getItem()
andlocalStorage.setItem()
).Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
This is much fewer feedback and discussion than I've expected, but maybe that plugin will be nevertheless interesting: http://vanillaforums.org/addon/localdrafts-plugin
Here is an icon for that @R_J
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
The addon applications needs a function to import icons right from out of discussions