add_poll_form

NAML documentation   Watch a video
   Usages of this macro
The source code below doesn't have navigation links because no usage has been compiled yet. Navigation links depend on how and where the macro is used, so first you may try finding all usages of "add_poll_form".
... in poll.naml
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<macro name="add_poll_form" requires="node_page">
    <script type="text/javascript">
        function addPoll() {
            $('#poll').show();
            if ( $('#poll-options div').size() == 0 ) {
                addOption(false);
                addOption(false);
            } else
                updateOptions();
            Nabble.resizeFrames();
        };
        function removeOption(e) {
            $(e).parent().remove();
            updateOptions();
            Nabble.resizeFrames();
        };
        function addOption(focus) {
            $('#poll-options').append('<n.javascript_string_encode.poll_option_input_row/>');
            updateOptions();
            if (focus)
                $('#poll-options div input').last().focus();
            Nabble.resizeFrames();
        };
        function updateOptions() {
            var c = 1;
            $('#poll-options div').each(function() {
                $('a,span', this).remove();
                $(this).prepend('<span>'+c+'.</span>');
                if (c++ > 2) {
                    $(this).append('<a class="removeOption" href="javascript:void(0)" onclick="removeOption(this)"><t>remove</t></a>');
                }
            });
        };
        function removePoll() {
            $('input[name=poll_question]').val('');
            $('#poll').hide();
        };
        <n.if.not.is_empty.poll_question_field.value>
            <then>
                $(document).ready(function() {
                    updateOptions();
                });
            </then>
        </n.if.not.is_empty.poll_question_field.value>
    </script>
    <a href="javascript: void(0)" onclick="addPoll()"><t>Add new poll</t></a>
 
    <div id="poll" class="extra-field-details medium-border-color" style="[n.if.is_empty.poll_question_field.value][then]display:none[/then][/n.if.is_empty.poll_question_field.value]">
        <table>
            <tr valign="top">
                <td style="text-align:right;padding-top:.4em"><t>Question:</t></td>
                <td style="padding-left:1.8em"><n.poll_question_field.input type="text" size="40"/></td>
            </tr>
            <tr valign="top">
                <td style="text-align:right;padding-top:.4em"><t>Answers:</t></td>
                <td style="padding-left:.7em">
                    <div id="poll-options" style="padding-bottom:.3em">
                        <n.get_parameter_values. name="poll_option">
                            <n.loop.poll_option_input_row.current_parameter_value/>
                        </n.get_parameter_values.>
                    </div>
                    <a href="javascript: void addOption(true)"><t>Add new answer</t></a>
                </td>
            </tr>
        </table>
        <n.poll_settings/>
        <a href="javascript: void(0)" onclick="removePoll()"><t>Remove Poll</t></a>
    </div>
</macro>