diff --git a/helios/media/static_templates/question.html b/helios/media/static_templates/question.html index 5e576916dda5208f93c7dff0198014b95994405a..15b3882530a331e78165c33d0ff078b08d038cf5 100644 --- a/helios/media/static_templates/question.html +++ b/helios/media/static_templates/question.html @@ -4,7 +4,7 @@ <h4> {#if $T.admin_p}[ {#if $T.question$index > 0}<a href="javascript:question_move_up({$T.question$index});">^</a>] [{#/if} -<a onclick="return confirm('Are you sure you want to remove this question?');" href="javascript:question_remove({$T.question$index})">x</a>] [<a href="javascript:question_edit({$T.question$index})">edit</a>] {#/if}{$T.question$index + 1}. {$T.question.question} ({$T.question.choice_type}, select between {$T.question.min} and {#if $T.question.max != null}{$T.question.max}{#else}unlimited{#/if} answers, result type {$T.question.result_type}.)</h4> +<a onclick="return confirm('Are you sure you want to remove this question?');" href="javascript:question_remove({$T.question$index})">x</a>] [<a href="javascript:question_edit({$T.question$index})">edit</a>] {#/if}{$T.question$index + 1}. {$T.question.question} ({$T.question.choice_type}, select between {$T.question.min} and {#if $T.question.max != null}{$T.question.max}{#else}unlimited{#/if} answers, result type {$T.question.result_type}{#if $T.question.randomize_answer_order}, random answer order{#/if}.)</h4> <ul> {#foreach $T.question.answers as answer} <li> {$T.answer} @@ -55,6 +55,13 @@ Result Type: <option>relative</option> </select> + + +Random Answer Order: +<select name="randomize_answer_order"> + <option selected value="0">no</option> + <option value="1">yes</option> +</select> </p> <table id="answer_table_{$T.question$index}"> @@ -115,6 +122,15 @@ Result Type: <option>relative</option> </select> + + +Random Answer Order: +<select name="randomize_answer_order"> + <option selected value="0">no</option> + <option value="1">yes</option> +</select> +</p> + </p> <table id="answer_table" style="width:100%;"> diff --git a/helios/templates/election_questions.html b/helios/templates/election_questions.html index 468c65ecf751335f11968aabc5f2e0e9dd8a45d8..c721c8a349535b7c2f11e362953910e9cc535152 100644 --- a/helios/templates/election_questions.html +++ b/helios/templates/election_questions.html @@ -39,7 +39,7 @@ if (form.max.value != "") max = parseInt(form.max.value); - var new_q = {'question' : form.question.value, 'min': parseInt(form.min.value), 'max': max, 'short_name': form.question.value, 'answers': [], 'answer_urls': [], 'choice_type': form.choice_type.value, 'tally_type': 'homomorphic', 'result_type': form.result_type.value}; + var new_q = {'question' : form.question.value, 'min': parseInt(form.min.value), 'max': max, 'short_name': form.question.value, 'answers': [], 'answer_urls': [], 'choice_type': form.choice_type.value, 'tally_type': 'homomorphic', 'result_type': form.result_type.value, 'randomize_answer_order': form.randomize_answer_order.value == "1"}; var i = 0; while(true) { i += 1; @@ -86,6 +86,7 @@ form[0].max.value = q_data.max; form[0].question.value = q_data.question; form[0].result_type.value = q_data.result_type; + form[0].randomize_answer_order.value = q_data.randomize_answer_order ? "1" : "0"; // add the answers var answer_table = $('#answer_table_' + q_num); diff --git a/heliosbooth/vote.html b/heliosbooth/vote.html index 3f42230fbca5471f9289733cc99b9c8b03327f10..f4135133a7839742a3d2278a11beac559ea47e65 100644 --- a/heliosbooth/vote.html +++ b/heliosbooth/vote.html @@ -190,8 +190,8 @@ BOOTH.setup_election = function(raw_json, election_metadata) { // initialize array so it is the identity permutation $(ordering).each(function(j, answer) {ordering[j]=j;}); - // if we want reordering, then we shuffle the array - if (election_metadata && election_metadata.randomize_answer_order) { + // if we want reordering, at election or question level, then we shuffle the array + if ((election_metadata && election_metadata.randomize_answer_order) || question.randomize_answer_order) { shuffleArray(ordering); }