Part of #2307
I have completed first 2 parts of #2307 and now for completing the third one, some insights are needed. Currently, the creation of new post takes place from "Publish" button which first validates data from PublicLab editor and then after formatting a Post request is sent to notes_controller.rb from dist/PublicLab.Editor.js. Now, here are the ways we can provide user, option to create a draft, we need to choose one of them:
After publishing the note, showing user notice that he can press the "Save as draft" button to store as draft. This button would be at https://publiclab.org/notes/gauravano/02-18-2018/gsoc-proposal-email-integration-project page.
Adding a button next to publish, which would go through all the procedure same as publish and then for publishing the draft separate flow needs to be designed.
Adding a checkbox near Publish button, which would require changes in /views/editor/rich.html.erb , an advantage of this method is we don't need to do any change in editor.(I vote for this ! )
Which option you consider appropriate @jywarren @ebarry ?
Curious to see what @jywarren and @ebarry say, and whether you think this issue might be a first-timer candidate.
I like Option 3 -- well thought through! I do think it could be a first-timer candidate... @Gauravano what extra things would we need to modify in the rich.html.erb template to make this possible? Would it simply add/remove a tag in the tag field when you click the checkbox? That seems plausible and keeps it all on the client side... what do you think?
We just need to add checkbox at right place on rich.html.erb and a JavaScript function which would be called when user clicks publish button. JS function would check if the box is marked or not and accordingly sends the status = 3 or 1 to the controller.
The follow-up of this, would be adding a button on research page to change status = 1 so that note would be visible publically. I have planned this, what do you think @jywarren?
Let's add the button on the post page to "final publish" first, then modify
the form after. That way nobody's note gets stuck as a draft.
I do like the idea of using the "draft" tag as a marker on note creation
instead of allowing user to set the status directly... which could be easy
to get wrong and allow bypassing spam controls if we aren't real careful.
Thinking ahead to when we maintain this code in the distant future!
So then we add a check for params[:tags].split(",").includes?("draft") --
in the notes controller, you know?
On Tue, Apr 24, 2018, 11:29 AM Gaurav Sachdeva notifications@github.com
wrote:
We just need to add checkbox at right place on rich.html.erb and a
JavaScript function which would be called when user clicks publish. JS
function would check if the box is marked or not and accordingly sends the
status = 3 or 1 to the controller.The follow-up of this, would be adding a button on research page to change
status = 1 so that note would be visible publically. I have planned this,
what do you think @jywarren https://github.com/jywarren?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/2594#issuecomment-383975168,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABfJ6dgTA5yofIBd8mh4fMDGB_Zegzwks5tr0SbgaJpZM4TLqaA
.
I am fine with using draft tag instead of status = 3 for the draft but then, we have to revert the work done as planned in #2307. Ok, we need to undo PR #2308 only.
Oops, no, don't do that! Sorry, i hadn't looked at this checklist for a while and forgot it was already implemented. But I also like the implementation you did -- using the params[:draft] as a boolean instead of directly setting params[:status]. So that addresses my worry too!
https://github.com/publiclab/plots2/pull/2308/files#diff-b9551b46e6321bfb977e1f52104c5768R114
Super, so the checkbox can be checked locally in JS, like this:
Would we add another data sub-parameter? I believe that's right, as in https://github.com/publiclab/PublicLab.Editor/#setup
Super, sorry for being out of sync! 😀 👍
hi @jywarren, I was thinking of passing draft= true via destination URL so that I don't have to play with editor's code. It would go something like this
destination: '/notes/create?rich=true' in constructor
and if checkbox is marked on submission then destination would be changed like this:-
var newDestination = editor.options.destination +"&draft=true"; in JS function
What do you think about this approach @jywarren ?
oh, that's a good idea! But when you click draft, we have to change it in
JavaScript, no? I think it'll take a little testing to be sure that it gets
set properly, but this is a good way forward. Leave a comment too though
explaining this!
On Tue, Apr 24, 2018 at 3:17 PM, Gaurav Sachdeva notifications@github.com
wrote:
hi @jywarren https://github.com/jywarren, I was thinking of passing
draft= true via destination URL so that I don't have to play with editor's
code. It would go something like thisdestination: '/notes/create?rich=true' in constructor
and if checkbox is marked on submission then destination would be changed
like this:-
var newDestination = editor.options.destination +"&draft=true";What do you think about this approach @jywarren
https://github.com/jywarren ?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/2594#issuecomment-384048440,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABfJ1QnjmCrk7_i4x2vRytywR9kEfNPks5tr3pHgaJpZM4TLqaA
.
@jywarren , I tried the method mentioned in docs too and that is solid one as URL can be little messing when comes to different types of nodes (question, research, etc)

So, Which one you find better @jywarren, I am ready for both ?
Opened in #2667