Index: trunk/extensions/MoodBar/MoodBar.i18n.php |
— | — | @@ -97,6 +97,8 @@ |
98 | 98 | 'moodbar-hidden-footer' => 'Hidden Feedback $1', |
99 | 99 | 'moodbar-feedback-restore' => 'restore hidden feedback', |
100 | 100 | 'moodbar-action-item' => 'Feedback item:', |
| 101 | + 'moodbar-action-reason' => 'Reason:', |
| 102 | + 'moodbar-action-reason-required' => 'Please provide a reason.', |
101 | 103 | 'moodbar-hide-header' => 'Hide this item from view', |
102 | 104 | 'moodbar-hide-intro' => '', |
103 | 105 | 'moodbar-restore-header' => "Restore this item's visibility", |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js |
— | — | @@ -111,7 +111,6 @@ |
112 | 112 | .localize() |
113 | 113 | .click( function( e ) { |
114 | 114 | var $el = $( this ); |
115 | | - //mb.ui.overlay.find( '.mw-moodBar-formSubmit').removeAttr('disabled'); |
116 | 115 | mb.ui.overlay.find( '.mw-moodBar-formInput' ).focus(); |
117 | 116 | $mwMoodBarTypes.addClass( 'mw-moodBar-types-select' ); |
118 | 117 | mb.feedbackItem.type = $el.attr( 'rel' ); |
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js |
— | — | @@ -249,16 +249,17 @@ |
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
253 | | - * Do this before administrative action |
| 253 | + * Do this before administrative action to provide reason |
254 | 254 | */ |
255 | 255 | function beforeAction(params, $item){ |
256 | | - var inlineForm = $('<span class="fbd-item-reason">\ |
257 | | - Reason\ |
| 256 | + var inlineForm = '<span class="fbd-item-reason">\ |
| 257 | + $1\ |
258 | 258 | <input class="fbd-action-reason" name="fb-action-reason" />\ |
259 | 259 | <button class="fbd-action-confirm">Confirm</button>\ |
260 | 260 | <button class="fbd-action-cancel">Cancel</button>\ |
261 | | - </span>'); |
262 | | - |
| 261 | + </span>' |
| 262 | + .replace( /\$1/g, mw.msg( 'moodbar-action-reason' )); |
| 263 | + |
263 | 264 | var storedParams = params; |
264 | 265 | var $storedItem = $item; |
265 | 266 | |
— | — | @@ -268,9 +269,16 @@ |
269 | 270 | $item.find('.fbd-item-message') |
270 | 271 | .append(inlineForm) |
271 | 272 | .end(); |
| 273 | + |
| 274 | + $('.fbd-action-confirm').click( function() { |
| 275 | + storedParams.reason = $item.find('.fbd-action-reason').val(); |
272 | 276 | |
273 | | - $('.fbd-action-confirm').click( function() { |
274 | | - doAction(storedParams, $storedItem); |
| 277 | + if( storedParams.reason ) { |
| 278 | + doAction(storedParams, $storedItem); |
| 279 | + } else { |
| 280 | + alert( mw.msg( 'moodbar-action-reason-required' ) ); |
| 281 | + } |
| 282 | + |
275 | 283 | }); |
276 | 284 | $('.fbd-action-cancel').click( function() { |
277 | 285 | reloadItem( $storedItem, true ); |
— | — | @@ -288,9 +296,6 @@ |
289 | 297 | showItemError( $item, error_str ); |
290 | 298 | }; |
291 | 299 | |
292 | | - //var reason = prompt("Reason for this action?"); |
293 | | - var reason = $item.find('.fbd-action-reason').val(); |
294 | | - |
295 | 300 | var $spinner = $('<span class="mw-ajax-loader"> </span>'); |
296 | 301 | $item.find('.fbd-item-hide').empty().append( $spinner ); |
297 | 302 | |
— | — | @@ -324,7 +329,6 @@ |
325 | 330 | function restoreItem(e) { |
326 | 331 | var $item = $(this).closest('.fbd-item'); |
327 | 332 | |
328 | | - //doAction( { 'mbaction' : 'restore' }, $item ); |
329 | 333 | beforeAction( { 'mbaction' : 'restore' }, $item ); |
330 | 334 | e.preventDefault(); |
331 | 335 | } |
— | — | @@ -334,11 +338,7 @@ |
335 | 339 | */ |
336 | 340 | function hideItem(e) { |
337 | 341 | var $item = $(this).closest('.fbd-item'); |
338 | | - |
339 | | - //var $spinner = $('<span class="mw-ajax-loader"> </span>'); |
340 | | - //$item.find('.fbd-item-hide').empty().append( $spinner ); |
341 | | - |
342 | | - //doAction( { 'mbaction' : 'hide' }, $item ); |
| 342 | + |
343 | 343 | beforeAction( { 'mbaction' : 'hide' }, $item ); |
344 | 344 | e.preventDefault(); |
345 | 345 | } |
Index: trunk/extensions/MoodBar/MoodBar.php |
— | — | @@ -149,6 +149,8 @@ |
150 | 150 | 'moodbar-feedback-noresults', |
151 | 151 | 'moodbar-feedback-ajaxerror', |
152 | 152 | 'moodbar-feedback-action-error', |
| 153 | + 'moodbar-action-reason', |
| 154 | + 'moodbar-action-reason-required' |
153 | 155 | ), |
154 | 156 | ); |
155 | 157 | |