r96676 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96675‎ | r96676 | r96677 >
Date:18:11, 9 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed select and radio controls in survey
Modified paths:
  • /trunk/extensions/Survey/resources/ext.survey.js (modified) (history)
  • /trunk/extensions/Survey/resources/jquery.survey.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/resources/jquery.survey.js
@@ -66,15 +66,27 @@
6767 } );
6868 break;
6969 case type.SELECT:
70 - $input = survey.htmlSelect( question.answers, 0, {
 70+ var answers = {};
 71+
 72+ for ( i in question.answers ) {
 73+ answers[question.answers[i]] = question.answers[i];
 74+ }
 75+
 76+ $input = survey.htmlSelect( answers, 0, {
7177 'id': id,
7278 'class': 'survey-question survey-select'
7379 } );
7480 break;
7581 case type.RADIO:
 82+ var answers = {};
 83+
 84+ for ( i in question.answers ) {
 85+ answers[question.answers[i]] = question.answers[i];
 86+ }
 87+
7688 $input = survey.htmlRadio(
77 - question.answers,
78 - 0,
 89+ answers,
 90+ null,
7991 id,
8092 {
8193 'id': id,
Index: trunk/extensions/Survey/resources/ext.survey.js
@@ -59,14 +59,18 @@
6060 $radio.html( '' );
6161
6262 for ( message in options ) {
63 - var value = options[message];
64 - var id = name + value;
 63+ var itemValue = options[message];
 64+ var id = name + itemValue;
6565
 66+// if ( value === null ) {
 67+// value = itemValue;
 68+// }
 69+
6670 $input = $( '<input />' ).attr( {
6771 'id': id,
6872 'type': 'radio',
6973 'name': name,
70 - 'value': value
 74+ 'value': itemValue
7175 } );
7276
7377 if ( value === options[message] ) {

Status & tagging log