Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.css |
— | — | @@ -226,7 +226,8 @@ |
227 | 227 | |
228 | 228 | .fbd-item-permalink, |
229 | 229 | .fbd-item-show, |
230 | | -.fbd-item-hide { |
| 230 | +.fbd-item-hide, |
| 231 | +.fbd-item-reason{ |
231 | 232 | float: right; |
232 | 233 | font-size: 0.8em; |
233 | 234 | margin-left: 0.2em; |
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js |
— | — | @@ -249,6 +249,36 @@ |
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
| 253 | + * Do this before administrative action |
| 254 | + */ |
| 255 | + function beforeAction(params, $item){ |
| 256 | + var inlineForm = $('<span class="fbd-item-reason">\ |
| 257 | + Reason\ |
| 258 | + <input class="fbd-action-reason" name="fb-action-reason" />\ |
| 259 | + <button class="fbd-action-confirm">Confirm</button>\ |
| 260 | + <button class="fbd-action-cancel">Cancel</button>\ |
| 261 | + </span>'); |
| 262 | + |
| 263 | + var storedParams = params; |
| 264 | + var $storedItem = $item; |
| 265 | + |
| 266 | + $item.find('.fbd-item-hide, .fbd-item-restore, .fbd-item-permalink') |
| 267 | + .empty(); |
| 268 | + |
| 269 | + $item.find('.fbd-item-message') |
| 270 | + .append(inlineForm) |
| 271 | + .end(); |
| 272 | + |
| 273 | + $('.fbd-action-confirm').click( function() { |
| 274 | + doAction(storedParams, $storedItem); |
| 275 | + }); |
| 276 | + $('.fbd-action-cancel').click( function() { |
| 277 | + reloadItem( $storedItem, true ); |
| 278 | + }); |
| 279 | + |
| 280 | + } |
| 281 | + |
| 282 | + /** |
253 | 283 | * Execute an action on an item |
254 | 284 | */ |
255 | 285 | function doAction( params, $item ) { |
— | — | @@ -258,8 +288,12 @@ |
259 | 289 | showItemError( $item, error_str ); |
260 | 290 | }; |
261 | 291 | |
262 | | - var reason = prompt("Reason for this action?"); |
| 292 | + //var reason = prompt("Reason for this action?"); |
| 293 | + var reason = $item.find('.fbd-action-reason').val(); |
263 | 294 | |
| 295 | + var $spinner = $('<span class="mw-ajax-loader"> </span>'); |
| 296 | + $item.find('.fbd-item-hide').empty().append( $spinner ); |
| 297 | + |
264 | 298 | $.post( mw.util.wikiScript('api'), |
265 | 299 | $.extend( { |
266 | 300 | 'action' : 'feedbackdashboard', |
— | — | @@ -290,11 +324,8 @@ |
291 | 325 | function restoreItem(e) { |
292 | 326 | var $item = $(this).closest('.fbd-item'); |
293 | 327 | |
294 | | - var $spinner = $('<span class="mw-ajax-loader"> </span>'); |
295 | | - $item.find('.fbd-item-restore').empty().append( $spinner ); |
296 | | - |
297 | | - doAction( { 'mbaction' : 'restore' }, $item ); |
298 | | - |
| 328 | + //doAction( { 'mbaction' : 'restore' }, $item ); |
| 329 | + beforeAction( { 'mbaction' : 'restore' }, $item ); |
299 | 330 | e.preventDefault(); |
300 | 331 | } |
301 | 332 | |
— | — | @@ -303,12 +334,12 @@ |
304 | 335 | */ |
305 | 336 | function hideItem(e) { |
306 | 337 | 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 ); |
307 | 341 | |
308 | | - var $spinner = $('<span class="mw-ajax-loader"> </span>'); |
309 | | - $item.find('.fbd-item-hide').empty().append( $spinner ); |
310 | | - |
311 | | - doAction( { 'mbaction' : 'hide' }, $item ); |
312 | | - |
| 342 | + //doAction( { 'mbaction' : 'hide' }, $item ); |
| 343 | + beforeAction( { 'mbaction' : 'hide' }, $item ); |
313 | 344 | e.preventDefault(); |
314 | 345 | } |
315 | 346 | |