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 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_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.
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.
Diff:
Diff:
Created the following tickets:
- #99: [#4481] Create
VotableArtifact
mixin and apply it toTicket
(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
Related
Tickets:
#4481Branch: 42cc_4481
I'm working on UI right now. Where can I get icons for up and down arrows?
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.
closed #99 and #100
closed #101
closed #102
closed #103
All changes are in 42cc_4481 branch