5 If you like this answer you can award {{ awarded_user }} with reputation points.
11 Use the slider below or the input field to choose the amount of points you would like to give.
17 <td width="50%">{% trans "Points:" %}</td>
18 <td width="50%"><input type="text" name="points" id="points_input" value="1" style="border: 1px solid #ccc; padding: 1px 2px;" /></td>
22 <div class="award_points_slider"></div>
25 var awardPointsNotified = false;
26 var reputation_to_comment = {{ reputation_to_comment }};
27 var user_reputation = {{ user.reputation }};
29 function points_award_confirm(reputation, event) {
30 var message = '<div style="max-width: 300px !important; text-align: left;">';
31 message += "{% blocktrans %}Your karma points will be below the minimum reputation to comment. Are you sure you want to award points?{% endblocktrans %}";
34 if ((user_reputation - reputation) < reputation_to_comment && !awardPointsNotified) {
35 awardPointsNotified = true;
39 extra_class: 'confirm',
40 yes_text: messages.yes,
42 no_callback: function() {
43 $(".dialog").fadeOut("fast", function() {
44 $('.dialog').remove();
51 doptions.event = event;
52 show_dialog(doptions);
56 $('.award_points_slider').slider({
57 min: 1, max: user_reputation,
58 slide: function(evt, ui) {
59 $('#points_input').val(ui.value);
60 points_award_confirm(Number(ui.value), evt)
64 $('#points_input').live('change keyup', function(evt) {
65 if ($(this).val() > user_reputation) {
66 $(this).attr('value', user_reputation);
69 points_award_confirm(Number($(this).val()), evt);
71 $('.award_points_slider').slider('option', 'value', $(this).val());