plots2 icon indicating copy to clipboard operation
plots2 copied to clipboard

Planning issue for Wiki Discussion GSoC project

Open aspriya opened this issue 9 years ago • 22 comments

Why

Wiki pages are web pages that anyone can create or edit. PublicLab use them to collect information, documentation and instructions on projects. At present users can create wikis, edit them and associate tags with them. But users can not add comments to this, can not make suggestions, can not tag a user for a special part in the wiki. Wikis can made more interactive by implementing these features. For this I will use the publiclab/inline-markdown-editor.

Phase 1 - Commenting back-end

  • [x] (#1443) Write two functional tests to check if a wiki page is commentable and if the comment did not save, is there a error flash message appearing. These test names could be something like should create wiki comments and should show error if wiki comment not saved
  • [x] (#1444) make a unit test called should create comments for wiki pages

Phase 1.5 - Questions mini-project

  • [x] (#1453) Make a Question button which opens (in a new window) a form to post a question, using the extraButtons array.
    • plus a function which runs on the element (see documentation for inline-markdown-editor) to add an href to the button leading to /questions/new?tags=____ with some related tags.

Phase 2: Basic commenting interface

  • [x] Write tests to check new comments appear in HTML on a new wiki page Comments tab in a functional test in the comments controller
  • [x] Make Separate tab for Comments in wiki pages, using this comment list template from the notes views
  • [x] Add a form to add Comments at below of the comments tab using this template
  • [x] Create a function to remove comments by admin or moderators. (already exists here, so just confirm that the button works)
  • [x] see if email notifications on wiki page comments works - write a functional test based on this one: https://github.com/publiclab/plots2/blob/master/test/functional/comment_controller_test.rb#L244

Phase 3.1 - Inline commenting

  • [ ] Add a migration (like this example) to add a reference column in comments table. This is a string column which contains all the subsection string, and will update if a subsection was edited.
  • [ ] Add a setup function for comment button called setupCommentFunction()
  • [ ] Building a inline form for commenting using this template
  • [ ] Make the comment form submittable (ensure the JavaScript here works)
  • [ ] Add a comment button aside of the pencil button using extraButton property for inline-markdown-editor. it should be added to this method

Phase 3.2 - Suggestions

  • [ ] List suggestions when view suggestions button is clicked.
  • [ ] create two functions to approve and discard suggestions by a valid user.
  • [ ] Write tests to check the functionality of approval fucntion and discarding function.

Will keep updating this thread as and when things get clearer. Please feel free to provide feedbacks and suggestions.

aspriya avatar May 29 '17 18:05 aspriya

I'm thinking some rearranging could make sense so that we don't have to merge in a non-functional comment button before the commenting functionality is ready.

So, what's the first step in getting a commenting form to appear? Let's think through where we'd want to make the form (template here) appear.

Even before that, maybe we want to create a functional test of adding a comment to a wiki page. This could be a good project to break out and make a checklist out of. Comment controller is functionally tested here: https://github.com/publiclab/plots2/blob/master/test/functional/comment_controller_test.rb#L20-L30

Is there anything stopping us from making a comment attached to a wiki page instead of a note? Could we test that out in the comment controller functional test, as a first step?

(The above is copied in from here, but could be used to edit/revise the checklist above.)

Also - thanks for posting this checklist, it looks great!!! Very helpful.

jywarren avatar May 31 '17 02:05 jywarren

Also see how Make a table to store comments for a perticuler wiki page may already exist in the comment controller, since comments are attached to nodes and we may not have actually ever prevented them from being made on Wiki nodes, instead of just Note nodes?

jywarren avatar May 31 '17 02:05 jywarren

Let's break out the suggestions into its own phase -- that's a lot more complex than just comments, right?

Then let's have the first phase be backend Comments functionality, and the second be Commenting interface (that way the interface comes online only after the backend already works!).

How does that sound? Thanks!!!

jywarren avatar May 31 '17 02:05 jywarren

Wow thanks for you feedback @jywarren. Yes phases in that way seems more logical and accurate. Will rearachge the above check list and will start writing tests as you mentioned. Thanks again.

aspriya avatar May 31 '17 11:05 aspriya

Good note from #1443 -- (https://github.com/publiclab/plots2/pull/1444#discussion_r119707141) excerpted here:

I think adding regular comments to wiki pages, and making a comments tab to display them, is a good stepping stone on the way to inline comments. Then we can display all comments on the tab, with a later step of making an inline display of those comments that have reference to a specific section. (@aspriya, mayeb this is a really good step to add to your checklist!)

This also resolves one of the items in the checklist of using the same column for all comments. See how @ananyo2012 added an aid column to the comments table here: https://github.com/publiclab/plots2/blob/master/db/migrate/20160616035549_add_aid_to_comments.rb

You could do the same to add a reference to where the comment is supposed to be inserted. This migration could be its own step on the checklist. Would it be a string column containing the entire text of the subsection? And as a sub-checklist-item, would we need to change that reference each time the subsection text is edited, so we never loose track of where the comment is supposed to be inserted?

jywarren avatar Jun 01 '17 19:06 jywarren

I'd also like to suggest a 1.5 "mini phase" which could be:

  • [ ] make a Question button which opens (in a new window) a form to post a question, using the extraButtons array
    • plus a function which runs on the element (see documentation for inline-markdown-editor) to add an href to the button leading to /questions/new?tags=____ with some related tags.
    • We can insert the tags using <%= @wiki.tagnames %>, I think -- but let's try this one step at a time!

jywarren avatar Jun 01 '17 20:06 jywarren

If you can add the above "mini phase" in, that'd be great, also I'm adding some links to where relevant code can be found for some of the checklist above.

jywarren avatar Jun 02 '17 14:06 jywarren

Oh noooo! I was doing a big edit of the issue, adding links to relevant lines of code, but then lost it all when the page refreshed! Ughhhhh. Ok, will start over.

jywarren avatar Jun 02 '17 14:06 jywarren

Oh no! :face_with_head_bandage:

aspriya avatar Jun 02 '17 14:06 aspriya

learned my lesson yet again. I'm doing it in smaller chunks now and saving each time.

jywarren avatar Jun 02 '17 14:06 jywarren

Starting to think about documenting your plan not only for yourself and me, but for other people you could recruit to contribute, can you continue fleshing out links to relevant code and documentation in your checklist, trying to think about how it looks to a newcomer? For example, where you reference extraButtons, you might link to the corresponding docs in https://github.com/publiclab/inline-markdown-editor/

jywarren avatar Jun 02 '17 14:06 jywarren

OK! I finished rearranging a bit - even broke out a 2.5 section to separate basic commenting from inline commenting. This means you can tackle the project in smaller pieces and each phase leaves you with something working :-)

Make sense? If there are other places you can add links to code, please do, and perhaps help other students in GSoC organize their own projects a bit in this way!

jywarren avatar Jun 02 '17 16:06 jywarren

Sure, will do @jywarren , thanx a bunch!

aspriya avatar Jun 03 '17 02:06 aspriya

Marked 1.5 as done, great work! If #1453 is ready to merge, you're ready for Phase 2 :-)

jywarren avatar Jun 12 '17 23:06 jywarren

Also, i rearranged to put the test issue first in Phase 2, since it's also linked to the following item.

jywarren avatar Jun 12 '17 23:06 jywarren

Phase 2 will be fun since you'll be able to publish it to the live site pretty soon and ask people to try it out!

jywarren avatar Jun 12 '17 23:06 jywarren

Also added a bit on functional testing the email notifications for wiki comments :-)

jywarren avatar Jun 12 '17 23:06 jywarren

How are things going? I added another small request here: https://github.com/publiclab/inline-markdown-editor/issues/5 which will be a good intro to JavaScript testing too.

Then let's start with phase 2!!! Exciting!

jywarren avatar Jun 19 '17 16:06 jywarren

Now that you have good familiarity with these different systems, i think phase 2 will go quite quickly. Just remember to submit separate PRs for each checklist item!

jywarren avatar Jun 19 '17 16:06 jywarren

@aspriya So we have come the Last Phase of GSoC and the most important part of your Project which includes Inline comments and suggestions feature. I have modified your timeline so that it comes in Phase 3.1 and Phase 3.2. Think of how you can leverage the inline-markdown-editor to implement these features. Also there is an issue https://github.com/publiclab/plots2/issues/1554 where I have assigned you. Please have a look at that. Since this is a big work and may need many modifications I advice you to work in WIP PRs and regularly push your code so that we can quickly discuss all of these features as you work on your code.

ananyo2012 avatar Aug 01 '17 12:08 ananyo2012