Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php |
— | — | @@ -21,6 +21,15 @@ |
22 | 22 | 'articlefeedback-field-unbiased-tip', |
23 | 23 | 'articlefeedback-field-wellwritten-label', |
24 | 24 | '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', |
25 | 34 | ), |
26 | 35 | 'dependencies' => array( |
27 | 36 | 'jquery.articleFeedback', |
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js |
— | — | @@ -37,10 +37,12 @@ |
38 | 38 | <div style="clear:both;"></div>\ |
39 | 39 | </div>\ |
40 | 40 | ', |
41 | | - 'dialog': '\ |
42 | | -<div class="articleFeedback-dialog">\ |
| 41 | + 'pitch': '\ |
| 42 | +<div class="articleFeedback-pitch">\ |
43 | 43 | <div class="articleFeedback-buffer">\ |
44 | 44 | <div class="articleFeedback-title"></div>\ |
| 45 | + <div class="articleFeedback-message"></div>\ |
| 46 | + <button class="articleFeedback-action"></button>\ |
45 | 47 | </div>\ |
46 | 48 | </div>\ |
47 | 49 | ' |
— | — | @@ -86,8 +88,8 @@ |
87 | 89 | 'data': $.extend( data, { |
88 | 90 | 'action': 'articlefeedback', |
89 | 91 | 'format': 'json', |
90 | | - 'anontoken': mw.user.sessionId(), |
91 | | - 'userid': mw.user.sessionId(), |
| 92 | + 'anontoken': mw.user.id(), |
| 93 | + 'userid': mw.user.id(), |
92 | 94 | 'pageid': mw.config.get( 'wgArticleId' ), |
93 | 95 | 'revid': mw.config.get( 'wgCurRevisionId' ), |
94 | 96 | 'bucket': context.options.bucket |
— | — | @@ -114,8 +116,8 @@ |
115 | 117 | 'format': 'json', |
116 | 118 | 'list': 'articlefeedback', |
117 | 119 | '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() |
120 | 122 | }, |
121 | 123 | 'success': function( data ) { |
122 | 124 | var context = this; |
— | — | @@ -203,6 +205,22 @@ |
204 | 206 | } |
205 | 207 | } ) |
206 | 208 | .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 | + } ) |
207 | 225 | .localize( { 'prefix': 'articlefeedback-' } ) |
208 | 226 | // Activate tooltips |
209 | 227 | .find( '[title]' ) |
— | — | @@ -345,7 +363,7 @@ |
346 | 364 | var context = $(this).data( 'articleFeedback-context' ); |
347 | 365 | if ( !context ) { |
348 | 366 | // Create context |
349 | | - context = { '$ui': $(this), 'options': { 'ratings': {}, 'bucket': 0 } }; |
| 367 | + context = { '$ui': $(this), 'options': { 'ratings': {}, 'pitches': {},'bucket': 0 } }; |
350 | 368 | // Allow customization through an options argument |
351 | 369 | if ( typeof args[0] === 'object' ) { |
352 | 370 | context = $.extend( context, { 'options': args[0] } ); |
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.css |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | padding-bottom: 1px; |
15 | 15 | } |
16 | 16 | |
17 | | -.articleFeedback-dialog { |
| 17 | +.articleFeedback-pitch { |
18 | 18 | display: none; |
19 | 19 | position: absolute; |
20 | 20 | top: 0; |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | padding-bottom: 1px; |
25 | 25 | } |
26 | 26 | |
27 | | -.articleFeedback-dialog .articleFeedback-buffer { |
| 27 | +.articleFeedback-pitch .articleFeedback-buffer { |
28 | 28 | padding: 0.75em 1em; |
29 | 29 | } |
30 | 30 | |
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js |
— | — | @@ -26,6 +26,41 @@ |
27 | 27 | 'label': 'articlefeedback-field-wellwritten-label', |
28 | 28 | 'tip': 'articlefeedback-field-wellwritten-tip' |
29 | 29 | } |
| 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 | + }, |
30 | 65 | } |
31 | 66 | }; |
32 | 67 | // Bucket 1 - load at the bottom of the article |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.i18n.php |
— | — | @@ -44,6 +44,15 @@ |
45 | 45 | 'articlefeedback-field-unbiased-tip' => 'Do you feel that this page shows a fair representation of all perspectives on the issue?', |
46 | 46 | 'articlefeedback-field-wellwritten-label' => 'Well-written', |
47 | 47 | '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', |
48 | 57 | ); |
49 | 58 | |
50 | 59 | /** Message documentation (Message documentation) |