... | in poll_js.naml |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
<override_macro name="poll_js" requires="servlet">
<n.comment.>
This is the javascript code that will update the poll controls and make them available to the users.
</n.comment.>
<n.param_loop. param="poll_node_id">
<n.get_node_from_id. node_id="[n.current_parameter_value/]">
<n.set_local_node.this_node />
<n.if.visitor.is_registered>
<then>
<n.poll_option_list.loop.>
var input = '<n.local_node.poll_vote_input_field field_id="option[n.option_id/]" index="[n.current_index/]"/>';
$('#poll-option-input<n.option_id/>').html(input);
</n.poll_option_list.loop.>
<n.if.poll_has_ended>
<then>
var input = '<t>This poll is closed.</t>';
</then>
<else>
var txt_vote = "<t>Vote</t>";
var input = '<input type="submit" value="' + txt_vote + '"/>';
if (!<n.visitor.can_create_poll_in.page_node/>)
input = '<input type="submit" value="' + txt_vote + '" disabled="true"/>';
</else>
</n.if.poll_has_ended>
$('#poll-submit-button<n.id/>').html(input);
</then>
</n.if.visitor.is_registered>
<n.if.poll_visitor_can_see_votes>
<then>
var total_votes = 0;
<n.poll_vote_counts.loop.>
var text = <n.current_string/> == 1? '(<t>1 vote</t>)' : '(<t><t.number.current_string/> votes</t>)';
$('#poll-vote-count<n.option_id/>').html(text);
total_votes += <n.current_string/>;
</n.poll_vote_counts.loop.>
var text = '<t>Total votes:</t> ' + total_votes;
$('#poll-total-votes<n.local_node.id/>').html(text).show();
</then>
</n.if.poll_visitor_can_see_votes>
</n.get_node_from_id.>
</n.param_loop.>
</override_macro>
|
... | in poll.naml |
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
|
<macro name="poll_js" requires="servlet">
<n.comment.>
This is the javascript code that will update the poll controls and make them available to the users.
</n.comment.>
<n.param_loop. param="poll_node_id">
<n.get_node_from_id. node_id="[n.current_parameter_value/]">
<n.set_local_node.this_node />
<n.if.visitor.is_registered>
<then>
<n.poll_option_list.loop.>
var input = '<n.local_node.poll_vote_input_field field_id="option[n.option_id/]" index="[n.current_index/]"/>';
$('#poll-option-input<n.option_id/>').html(input);
</n.poll_option_list.loop.>
<n.if.poll_has_ended>
<then>
var input = '<t>This poll is closed.</t>';
</then>
<else>
var txt_vote = "<t>Vote</t>";
var input = '<input type="submit" value="' + txt_vote + '"/>';
if (!<n.poll_visitor_can_vote/>)
input = '<input type="submit" value="' + txt_vote + '" disabled="true"/>';
</else>
</n.if.poll_has_ended>
$('#poll-submit-button<n.id/>').html(input);
</then>
</n.if.visitor.is_registered>
<n.if.poll_visitor_can_see_votes>
<then>
var total_votes = 0;
<n.poll_vote_counts.loop.>
var text = <n.current_string/> == 1? '(<t>1 vote</t>)' : '(<t><t.number.current_string/> votes</t>)';
$('#poll-vote-count<n.option_id/>').html(text);
total_votes += <n.current_string/>;
</n.poll_vote_counts.loop.>
var text = '<t>Total votes:</t> ' + total_votes;
$('#poll-total-votes<n.local_node.id/>').html(text).show();
</then>
</n.if.poll_visitor_can_see_votes>
</n.get_node_from_id.>
</n.param_loop.>
</macro>
|
Free forum by Nabble | Naml |