Максим Червонный (fiskus_boulder) wrote in changelog,
Максим Червонный
fiskus_boulder
changelog

[livejournal] r20648: LJSUP-10550: RTE - poll scrolling

Committer: mchervonniy
LJSUP-10550: RTE - poll scrolling
U   trunk/htdocs/js/ck/contents.css
U   trunk/htdocs/js/poll.js
Modified: trunk/htdocs/js/ck/contents.css
===================================================================
--- trunk/htdocs/js/ck/contents.css	2011-11-29 08:44:10 UTC (rev 20647)
+++ trunk/htdocs/js/ck/contents.css	2011-11-29 09:11:59 UTC (rev 20648)
@@ -80,10 +80,10 @@
 	height: 78px;
 	}
 .lj-poll {
-	width:100%;
 	border: #000 1px dotted;
 	background-color: #D2D2D2;
 	font-style: italic;
+	padding:0 1em;
 	}
 .lj-like-wrap {
 	height: 44px !important;
@@ -257,3 +257,22 @@
 	font-size: 12px;
 	color: #FF0000;
 	}
+
+.rte-poll-form {
+	font-size: 13px;
+	}
+	.lj-poll-close .rte-poll {
+		display: none;
+		}
+	.lj-poll-open .rte-poll {
+		display:block;
+		}
+		.rte-poll-form H1 {
+			font-size:15px;
+			}
+		.rte-poll-form H2 {
+			font-size:14px;
+			}
+		.rte-poll-form UL {
+			list-style:none;
+			}

Modified: trunk/htdocs/js/poll.js
===================================================================
--- trunk/htdocs/js/poll.js	2011-11-29 08:44:10 UTC (rev 20647)
+++ trunk/htdocs/js/poll.js	2011-11-29 09:11:59 UTC (rev 20648)
@@ -72,41 +72,43 @@
 
 // Poll method to generate HTML for RTE
 Poll.prototype.outputHTML = function(){
-	var html = '<form action="#"><b>Poll #xxxx</b>';
+	var html = '<form action="#" class="rte-poll-form"><h1>Poll #xxxx';
 
 	if(this.name){
 		html += ' <i>' + this.name + '</i>';
 	}
-	html += '<br />Open to: ' + '<b>' + this.whovote + '</b>, results viewable to: ' + '<b>' + this.whoview + '</b>';
+	html += '</h1><p>Open to: ' + '<b>' + this.whovote + '</b>, results viewable to: ' + '<b>' + this.whoview + '</b></p><div class="rte-poll">';
 	for(var i = 0; i < this.questions.length; i++){
-		html += '<br /><p>' + this.questions[i].name + '</p>';
+		html += '<h2>' + this.questions[i].name + '</h2>';
 		if(this.questions[i].type == 'radio' || this.questions[i].type == 'check'){
 			var type = this.questions[i].type == 'check' ? 'checkbox' : this.questions[i].type;
+			html += '<ul>';
 			for(var j = 0; j < this.questions[i].answers.length; j++){
-				html += '<input type="' + type + '">' + this.questions[i].answers[j] + '<br />';
+				html += '<li><input type="' + type + '">' + this.questions[i].answers[j] + '</li>';
 			}
+			html += '</ul>';
 		} else if(this.questions[i].type == 'drop'){
-			html += '<select name="select_' + i + '">' + '<option value=""></option>';
+			html += '<p><select name="select_' + i + '">' + '<option value=""></option>';
 			for(var j = 0; j < this.questions[i].answers.length; j++){
 				html += '<option value="">' + this.questions[i].answers[j] + '</option>';
 			}
-			html += '</select>';
+			html += '</select></p>';
 		} else if(this.questions[i].type == 'text'){
-			html += '<input maxlength="' + this.questions[i].maxlength + '" size="' + this.questions[i]
-				.size + '" type="text"/>';
+			html += '<p><input maxlength="' + this.questions[i].maxlength + '" size="' + this.questions[i]
+				.size + '" type="text"/></p>';
 		} else if(this.questions[i].type == 'scale'){
 			html += '<table><tbody><tr align="center" valign="top">';
 			var from = Number(this.questions[i].from),
 				to = Number(this.questions[i].to),
 				by = Number(this.questions[i].by);
 			for(var j = from; j <= to; j = j + by){
-				html += '<td><input type="radio"/><br />' + j + '</td>';
+				html += '<td><input type="radio" id=' + RTEPollScaleRadio + 'j/><br /><label for=RTEPollScaleRadio' + j + '>' + j + '</label></td>';
 			}
 			html += '</tr></tbody></table>';
 		}
 	}
 
-	html += '<input type="submit" value="Submit Poll"/></form>';
+	html += '</div><p><input type="submit" value="Submit Poll"/></p></form>';
 	return encodeURIComponent(html);
 };
 

Tags: css, fiskus_boulder, js, livejournal, mchervonniy
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments