Article feedback/Version 5/Technical Design

Massively a work-in-progress. More of a loose notes page than anything else.

= Technical design =

Overview

 * 1) The "leave feedback" widgets
 * 2) various form elements (text area, rating widgets, feedback type radios, etc) are included or not, which can probably be handled within the same function ($.articleFeedback in modules/jquery.articleFeedback/jquery.articleFeedback.js) that renders the current one, with some logic added, based on the "buckets" as defined in the requirements, and given some CSS class or another to handle the different visual looks. Buckets are based on IP address, and it's fine to hard-code them, rather than use the database. It's a little too hard-coded at the moment, and I'm pretty sure I'd rather it be in PHP than JS, but that might not make sense, it's just opinion/preference.
 * 3) backend to save the data above, and frontend to pre-populate the feedback form with a user's previous feedback (assuming we have a user, and that user has previous feedback)
 * 4) Calls To Action - markup may well end up hard-coded in the JS, just stuffed into an array or something, and we just select a random key.
 * 5) The "view feedback" page
 * 6) moderation tools - hide, promote (to talk page), or flag various pieces of feedback.
 * 7) sorting and filtering options - good comments first (how that's defined is unclear), newest first - basically tools to hide the inevitable flood of spam "feedback"
 * 8) A special page, on the level of the talk pages - add a link to this in the not-quite-top-level navigation on said talk page.
 * 9) Need to work out which bits of this page are must-have-now vs must-have-eventually.
 * 10) Phase 1 will have a limited version with:
 * 11) Filters: All, Visible
 * 12) Moderation Tools: Hide this comment
 * 13) Sorting: By date only
 * 14) Pagination: Fixed at 50
 * 15) DB changes
 * 16) create article_feedback_buckets (name, id) table, with FKey in article_feedback.bucket
 * 17) alter table article_feedback drop columns aa_rating_id, aa_rating_value, add columns for created and modified timestamps
 * 18) create table article_ratings (article_feedback_aa_id (FKEY), rating_id, rating_value)  - (42, x, 4), (42, y, 2)

Page Flow

 * 1) (on pageload) - js to make aajx call to render form in enpty div or something
 * 2) php determines which option to render, returns HTML as well as which option is being rendered
 * 3) js sets up event binds etc on html
 * 4) form submits, jspacks and makes ajax request to php api.
 * 5) php saves data, determines which CTA to return, renders it, returns CTA HTML