r103348 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103347‎ | r103348 | r103349 >
Date:18:42, 16 November 2011
Author:rsterbin
Status:deferred (Comments)
Tags:
Comment:
Text to translateable messages; revised buildLink method in jquery plugin; tooltip hover works
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -30,14 +30,23 @@
3131 'articlefeedbackv5-survey-disclaimerlink' => 'terms',
3232 /* ext.articleFeedbackv5 and jquery.articleFeedbackv5 */
3333 /* START Messages needing translation */
34 - 'articlefeedbackv5-bucket1-title' => 'Help improve this article',
 34+ 'articlefeedbackv5-bucket1-title' => 'What do $1 think?',
 35+ 'articlefeedbackv5-bucket1-title-emphasis' => 'you',
 36+ 'articlefeedbackv5-bucket1-tooltip-title' => 'What is This?',
 37+ 'articlefeedbackv5-bucket1-tooltip-info' => 'Wikipedia\'s new Article Feedback system is designed to help you help us. We need your input to make Wikipedia the best encyclopedia in the world.',
 38+ 'articlefeedbackv5-bucket1-tooltip-linktext' => 'Learn more about Article Feedback',
3539 'articlefeedbackv5-bucket1-question-toggle' => 'Did you find what you were looking for?',
3640 'articlefeedbackv5-bucket1-toggle-found-yes' => 'Yes',
3741 'articlefeedbackv5-bucket1-toggle-found-no' => 'No',
 42+ 'articlefeedbackv5-bucket1-toggle-found-yes-full' => 'Yes, I found what I was looking for.',
 43+ 'articlefeedbackv5-bucket1-toggle-found-no-full' => 'No, I did not find what I was looking for.',
3844 'articlefeedbackv5-bucket1-question-comment' => 'What\'s missing? Any suggestions for improvement?',
 45+ 'articlefeedbackv5-bucket1-disclosure' => 'Your Feedback will be shared $1. Seee our $2 for more details.',
 46+ 'articlefeedbackv5-bucket1-disclosure-shared-linktext' => 'here',
 47+ 'articlefeedbackv5-bucket1-disclosure-privacy-policy-linktext' => 'privacy policy',
3948 'articlefeedbackv5-bucket1-form-pending' => 'Your feedback has not been submitted yet',
4049 'articlefeedbackv5-bucket5-form-success' => 'Saved successfully',
41 - 'articlefeedbackv5-bucket1-form-submit' => 'Post Your Feedback',
 50+ 'articlefeedbackv5-bucket1-form-submit' => 'Submit Your Feedback',
4251 'articlefeedbackv5-shared-on-feedback' => 'Your comment will be shared on this $1.',
4352 'articlefeedbackv5-shared-on-feedback-linktext' => 'feedback page',
4453 'articlefeedbackv5-transparency-terms' => 'By posting, you agree to transparency under these $1.',
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -131,70 +131,82 @@
132132 // The overall template
133133 var block_tpl = '\
134134 <form>\
135 - <div class="title-wrap">\
136 - <h2>What do <em>you</em> think?</h2>\
137 - <a class="trigger">&nbsp;</a>\
138 - <script type="text/javascript" language="javascript">\
139 - $(".articleFeedback a.trigger").tooltip();\
140 - </script>\
141 - <div class="tooltip">\
 135+ <div class="title-wrap">\
 136+ <h2 class="articleFeedbackv5-title"></h2>\
 137+ <a class="articleFeedbackv5-tooltip-trigger">?</a>\
 138+ <div class="articleFeedbackv5-tooltip">\
142139 <div class="tooltip-top"></div>\
143140 <div class="tooltip-repeat">\
144 - <h3>What is This?</h3>\
145 - <p>Wikipedia’s new Article Feedback system is designed to help you help us. We need your input to make Wikipedia the best encyclopedia in the world.</p>\
146 - <p><a target="_blank" href="#">Learn more about Article Feedback</a></p>\
 141+ <h3><html:msg key="bucket1-tooltip-title" /></h3>\
 142+ <p><html:msg key="bucket1-tooltip-info" /></p>\
 143+ <p><a target="_blank" href="#"><html:msg key="bucket1-tooltip-linktext" /></a></p>\
147144 </div>\
148145 <div class="tooltip-bottom"></div>\
149146 </div>\
150147 <div class="clear"></div>\
151148 </div>\
152149 <div class="form-row">\
153 - <p class="instructions-left">Did you find what you were looking for?</p>\
 150+ <p class="instructions-left"><html:msg key="bucket1-question-toggle" /></p>\
154151 <div class="buttons">\
155152 <div class="form-item">\
156 - <label for="find-yes">Yes, I found what I was looking for.</label>\
157 - <span class="button-placeholder">Yes</span>\
158 - <input type="radio" name="find" id="find-yes" class="query-button" />\
 153+ <label for="find-yes"><html:msg key="bucket1-toggle-found-yes-full" /></label>\
 154+ <span class="button-placeholder"><html:msg key="bucket1-toggle-found-yes" /></span>\
 155+ <input type="radio" name="toggle" id="find-yes" class="query-button" />\
159156 </div>\
160157 <div class="form-item">\
161 - <label for="find-no">No, I did not find what I was looking for.</label>\
162 - <span class="button-placeholder">No.</span>\
163 - <input type="radio" id="find-now" class="query-button last" />\
 158+ <label for="find-no"><html:msg key="bucket1-toggle-found-no-full" /></label>\
 159+ <span class="button-placeholder"><html:msg key="bucket1-toggle-found-no" /></span>\
 160+ <input type="radio" name="toggle" id="find-no" class="query-button last" />\
164161 </div>\
165162 <div class="clear"></div>\
166163 </div>\
167164 </div>\
168 - <textarea id="find-feedback" class="feedback-text">How can we improve this Article?</textarea>\
169 - <div class="articleFeedback-disclosure">\
170 - <p>Your Feedback will be shared <a href="#" target="_blank">here</a>. Seee our <a target="_blank" href="#">privacy policy</a> for more details.</p>\
 165+ <div class="articleFeedbackv5-comment">\
 166+ <textarea id="find-feedback" class="feedback-text" name="comment"></textarea>\
171167 </div>\
172 - <button class="articleFeedback-submit articleFeedback-visibleWith-form ui-button ui-widget ui-state-default ui-corner-all ui-button-disabled ui-state-disabled ui-button-text-only ui-button-blue" type="submit" disabled="disabled" role="button" aria-disabled="true"><span class="ui-button-text">Submit Your Feedback</span></button>\
 168+ <div class="articleFeedbackv5-disclosure">\
 169+ <p></p>\
 170+ </div>\
 171+ <button class="articleFeedbackv5-submit" type="submit" disabled="disabled"><html:msg key="bucket1-form-submit" /></button>\
173172 <div class="clear"></div>\
174173 </form>\
175174 ';
176175 // Start up the block to return
177176 var $block = $( block_tpl );
178177
 178+ // Set the title with emphasis
 179+ $block.find('.articleFeedbackv5-title').
 180+ html( function () {
 181+ var em = mw.html.element( 'em', {}, mw.msg( 'articlefeedbackv5-bucket1-title-emphasis' ) );
 182+ return mw.html.escape( mw.msg( 'articlefeedbackv5-bucket1-title' ) )
 183+ .replace( /\$1/, em.toString() );
 184+ } );
 185+
 186+ // Start out the tooltip hidden
 187+ $block.find( '.articleFeedbackv5-tooltip' ).hide();
 188+
