r95612 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95611‎ | r95612 | r95613 >
Date:22:35, 27 August 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
some work on survey js
Modified paths:
  • /trunk/extensions/Survey/resources/jquery.survey.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/resources/jquery.survey.js
@@ -36,13 +36,43 @@
3737 };
3838
3939 this.submitSurvey = function() {
 40+ // TODO
 41+ };
 42+
 43+ this.getSurveyQuestion = function( question ) {
 44+ return ''; // TODO
 45+ };
 46+
 47+ this.getSurveyQuestions = function( questions ) {
 48+ $questions = $( '<div />' );
4049
 50+ for ( i in questions ) {
 51+ $questions.append( this.getSurveyQuestion( questions[i] ) );
 52+ }
 53+
 54+ return $questions;
4155 };
4256
 57+ this.getSurveyBody = function( surveyData ) {
 58+ $survey = $( '<div />' );
 59+
 60+ $survey.append( this.getSurveyQuestions( surveyData.questions ) );
 61+
 62+ $survey.append( JSON.stringify( surveyData ) );
 63+
 64+ return $survey;
 65+ };
 66+
4367 this.initSurvey = function( surveyElement, surveyData ) {
44 - // TODO
45 - $div = $( '<div />' ).attr( { 'style': 'display:none' } ).html( $( '<div />' ).attr( { 'id': 'data' } ).html( JSON.stringify( surveyData ) ) );
46 - $link = $( '<a />' ).attr( { 'href': '#data', 'id': 'inline' } ).html( $div ).append( $('<p />') );
 68+ $div = $( '<div />' ).attr( {
 69+ 'style': 'display:none'
 70+ } ).html( $( '<div />' ).attr( { 'id': 'survey-' + surveyData.id } ).html( this.getSurveyBody( surveyData ) ) );
 71+
 72+ $link = $( '<a />' ).attr( {
 73+ 'href': '#survey-' + surveyData.id,
 74+ 'id': 'inline'
 75+ } ).html( $div );
 76+
4777 surveyElement.html( $link );
4878 $link.fancybox();
4979 $link.click();

Status & tagging log