load list of voters in-place with ajax

This commit is contained in:
Shish 2013-07-06 10:42:06 +01:00
parent 48e40a6712
commit bc253eef04
2 changed files with 9 additions and 3 deletions

View File

@ -52,14 +52,15 @@ class NumericScore extends Extension {
$x = $database->get_all( $x = $database->get_all(
"SELECT users.name as username, user_id, score "SELECT users.name as username, user_id, score
FROM numeric_score_votes FROM numeric_score_votes
ORDER BY score
JOIN users ON numeric_score_votes.user_id=users.id JOIN users ON numeric_score_votes.user_id=users.id
WHERE image_id=?", WHERE image_id=?",
array($image_id)); array($image_id));
$html = "<table>"; $html = "<table style='width: 100%;'>";
foreach($x as $vote) { foreach($x as $vote) {
$html .= "<tr><td>"; $html .= "<tr><td>";
$html .= "<a href='".make_link("user/{$vote['username']}")."'>{$vote['username']}</a>"; $html .= "<a href='".make_link("user/{$vote['username']}")."'>{$vote['username']}</a>";
$html .= "</td><td>"; $html .= "</td><td width='10'>";
$html .= $vote['score']; $html .= $vote['score'];
$html .= "</td></tr>"; $html .= "</td></tr>";
} }

View File

@ -38,7 +38,12 @@ class NumericScoreTheme extends Themelet {
<input type='submit' value='Remove All Votes'> <input type='submit' value='Remove All Votes'>
</form> </form>
<br><a href='".make_link("numeric_score_votes/$i_image_id")."'>See All Votes</a> <br><div id='votes-content'>
<a
href='".make_link("numeric_score_votes/$i_image_id")."'
onclick='$(\"#votes-content\").load(\"".make_link("numeric_score_votes/$i_image_id")."\"); return false;'
>See All Votes</a>
</div>
"; ";
} }
return $html; return $html;