#4481 Add voting to tickets

v1.0.0
closed
nobody
General
Cory Johns
2015-08-20
2012-06-29
No

We want to provide functionality so we can adequately replace the Ideatorrent hosted app: https://sourceforge.net/apps/ideatorrent/sourceforge/

See also discussion at [79bed0f2].

  • create a VotableArtifact class (will be later used as a mixin with other artifact classes). It should have Fields for votes_up (int), votes_down (int), votes_up_users (list), votes_down_users (list), and methods vote_up and vote_down which require a User as an argument. You can only vote once, so changing your vote would remove it from the other list.
  • In ForgeTracker, make Ticket extend VotableArtifact also. We are not 100% sure how ming handles Fields from mixins, but it should work automatically. It does for single inheritance.
  • Include the votes_up_i and votes_down_i in the Ticket.index() method. Also add votes_total_i which is up - down. (The _i suffix makes them an int in solr schema). Document them in the tracker's search help text.
  • Make sure every time a vote occurs, the object is saved to solr. This can happen in either VotableArtifact or the Ticket class, whichever makes most sense.
  • Add a ForgeTracker admin option so that project admins can enable/disable voting on tickets.
  • If that is enabled for a tracker, any visitor with 'post' permission on a ticket should be able to click to vote up or down. However, a visitor must also be logged in (i.e. anonymous with 'post' access cannot vote).
  • The UI should look like http://screencast.com/t/T2rvuefPa6F See the notes for the HTML and CSS. If the user has already voted, the current vote should show up in red. (The appearance may end up somewhat different from the screenshot, since that is using our non-OSS theme)
  • Use AJAX to POST to a URL like /p/allura/tickets/1234/vote. Our CSRF protection will automatically be added to any html form (a _session_id hidden field), but you should make sure it is submitted with ajax too.
  • If voting is enabled for a tracker, show the votes_total field as a column in the ticket listing pages. You should be able to click on it to sort by it.

Related

Tickets: #4481

