Index: branches/wmf/1.18wmf1/maintenance/language/messages.inc |
— | — | @@ -3463,14 +3463,19 @@ |
3464 | 3464 | ), |
3465 | 3465 | 'feedback' => array( |
3466 | 3466 | 'feedback-note', |
| 3467 | + 'feedback-bugnote', |
3467 | 3468 | 'feedback-subject', |
3468 | | - 'feedback-message', |
3469 | | - 'feedback-cancel', |
3470 | | - 'feedback-submit', |
3471 | | - 'feedback-adding', |
3472 | | - 'feedback-error1', |
3473 | | - 'feedback-error2', |
3474 | | - 'feedback-error3', |
| 3469 | + 'feedback-message', |
| 3470 | + 'feedback-cancel', |
| 3471 | + 'feedback-submit', |
| 3472 | + 'feedback-adding', |
| 3473 | + 'feedback-error1', |
| 3474 | + 'feedback-error2', |
| 3475 | + 'feedback-error3', |
| 3476 | + 'feedback-thanks', |
| 3477 | + 'feedback-close', |
| 3478 | + 'feedback-bugcheck', |
| 3479 | + 'feedback-bugnew', |
3475 | 3480 | ), |
3476 | 3481 | ); |
3477 | 3482 | |
Index: branches/wmf/1.18wmf1/languages/messages/MessagesEn.php |
— | — | @@ -4601,7 +4601,8 @@ |
4602 | 4602 | |
4603 | 4603 | |
4604 | 4604 | # Feedback |
4605 | | -'feedback-note' => 'Your feedback will be posted publicly to the page "[$2 $1]", along with your user name, browser version and operating system.', |
| 4605 | +'feedback-note' => 'This form publicly posts a simple comment or suggestion to the page "[$2 $1]", along with your user name, browser version and operating system.', |
| 4606 | +'feedback-bugnote' => 'Or, you can [$1 post a technical bug report] instead.', |
4606 | 4607 | 'feedback-subject' => 'Subject:', |
4607 | 4608 | 'feedback-message' => 'Message:', |
4608 | 4609 | 'feedback-cancel' => 'Cancel', |
— | — | @@ -4610,4 +4611,8 @@ |
4611 | 4612 | 'feedback-error1' => 'Error: Unrecognized result from API', |
4612 | 4613 | 'feedback-error2' => 'Error: Edit failed', |
4613 | 4614 | 'feedback-error3' => 'Error: No response from API', |
| 4615 | +'feedback-thanks' => 'Thanks! Your feedback has been posted to the page "[$2 $1]".', |
| 4616 | +'feedback-close' => 'Done', |
| 4617 | +'feedback-bugcheck' => 'Great! Just check that it is not already one of the [$1 known bugs].', |
| 4618 | +'feedback-bugnew' => 'I checked. Report a new bug', |
4614 | 4619 | ); |
Index: branches/wmf/1.18wmf1/resources/Resources.php |
— | — | @@ -490,6 +490,7 @@ |
491 | 491 | ), |
492 | 492 | 'messages' => array( |
493 | 493 | 'feedback-note', |
| 494 | + 'feedback-bugnote', |
494 | 495 | 'feedback-subject', |
495 | 496 | 'feedback-message', |
496 | 497 | 'feedback-cancel', |
— | — | @@ -498,6 +499,10 @@ |
499 | 500 | 'feedback-error1', |
500 | 501 | 'feedback-error2', |
501 | 502 | 'feedback-error3', |
| 503 | + 'feedback-thanks', |
| 504 | + 'feedback-close', |
| 505 | + 'feedback-bugcheck', |
| 506 | + 'feedback-bugnew', |
502 | 507 | ), |
503 | 508 | ), |
504 | 509 | 'mediawiki.htmlform' => array( |
Index: branches/wmf/1.18wmf1/resources/mediawiki/mediawiki.feedback.js |
— | — | @@ -19,9 +19,9 @@ |
20 | 20 | * |
21 | 21 | * Not compatible with LiquidThreads. |
22 | 22 | * |
23 | | - * How to use it: |
| 23 | + * Minimal example in how to use it: |
24 | 24 | * |
25 | | - * var feedback = new mw.Feedback( api, myFeedbackPageTitle ); |
| 25 | + * var feedback = new mw.Feedback(); |
26 | 26 | * $( '#myButton' ).click( function() { feedback.launch(); } ); |
27 | 27 | * |
28 | 28 | * You can also launch the feedback form with a prefilled subject and body. |
— | — | @@ -35,6 +35,8 @@ |
36 | 36 | * api: {mw.Api} if omitted, will just create a standard API |
37 | 37 | * title: {mw.Title} the title of the page where you collect feedback. Defaults to "Feedback". |
38 | 38 | * dialogTitleMessageKey: {String} message key for the title of the dialog box |
| 39 | + * bugsLink: {mw.Uri|String} url where bugs can be posted |
| 40 | + * bugsListLink: {mw.Uri|String} url where bugs can be listed |
39 | 41 | */ |
40 | 42 | mw.Feedback = function( options ) { |
41 | 43 | |
— | — | @@ -54,9 +56,15 @@ |
55 | 57 | options.dialogTitleMessageKey = 'feedback-submit'; |
56 | 58 | } |
57 | 59 | |
58 | | - this.api = options.api; |
59 | | - this.feedbackTitle = options.title; |
60 | | - this.dialogTitleMessageKey = options.dialogTitleMessageKey; |
| 60 | + if ( options.bugsLink === undefined ) { |
| 61 | + options.bugsLink = '//bugzilla.wikimedia.org/enter_bug.cgi'; |
| 62 | + } |
| 63 | + |
| 64 | + if ( options.bugsListLink === undefined ) { |
| 65 | + options.bugsListLink = '//bugzilla.wikimedia.org/query.cgi'; |
| 66 | + } |
| 67 | + |
| 68 | + $.extend( this, options ); |
61 | 69 | if ( this.dialogTitleMessageKey === undefined ) { |
62 | 70 | this.dialogTitleMessageKey = 'feedback-submit'; |
63 | 71 | } |
— | — | @@ -67,19 +75,25 @@ |
68 | 76 | setup: function() { |
69 | 77 | var _this = this; |
70 | 78 | |
71 | | - // Set up buttons for dialog box. We have to do it the hard way since the json keys are localized |
72 | | - _this.buttons = {}; |
73 | | - _this.buttons[ mw.msg( 'feedback-cancel' ) ] = function() { _this.cancel(); }; |
74 | | - _this.buttons[ mw.msg( 'feedback-submit' ) ] = function() { _this.submit(); }; |
75 | | - |
76 | | - var $feedbackPageLink = $j( '<a></a>' ).attr( { 'href': _this.feedbackTitle.getUrl(), 'target': '_blank' } ); |
| 79 | + |
| 80 | + var $feedbackPageLink = $( '<a></a>' ) |
| 81 | + .attr( { 'href': _this.title.getUrl(), 'target': '_blank' } ) |
| 82 | + .css( { 'white-space': 'nowrap' } ); |
| 83 | + |
| 84 | + var $bugNoteLink = $( '<a></a>' ).attr( { 'href': '#', } ).click( function() { _this.displayBugs(); } ); |
| 85 | + |
| 86 | + var $bugsListLink = $( '<a></a>' ).attr( { 'href': _this.bugsListLink, 'target': '_blank' } ); |
| 87 | + |
77 | 88 | this.$dialog = |
78 | 89 | $( '<div style="position:relative;"></div>' ).append( |
79 | | - $( '<div class="feedback-mode feedback-form"></div>' ).append( |
80 | | - $( '<div style="margin-top:0.4em;"></div>' ).append( |
81 | | - $( '<small></small>' ).msg( 'feedback-note', |
82 | | - _this.feedbackTitle.getNameText(), |
83 | | - $feedbackPageLink ) |
| 90 | + $( '<div class="feedback-mode feedback-form"></div>' ).append( |
| 91 | + $( '<small></small>' ).append( |
| 92 | + $( '<p></p>' ).msg( |
| 93 | + 'feedback-note', |
| 94 | + _this.title.getNameText(), |
| 95 | + $feedbackPageLink.clone() |
| 96 | + ), |
| 97 | + $( '<p></p>' ).msg( 'feedback-bugnote', $bugNoteLink ) |
84 | 98 | ), |
85 | 99 | $( '<div style="margin-top:1em;"></div>' ).append( |
86 | 100 | mw.msg( 'feedback-subject' ), |
— | — | @@ -92,16 +106,26 @@ |
93 | 107 | $( '<textarea name="message" class="feedback-message" style="width:99%;" rows="5" cols="60"></textarea>' ) |
94 | 108 | ) |
95 | 109 | ), |
| 110 | + $( '<div class="feedback-mode feedback-bugs"></div>' ).append( |
| 111 | + $( '<p>' ).msg( 'feedback-bugcheck', $bugsListLink ) |
| 112 | + ), |
96 | 113 | $( '<div class="feedback-mode feedback-submitting" style="text-align:center;margin:3em 0;"></div>' ).append( |
97 | 114 | mw.msg( 'feedback-adding' ), |
98 | 115 | $( '<br/>' ), |
99 | 116 | $( '<img src="http://upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />' ) |
100 | 117 | ), |
| 118 | + $( '<div class="feedback-mode feedback-thanks" style="text-align:center;margin:1em"></div>' ).msg( |
| 119 | + 'feedback-thanks', _this.title.getNameText(), $feedbackPageLink.clone() |
| 120 | + ), |
101 | 121 | $( '<div class="feedback-mode feedback-error" style="position:relative;"></div>' ).append( |
102 | 122 | $( '<div class="feedback-error-msg style="color:#990000;margin-top:0.4em;"></div>' ) |
| 123 | + ) |
| 124 | + ); |
103 | 125 | |
104 | | - ) |
105 | | - ).dialog({ |
| 126 | + // undo some damage from dialog css |
| 127 | + this.$dialog.find( 'a' ).css( { 'color': '#0645ad' } ); |
| 128 | + |
| 129 | + this.$dialog.dialog({ |
106 | 130 | width: 500, |
107 | 131 | autoOpen: false, |
108 | 132 | title: mw.msg( this.dialogTitleMessageKey ), |
— | — | @@ -111,7 +135,7 @@ |
112 | 136 | |
113 | 137 | this.subjectInput = this.$dialog.find( 'input.feedback-subject' ).get(0); |
114 | 138 | this.messageInput = this.$dialog.find( 'textarea.feedback-message' ).get(0); |
115 | | - this.displayForm(); |
| 139 | + |
116 | 140 | }, |
117 | 141 | |
118 | 142 | display: function( s ) { |
— | — | @@ -124,6 +148,23 @@ |
125 | 149 | this.display( 'submitting' ); |
126 | 150 | }, |
127 | 151 | |
| 152 | + displayBugs: function() { |
| 153 | + var _this = this; |
| 154 | + this.display( 'bugs' ); |
| 155 | + var bugsButtons = {}; |
| 156 | + bugsButtons[ mw.msg( 'feedback-bugnew' ) ] = function() { window.open( _this.bugsLink, '_blank' ); }; |
| 157 | + bugsButtons[ mw.msg( 'feedback-cancel' ) ] = function() { _this.cancel(); }; |
| 158 | + this.$dialog.dialog( { buttons: bugsButtons } ); |
| 159 | + }, |
| 160 | + |
| 161 | + displayThanks: function() { |
| 162 | + var _this = this; |
| 163 | + this.display( 'thanks' ); |
| 164 | + var closeButton = {}; |
| 165 | + closeButton[ mw.msg( 'feedback-close' ) ] = function() { _this.$dialog.dialog( 'close' ); }; |
| 166 | + this.$dialog.dialog( { buttons: closeButton } ); |
| 167 | + }, |
| 168 | + |
128 | 169 | /** |
129 | 170 | * Display the feedback form |
130 | 171 | * @param {Object} optional prefilled contents for the feedback form. Object with properties: |
— | — | @@ -131,11 +172,17 @@ |
132 | 173 | * message: {String} |
133 | 174 | */ |
134 | 175 | displayForm: function( contents ) { |
| 176 | + var _this = this; |
135 | 177 | this.subjectInput.value = (contents && contents.subject) ? contents.subject : ''; |
136 | 178 | this.messageInput.value = (contents && contents.message) ? contents.message : ''; |
137 | 179 | |
138 | 180 | this.display( 'form' ); |
139 | | - this.$dialog.dialog( { buttons: this.buttons } ); // put the buttons back |
| 181 | + |
| 182 | + // Set up buttons for dialog box. We have to do it the hard way since the json keys are localized |
| 183 | + var formButtons = {}; |
| 184 | + formButtons[ mw.msg( 'feedback-submit' ) ] = function() { _this.submit(); }; |
| 185 | + formButtons[ mw.msg( 'feedback-cancel' ) ] = function() { _this.cancel(); }; |
| 186 | + this.$dialog.dialog( { buttons: formButtons } ); // put the buttons back |
140 | 187 | }, |
141 | 188 | |
142 | 189 | displayError: function( message ) { |
— | — | @@ -164,7 +211,7 @@ |
165 | 212 | var ok = function( result ) { |
166 | 213 | if ( result.edit !== undefined ) { |
167 | 214 | if ( result.edit.result === 'Success' ) { |
168 | | - _this.$dialog.dialog( 'close' ); // edit complete, close dialog box |
| 215 | + _this.displayThanks(); |
169 | 216 | } else { |
170 | 217 | _this.displayError( 'feedback-error1' ); // unknown API result |
171 | 218 | } |
— | — | @@ -177,7 +224,7 @@ |
178 | 225 | displayError( 'feedback-error3' ); // ajax request failed |
179 | 226 | }; |
180 | 227 | |
181 | | - this.api.newSection( this.feedbackTitle, subject, message, ok, err ); |
| 228 | + this.api.newSection( this.title, subject, message, ok, err ); |
182 | 229 | |
183 | 230 | }, // close submit button function |
184 | 231 | |