179189 // Set the default comment text
180190 $block.find( '.articleFeedbackv5-comment textarea' )
181191 .val( mw.msg( 'articlefeedbackv5-bucket1-question-comment' ) );
182192
183 - // Fill in the feedback and terms info text
184 - $block.find( '.articleFeedbackv5-feedback-terms-info .articleFeedbackv5-feedback' )
 193+ // Fill in the disclosure text
 194+ $block.find( '.articleFeedbackv5-disclosure p' )
185195 .html( $.articleFeedbackv5.buildLink(
186 - mw.config.get( 'wgScript' ) + '?' + $.param( {
187 - 'title': mw.config.get( 'wgPageName' ),
188 - 'action': 'feedback'
189 - } ),
190 - 'articlefeedbackv5-shared-on-feedback-linktext',
191 - 'articlefeedbackv5-shared-on-feedback'
 196+ 'articlefeedbackv5-bucket1-disclosure',
 197+ {
 198+ href: mw.config.get( 'wgScript' ) + '?' + $.param( {
 199+ title: mw.config.get( 'wgPageName' ),
 200+ action: 'feedback'
 201+ } ),
 202+ text: 'articlefeedbackv5-bucket1-disclosure-shared-linktext',
 203+ target: '_blank'
 204+ },
 205+ {
 206+ href: mw.util.wikiGetlink( mw.config.get( 'wgArticleFeedbackv5TermsPage' ) ),
 207+ text: 'articlefeedbackv5-bucket1-disclosure-privacy-policy-linktext',
 208+ target: '_blank'
 209+ }
192210 ) );
193 - $block.find( '.articleFeedbackv5-feedback-terms-info .articleFeedbackv5-terms' )
194 - .html( $.articleFeedbackv5.buildLink(
195 - mw.util.wikiGetlink( mw.config.get( 'wgArticleFeedbackv5TermsPage' ) ), // TODO: Make this work
196 - 'articlefeedbackv5-transparency-terms-linktext',
197 - 'articlefeedbackv5-transparency-terms'
198 - ) );
199211
200212 // Localize the block
201213 $block.localize( { 'prefix': 'articlefeedbackv5-' } );
@@ -216,6 +228,15 @@
217229 * @param $block element the form block
218230 */
219231 bindEvents: function ( $block ) {
 232+
 233+ $block.find( '.articleFeedbackv5-tooltip-trigger' ).hover( function () {
 234+ // mouse on
 235+ $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-tooltip' ).show();
 236+ }, function () {
 237+ // mouse off
 238+ $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-tooltip' ).hide();
 239+ } );
 240+
220241 // Clear out the question on focus
221242 $block.find( '.articleFeedbackv5-comment textarea' )
222243 .focus( function () {
@@ -476,9 +497,11 @@
477498 // Fill in the Help Improve message and links
478499 $block.find( '.articleFeedbackv5-helpimprove-note' )
479500 .html( $.articleFeedbackv5.buildLink(
480 - mw.util.wikiGetlink( mw.config.get( 'wgArticleFeedbackv5TermsPage' ) ), // TODO: Make this work
481 - 'articlefeedbackv5-bucket5-form-panel-helpimprove-privacy',
482 - 'articlefeedbackv5-bucket5-form-panel-helpimprove-note'
 501+ 'articlefeedbackv5-bucket5-form-panel-helpimprove-note',
 502+ {
 503+ href: mw.util.wikiGetlink( mw.config.get( 'wgArticleFeedbackv5TermsPage' ) ), // TODO: Make this work
 504+ text: 'articlefeedbackv5-bucket5-form-panel-helpimprove-privacy'
 505+ }
483506 ) );
484507
485508 $block.find( '.articleFeedbackv5-helpimprove-email' )
@@ -1161,15 +1184,32 @@
11621185 * Can't use .text() with mw.message(, \/* $1 *\/ link).toString(),
11631186 * because 'link' should not be re-escaped (which would happen if done by mw.message)
11641187 *
1165 - * @param string href the link
1166 - * @param string linktext the message key for the link text
11671188 * @param string fulltext the message key for the full text
 1189+ * @param object link1 the first link, as { href: '#', text: 'click here' }
 1190+ * @param object link2 [optional] the second link, as above
 1191+ * @param object link2 [optional] the third link, as above
11681192 * @return string the html
11691193 */
1170 - $.articleFeedbackv5.buildLink = function ( href, linktext, fulltext ) {
1171 - var link = mw.html.element( 'a', { href: href }, mw.msg( linktext ) );
1172 - var full = mw.html.escape( mw.msg( fulltext ) )
1173 - .replace( /\$1/, link.toString() );
 1194+ $.articleFeedbackv5.buildLink = function ( fulltext, link1, link2, link3 ) {
 1195+ var full = mw.html.escape( mw.msg( fulltext ) );
 1196+ if ( link1 ) {
 1197+ full = full.replace(
 1198+ /\$1/,
 1199+ mw.html.element( 'a', { href: link1.href }, mw.msg( link1.text )
 1200+ ).toString() );
 1201+ }
 1202+ if ( link2 ) {
 1203+ full = full.replace(
 1204+ /\$2/,
 1205+ mw.html.element( 'a', { href: link2.href }, mw.msg( link2.text )
 1206+ ).toString() );
 1207+ }
 1208+ if ( link3 ) {
 1209+ full = full.replace(
 1210+ /\$3/,
 1211+ mw.html.element( 'a', { href: link3.href }, mw.msg( link3.text )
 1212+ ).toString() );
 1213+ }
11741214 return full;
11751215 };
11761216
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -61,10 +61,19 @@
6262 'styles' => 'jquery.articleFeedbackv5/jquery.articleFeedbackv5.css',
6363 'messages' => array(
6464 'articlefeedbackv5-bucket1-title',
 65+ 'articlefeedbackv5-bucket1-title-emphasis',
 66+ 'articlefeedbackv5-bucket1-tooltip-title',
 67+ 'articlefeedbackv5-bucket1-tooltip-info',
 68+ 'articlefeedbackv5-bucket1-tooltip-linktext',
6569 'articlefeedbackv5-bucket1-question-toggle',
6670 'articlefeedbackv5-bucket1-toggle-found-yes',
 71+ 'articlefeedbackv5-bucket1-toggle-found-yes-full',
6772 'articlefeedbackv5-bucket1-toggle-found-no',
 73+ 'articlefeedbackv5-bucket1-toggle-found-no-full',
6874 'articlefeedbackv5-bucket1-question-comment',
 75+ 'articlefeedbackv5-bucket1-disclosure',
 76+ 'articlefeedbackv5-bucket1-disclosure-shared-linktext',
 77+ 'articlefeedbackv5-bucket1-disclosure-privacy-policy-linktext',
6978 'articlefeedbackv5-bucket1-form-pending',
7079 'articlefeedbackv5-bucket1-form-success',
7180 'articlefeedbackv5-bucket1-form-submit',

Follow-up revisions

RevisionCommit summaryAuthorDate
r103597Fixed spaces (resolves r103348)rsterbin15:32, 18 November 2011
r104988Updated Option 3 and tooltip text, and added documentation lines for new mess...rsterbin18:50, 2 December 2011

Comments

#Comment by Johnduhart (talk | contribs)   03:36, 18 November 2011

Spaces in the i18n file.

#Comment by Rsterbin (talk | contribs)   15:34, 18 November 2011

Ugh, that's what I get for using Dashcode instead of vim. Resolved.

#Comment by Johnduhart (talk | contribs)   11:00, 22 November 2011

Please add message documentation for the newly added messages. Thanks.

#Comment by Rsterbin (talk | contribs)   18:51, 2 December 2011

Done in r104988

Status & tagging log