r78546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78545‎ | r78546 | r78547 >
Date:19:52, 17 December 2010
Author:tparscal
Status:deferred
Tags:
Comment:
Added basic framework for adding pitches - no code for showing them yet.
Modified paths:
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.css (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php
@@ -21,6 +21,15 @@
2222 'articlefeedback-field-unbiased-tip',
2323 'articlefeedback-field-wellwritten-label',
2424 'articlefeedback-field-wellwritten-tip',
 25+ 'articlefeedback-pitch-takesurvey-title',
 26+ 'articlefeedback-pitch-takesurvey-message',
 27+ 'articlefeedback-pitch-takesurvey-action',
 28+ 'articlefeedback-pitch-createaccount-title',
 29+ 'articlefeedback-pitch-createaccount-message',
 30+ 'articlefeedback-pitch-createaccount-action',
 31+ 'articlefeedback-pitch-makefirstedit-title',
 32+ 'articlefeedback-pitch-makefirstedit-message',
 33+ 'articlefeedback-pitch-makefirstedit-action',
2534 ),
2635 'dependencies' => array(
2736 'jquery.articleFeedback',
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js
@@ -37,10 +37,12 @@
3838 <div style="clear:both;"></div>\
3939 </div>\
4040 ',
41 - 'dialog': '\
42 -<div class="articleFeedback-dialog">\
 41+ 'pitch': '\
 42+<div class="articleFeedback-pitch">\
4343 <div class="articleFeedback-buffer">\
4444 <div class="articleFeedback-title"></div>\
 45+ <div class="articleFeedback-message"></div>\
 46+ <button class="articleFeedback-action"></button>\
4547 </div>\
4648 </div>\
4749 '
@@ -86,8 +88,8 @@
8789 'data': $.extend( data, {
8890 'action': 'articlefeedback',
8991 'format': 'json',
90 - 'anontoken': mw.user.sessionId(),
91 - 'userid': mw.user.sessionId(),
 92+ 'anontoken': mw.user.id(),
 93+ 'userid': mw.user.id(),
9294 'pageid': mw.config.get( 'wgArticleId' ),
9395 'revid': mw.config.get( 'wgCurRevisionId' ),
9496 'bucket': context.options.bucket
@@ -114,8 +116,8 @@
115117 'format': 'json',
116118 'list': 'articlefeedback',
117119 'afpageid': mw.config.get( 'wgArticleId' ),
118 - 'afanontoken': mw.user.sessionId(),
119 - 'afuserrating': mw.user.sessionId()
 120+ 'afanontoken': mw.user.id(),
 121+ 'afuserrating': mw.user.id()
120122 },
121123 'success': function( data ) {
122124 var context = this;
@@ -203,6 +205,22 @@
204206 }
205207 } )
206208 .end()
 209+ .each( function() {
 210+ for ( key in context.options.pitches ) {
 211+ $( $.articleFeedback.tpl.pitch )
 212+ .attr( 'rel', key )
 213+ .find( '.articleFeedback-title' )
 214+ .text( mw.msg( context.options.pitches[key].title ) )
 215+ .end()
 216+ .find( '.articleFeedback-message' )
 217+ .text( mw.msg( context.options.pitches[key].message ) )
 218+ .end()
 219+ .find( '.articleFeedback-action' )
 220+ .text( mw.msg( context.options.pitches[key].action ) )
 221+ .end()
 222+ .appendTo( $(this) );
 223+ }
 224+ } )
