r109875 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109874‎ | r109875 | r109876 >
Date:23:40, 23 January 2012
Author:rsterbin
Status:ok
Tags:aft 
Comment:
Added survey CTA:
- modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js:
- Added cta #3 to $.articleFeedbackv5.ctas and ctaName()
- api/ApiArticleFeedbackv5.php:
- Changed hardcoded return of cta id 1 to 3
- ArticleFeedbackv5.php:
- New config variable $wgArticleFeedbackv5SurveyUrl
- ArticleFeedbackv5.i18n.php:
- Added new messages 'articlefeedbackv5-cta3-confirmation-title',
'articlefeedbackv5-cta3-confirmation-call', and
'articlefeedbackv5-cta3-button-text'
- ArticleFeedbackv5.hooks.php:
- Updated to send new messages and config varible to the resource
loader
- modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css:
- Bumped the button up a bit for the survey CTA
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -28,6 +28,9 @@
2929 'articlefeedbackv5-cta2-confirmation-title' => 'Help improve Wikipedia',
3030 'articlefeedbackv5-cta2-confirmation-call' => 'This website is created by people like you. Can you give us a hand?',
3131 'articlefeedbackv5-cta2-button-text' => 'Learn more',
 32+ 'articlefeedbackv5-cta3-confirmation-title' => 'Please take a quick survey',
 33+ 'articlefeedbackv5-cta3-confirmation-call' => 'It only takes a minute and will help improve Wikipedia.',
 34+ 'articlefeedbackv5-cta3-button-text' => 'Start the survey',
3235
3336 // error messages
3437 'articlefeedbackv5-error' => 'An error has occured. Please try again later.',
@@ -323,6 +326,9 @@
324327 'articlefeedbackv5-cta2-confirmation-title' => 'The title of the learn more CTA',
325328 'articlefeedbackv5-cta2-confirmation-call' => 'The explanatory text of the learn more CTA',
326329 'articlefeedbackv5-cta2-button-text' => 'The text for the button on the learn more CTA',
 330+ 'articlefeedbackv5-cta3-confirmation-title' => 'The title of the survey CTA',
 331+ 'articlefeedbackv5-cta3-confirmation-call' => 'The explanatory text of the survey CTA',
 332+ 'articlefeedbackv5-cta3-button-text' => 'The text for the button on the survey CTA',
327333 'articlefeedbackv5-error' => 'This error message will be displayed in a grey box replacing the form if there was an unrecoverable error.',
328334 'articlefeedbackv5-error-blocked' => 'This error message will be displayed on the form if the user is blocked from submitting feedback.',
329335 'articlefeedbackv5-error-abuse' => 'This error message will be displayed above the form if the comment matched the spam or abuse filters. $1 is the link to the abuse policy.',
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css
@@ -1018,6 +1018,11 @@
10191019 margin-top: 50px !important;
10201020 }
10211021
 1022+.articleFeedbackv5-ui.articleFeedbackv5-cta-3 .articleFeedbackv5-cta-button {
 1023+ margin-top: 50px !important;
 1024+}
 1025+
 1026+
10221027 /* Skin-specific styles */
10231028 body.skin-vector .articleFeedbackv5-dialog.ui-dialog .ui-dialog-content a,
10241029 body.skin-monobook .articleFeedbackv5-dialog.ui-dialog .ui-dialog-content a {
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -1993,10 +1993,110 @@
19941994
19951995 // }}}
19961996
1997 - }
 1997+ },
19981998
19991999 // }}}
 2000+ // {{{ CTA 3: Take a survey
20002001
 2002+ '3': {
 2003+
 2004+ // {{{ templates
 2005+
 2006+ /**
 2007+ * Pull out the markup so it's easy to find
 2008+ */
 2009+ templates: {
 2010+
 2011+ /**
 2012+ * The template for the whole block
 2013+ */
 2014+ block: '\
 2015+ <div class="clear"></div>\
 2016+ <div class="articleFeedbackv5-confirmation-panel">\
 2017+ <div class="articleFeedbackv5-panel-leftContent">\
 2018+ <h3 class="articleFeedbackv5-confirmation-title"><html:msg key="cta3-confirmation-title" /></h3>\
 2019+ <p class="articleFeedbackv5-confirmation-call"><html:msg key="cta3-confirmation-call" /></p>\
 2020+ </div>\
 2021+ <a href="#" class="articleFeedbackv5-cta-button" target="_blank"><span class="ui-button-text"><html:msg key="cta3-button-text" /></span></a>\
 2022+ <div class="clear"></div>\
 2023+ </div>\
 2024+ '
 2025+
 2026+ },
 2027+
 2028+ // }}}
 2029+ // {{{ build
 2030+
 2031+ /**
 2032+ * Builds the CTA
 2033+ *
 2034+ * @return Element the form
 2035+ */
 2036+ build: function () {
 2037+
 2038+ // Start up the block to return
 2039+ var $block = $( $.articleFeedbackv5.currentCTA().templates.block );
 2040+
 2041+ // Fill in the go-to-survey link
 2042+ var survey_track_id = $.articleFeedbackv5.bucketName() + '-' +
 2043+ $.articleFeedbackv5.ctaName() + '-button_click-' +
 2044+ ( $.articleFeedbackv5.inDialog ? 'overlay': 'bottom' );
 2045+ $block.find( '.articleFeedbackv5-cta-button' )
 2046+ .attr( 'href', $.articleFeedbackv5.trackingUrl(
 2047+ mw.config.get( 'wgArticleFeedbackv5SurveyUrl' ) +
 2048+ '?c=' + $.articleFeedbackv5.bucketId +
 2049+ '&f=' + $.articleFeedbackv5.feedbackId,
 2050+ survey_track_id
 2051+ ) );
 2052+
 2053+ return $block;
 2054+ },
 2055+
 2056+ // }}}
 2057+ // {{{ bindEvents
 2058+
 2059+ /**
 2060+ * Binds any events
 2061+ *
 2062+ * @param $block element the form block
 2063+ */
 2064+ bindEvents: function ( $block ) {
 2065+
 2066+ // Make the link work as a popup
 2067+ $block.find( '.articleFeedbackv5-cta-button' )
 2068+ .click( function ( e ) {
 2069+ e.preventDefault();
 2070+ var link = $( this ).attr( 'href' );
 2071+ var params = 'status=0,\
 2072+ toolbar=0,\
 2073+ location=0,\
 2074+ menubar=0,\
 2075+ directories=0,\
 2076+ resizable=1,\
 2077+ scrollbars=1,\
 2078+ height=600,\
 2079+ width=800';
 2080+ var survey = window.open( link, 'survey', params );
 2081+ } );
 2082+
 2083+ },
 2084+
 2085+ // }}}
 2086+ // {{{ afterBuild
 2087+
 2088+ /**
 2089+ * Perform adjustments after build
 2090+ */
 2091+ afterBuild: function() {
 2092+ $( '.articleFeedbackv5-tooltip-trigger' ).remove();
 2093+ }
 2094+
 2095+ // }}}
 2096+
 2097+ },
 2098+
 2099+ // }}}
 2100+