Discussion

  • Dave Brondsema

    Dave Brondsema - 2012-06-29

    Ideatorrent allows for multiple solutions to be proposed for each item. Each solution can be voted up and down. I don't see the need for us to allow multiple solutions, just voting.

     
  • Dave Brondsema

    Dave Brondsema - 2012-06-29
    • size: --> 4
     
  • Dave Brondsema

    Dave Brondsema - 2012-07-02
    • labels: hostedapps --> hostedapps, 42cc
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,13 @@
     We want to provide functionality so we can adequately replace the Ideatorrent hosted app: https://sourceforge.net/apps/ideatorrent/sourceforge/
    
    -See discussion at [79bed0f2].  Whatever approach is determined, it should be documented here.  I think it also needs to be a user-configurable option on each tracker.
    +See also discussion at [79bed0f2]. 
    +
    +* create a `VotableArtifact` class (will be later used as a mixin with other artifact classes).  It should have `Field`s for votes_up (int), votes_down (int), votes_up_users (list), votes_down_users (list), and methods `vote_up` and `vote_down` which require a User as an argument.  You can only vote once, so changing your vote would remove it from the other list.
    +* In ForgeTracker, make `Ticket` extend `VotableArtifact` also.  We are not 100% sure how ming handles Fields from mixins, but it should work automatically.  It does for single inheritance.
    +* Include the votes_up and votes_down in the `Ticket.index()` method.  Also add `votes_total` which is `up` - `down`.  Document them in the tracker's search help text.
    +* Make sure every time a vote occurs, the object is saved to solr.  This can happen in either VotableArtifact or the Ticket class, whichever makes most sense.
    +* Add a ForgeTracker admin option so that project admins can enable/disable voting on tickets.
    +* If that is enabled for a tracker, any visitor with 'post' permission on a ticket should be able to click to vote up or down.  However, a visitor must also be logged in (i.e. anonymous with 'post' access cannot vote).
    +* The UI should look like http://screencast.com/t/T2rvuefPa6F  See the notes for the HTML and CSS.  If the user has already voted, the current vote should show up in red.  (The appearance may end up somewhat different from the screenshot, since that is using our non-OSS theme)
    +* Use AJAX to POST to a URL like /p/allura/tickets/1234/vote.  Our CSRF protection will automatically be added to any html form (a _session_id hidden field), but you should make sure it is submitted with ajax too.
    +
    
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,10 +4,10 @@
    
     * create a `VotableArtifact` class (will be later used as a mixin with other artifact classes).  It should have `Field`s for votes_up (int), votes_down (int), votes_up_users (list), votes_down_users (list), and methods `vote_up` and `vote_down` which require a User as an argument.  You can only vote once, so changing your vote would remove it from the other list.
     * In ForgeTracker, make `Ticket` extend `VotableArtifact` also.  We are not 100% sure how ming handles Fields from mixins, but it should work automatically.  It does for single inheritance.
    -* Include the votes_up and votes_down in the `Ticket.index()` method.  Also add `votes_total` which is `up` - `down`.  Document them in the tracker's search help text.
    +* Include the votes_up_i and votes_down_i in the `Ticket.index()` method.  Also add `votes_total_i` which is `up` - `down`.  (The _i suffix makes them an int in solr schema). Document them in the tracker's search help text.
     * Make sure every time a vote occurs, the object is saved to solr.  This can happen in either VotableArtifact or the Ticket class, whichever makes most sense.
     * Add a ForgeTracker admin option so that project admins can enable/disable voting on tickets.
     * If that is enabled for a tracker, any visitor with 'post' permission on a ticket should be able to click to vote up or down.  However, a visitor must also be logged in (i.e. anonymous with 'post' access cannot vote).
     * The UI should look like http://screencast.com/t/T2rvuefPa6F  See the notes for the HTML and CSS.  If the user has already voted, the current vote should show up in red.  (The appearance may end up somewhat different from the screenshot, since that is using our non-OSS theme)
     * Use AJAX to POST to a URL like /p/allura/tickets/1234/vote.  Our CSRF protection will automatically be added to any html form (a _session_id hidden field), but you should make sure it is submitted with ajax too.
    -
    +* If voting is enabled for a tracker, show the `votes_total` field as a column in the ticket listing pages.  You should be able to click on it to sort by it.
    
     
  • Yaroslav Luzin - 2012-07-03

    Created the following tickets:
    - #99: [#4481] Create VotableArtifact mixin and apply it to Ticket (2cp)
    - #100: [#4481] Create UI and implement voting (3cp)
    - #101: [#4481] Add votes to solr index (1cp)
    - #102: [#4481] Add ForgeTracker admin option to enable/disable voting on tickets (1cp)
    - #103: [#4481] Show the votes_total in the ticket listing page as a column. Make column sortable (1cp)

    Total: 8cp

    • status: open --> in-progress
     

    Related

    Tickets: #4481

  • Yaroslav Luzin - 2012-07-05

    Branch: 42cc_4481

     
  • Igor Bondarenko - 2012-07-05

    I'm working on UI right now. Where can I get icons for up and down arrows?

     
  • Dave Brondsema

    Dave Brondsema - 2012-07-05

    The HTML I used for the mockup only works with our internal theme. I didn't realize that. So instead of using icons, lets use unicode arrows. That'll work everywhere. Pick a pair of up & down arrows from http://www.alanwood.net/unicode/arrows.html that look good.

     
  • Yaroslav Luzin - 2012-07-06

    closed #99 and #100

     
  • Yaroslav Luzin - 2012-07-06

    closed #101

     
  • Yaroslav Luzin - 2012-07-06

    closed #102

     
  • Yaroslav Luzin - 2012-07-10

    closed #103

     
  • Yaroslav Luzin - 2012-07-10

    All changes are in 42cc_4481 branch

     
  • Yaroslav Luzin - 2012-07-10
    • status: in-progress --> code-review
     
  • Dave Brondsema

    Dave Brondsema - 2012-07-10
    • qa: Cory Johns
     
  • Dave Brondsema

    Dave Brondsema - 2012-07-13
    • size: 4 --> 0
    • milestone: forge-jul-27 --> forge-backlog
     
  • Cory Johns - 2012-07-17
    • status: code-review --> closed
     
  • Dave Brondsema

    Dave Brondsema - 2012-07-18
    • milestone: forge-backlog --> forge-jul-27
     

Log in to post a comment.