207225 .localize( { 'prefix': 'articlefeedback-' } )
208226 // Activate tooltips
209227 .find( '[title]' )
@@ -345,7 +363,7 @@
346364 var context = $(this).data( 'articleFeedback-context' );
347365 if ( !context ) {
348366 // Create context
349 - context = { '$ui': $(this), 'options': { 'ratings': {}, 'bucket': 0 } };
 367+ context = { '$ui': $(this), 'options': { 'ratings': {}, 'pitches': {},'bucket': 0 } };
350368 // Allow customization through an options argument
351369 if ( typeof args[0] === 'object' ) {
352370 context = $.extend( context, { 'options': args[0] } );
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.css
@@ -13,7 +13,7 @@
1414 padding-bottom: 1px;
1515 }
1616
17 -.articleFeedback-dialog {
 17+.articleFeedback-pitch {
1818 display: none;
1919 position: absolute;
2020 top: 0;
@@ -23,7 +23,7 @@
2424 padding-bottom: 1px;
2525 }
2626
27 -.articleFeedback-dialog .articleFeedback-buffer {
 27+.articleFeedback-pitch .articleFeedback-buffer {
2828 padding: 0.75em 1em;
2929 }
3030
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js
@@ -26,6 +26,41 @@
2727 'label': 'articlefeedback-field-wellwritten-label',
2828 'tip': 'articlefeedback-field-wellwritten-tip'
2929 }
 30+ },
 31+ 'pitches': {
 32+ 'takesurvey': {
 33+ 'condition': function() {
 34+ // If already taken survey, return false
 35+ return true;
 36+ },
 37+ 'title': 'articlefeedback-pitch-takesurvey-title',
 38+ 'message': 'articlefeedback-pitch-takesurvey-message',
 39+ 'action': 'articlefeedback-pitch-takesurvey-action'
 40+ },
 41+ 'createaccount': {
 42+ 'condition': function() {
 43+ // If user is logged in, return false
 44+ if ( !mediaWiki.user.anonymous() ) {
 45+ return false;
 46+ }
 47+ return true;
 48+ },
 49+ 'title': 'articlefeedback-pitch-createaccount-title',
 50+ 'message': 'articlefeedback-pitch-createaccount-message',
 51+ 'action': 'articlefeedback-pitch-createaccount-action'
 52+ },
 53+ 'makefirstedit': {
 54+ 'condition': function() {
 55+ // If user is not logged in, return false
 56+ if ( mediaWiki.user.anonymous() ) {
 57+ return false;
 58+ }
 59+ return true;
 60+ },
 61+ 'title': 'articlefeedback-pitch-makefirstedit-title',
 62+ 'message': 'articlefeedback-pitch-makefirstedit-message',
 63+ 'action': 'articlefeedback-pitch-makefirstedit-action'
 64+ },
3065 }
3166 };
3267 // Bucket 1 - load at the bottom of the article
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.i18n.php
@@ -44,6 +44,15 @@
4545 'articlefeedback-field-unbiased-tip' => 'Do you feel that this page shows a fair representation of all perspectives on the issue?',
4646 'articlefeedback-field-wellwritten-label' => 'Well-written',
4747 'articlefeedback-field-wellwritten-tip' => 'Do you feel that this page is well-organized and well-written?',
 48+ 'articlefeedback-pitch-takesurvey-title' => 'Would you like to take a survey?',
 49+ 'articlefeedback-pitch-takesurvey-message' => '-- message --',
 50+ 'articlefeedback-pitch-takesurvey-action' => 'Start Survey',
 51+ 'articlefeedback-pitch-createaccount-title' => 'Would you like to create an account?',
 52+ 'articlefeedback-pitch-createaccount-message' => '-- message --',
 53+ 'articlefeedback-pitch-createaccount-action' => 'Create Account',
 54+ 'articlefeedback-pitch-makefirstedit-title' => 'Would you like to edit this article?',
 55+ 'articlefeedback-pitch-makefirstedit-message' => '-- message --',
 56+ 'articlefeedback-pitch-makefirstedit-action' => 'Start Editing',
4857 );
4958
5059 /** Message documentation (Message documentation)

Follow-up revisions

RevisionCommit summaryAuthorDate
r78547Follow-up r78546: Remove title case for consistency...raymond20:05, 17 December 2010

Status & tagging log