20012101 };
20022102
20032103 // }}}
@@ -2282,6 +2382,8 @@
22832383 return 'cta_edit';
22842384 } else if ( '2' == $.articleFeedbackv5.ctaId ) {
22852385 return 'cta_learn_more';
 2386+ } else if ( '3' == $.articleFeedbackv5.ctaId ) {
 2387+ return 'cta_survey';
22862388 } else {
22872389 return 'cta_unknown';
22882390 }
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php
@@ -185,6 +185,13 @@
186186 */
187187 $wgArticleFeedbackv5LearnToEdit = "//en.wikipedia.org/wiki/Wikipedia:Tutorial";
188188
 189+/**
 190+ * The full URL for the survey link
 191+ *
 192+ * @var string
 193+ */
 194+$wgArticleFeedbackv5SurveyUrl = "https://www.surveymonkey.com/s/aft5";
 195+
189196 // Would ordinarily call this articlefeedback but survey names are 16 chars max
190197 $wgPrefSwitchSurveys['articlerating'] = array(
191198 'updatable' => false,
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php
@@ -682,7 +682,7 @@
683683 * @return int the cta id
684684 */
685685 public function getCTAId( $answers, $bucket ) {
686 - return 1; # Hard-code this for now.
 686+ return 3; # Hard-code this for now.
687687 }
688688
689689 /**
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -75,6 +75,9 @@
7676 'articlefeedbackv5-cta2-confirmation-title',
7777 'articlefeedbackv5-cta2-confirmation-call',
7878 'articlefeedbackv5-cta2-button-text',
 79+ 'articlefeedbackv5-cta3-confirmation-title',
 80+ 'articlefeedbackv5-cta3-confirmation-call',
 81+ 'articlefeedbackv5-cta3-button-text',
7982 'articlefeedbackv5-bucket1-title',
8083 'articlefeedbackv5-bucket1-question-toggle',
8184 'articlefeedbackv5-bucket1-toggle-found-yes',
@@ -265,7 +268,8 @@
266269 $wgArticleFeedbackv5Options,
267270 $wgArticleFeedbackv5LinkBuckets,
268271 $wgArticleFeedbackv5Namespaces,
269 - $wgArticleFeedbackv5LearnToEdit;
 272+ $wgArticleFeedbackv5LearnToEdit,
 273+ $wgArticleFeedbackv5SurveyUrl;
270274 $vars['wgArticleFeedbackv5SMaxage'] = $wgArticleFeedbackv5SMaxage;
271275 $vars['wgArticleFeedbackv5Categories'] = $wgArticleFeedbackv5Categories;
272276 $vars['wgArticleFeedbackv5BlacklistCategories'] = $wgArticleFeedbackv5BlacklistCategories;
@@ -281,6 +285,7 @@
282286 $vars['wgArticleFeedbackv5LearnToEdit'] = $wgArticleFeedbackv5LearnToEdit;
283287 $vars['wgArticleFeedbackv5WhatsThisPage'] = wfMsgForContent( 'articlefeedbackv5-bucket5-form-panel-explanation-link' );
284288 $vars['wgArticleFeedbackv5TermsPage'] = wfMsgForContent( 'articlefeedbackv5-transparency-terms-url' );
 289+ $vars['wgArticleFeedbackv5SurveyUrl'] = $wgArticleFeedbackv5SurveyUrl;
285290 return true;
286291 }
287292

Follow-up revisions

RevisionCommit summaryAuthorDate
r1100191.18wmf1: MFT r109875, r109933, r109943catrope19:34, 25 January 2012

Status & tagging log