hasadna/open-shot — pull request #348 by danielhers (2013-10-06 18:34:29+00:00)
Title: #225 show support/flag/delete buttons in question list

Refactored the HTML for the buttons and their Javascript code to
separate files which are included from both question_details and
question_list.

Added template tags for QA, providing filters for can_vote and
can_delete, so that we don't need to pass them from the view (otherwise
we would need to pass them for each question in the question list). The
exception is can_answer, which is still passed because we don't want to
show it at all in the question list (we pass False). We want the
candidates to view the whole question before replying. (Also, it would
be too messy with the controls otherwise).

Since I didn't want to duplicate the JS for each control, I use the question-
id attribute of the question-summary div which is the closest parent of
the control. Since we can't pass that to the Django template url
function, I used a small hack where I passed a "numeric" constant which
will never be used to the url function, and then replaced it in the JS
with the correct question ID.