r103209 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103208‎ | r103209 | r103210 >
Date:18:56, 15 November 2011
Author:rmoen
Status:resolved (Comments)
Tags:
Comment:
revised admin reason to be inline, with cancel / confirm button
Modified paths:
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.css (modified) (history)
  • /trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.css
@@ -226,7 +226,8 @@
227227
228228 .fbd-item-permalink,
229229 .fbd-item-show,
230 -.fbd-item-hide {
 230+.fbd-item-hide,
 231+.fbd-item-reason{
231232 float: right;
232233 font-size: 0.8em;
233234 margin-left: 0.2em;
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js
@@ -249,6 +249,36 @@
250250 }
251251
252252 /**
 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+ /**
253283 * Execute an action on an item
254284 */
255285 function doAction( params, $item ) {
@@ -258,8 +288,12 @@
259289 showItemError( $item, error_str );
260290 };
261291
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();
263294
 295+ var $spinner = $('<span class="mw-ajax-loader">&nbsp;</span>');
 296+ $item.find('.fbd-item-hide').empty().append( $spinner );
 297+
264298 $.post( mw.util.wikiScript('api'),
265299 $.extend( {
266300 'action' : 'feedbackdashboard',
@@ -290,11 +324,8 @@
291325 function restoreItem(e) {
292326 var $item = $(this).closest('.fbd-item');
293327
294 - var $spinner = $('<span class="mw-ajax-loader">&nbsp;</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 );
299330 e.preventDefault();
300331 }
301332
@@ -303,12 +334,12 @@
304335 */
305336 function hideItem(e) {
306337 var $item = $(this).closest('.fbd-item');
 338+
 339+ //var $spinner = $('<span class="mw-ajax-loader">&nbsp;</span>');
 340+ //$item.find('.fbd-item-hide').empty().append( $spinner );
307341
308 - var $spinner = $('<span class="mw-ajax-loader">&nbsp;</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 );
313344 e.preventDefault();
314345 }
315346

Follow-up revisions

RevisionCommit summaryAuthorDate
r103218required inline action reason, added localizationrmoen20:14, 15 November 2011

Comments

#Comment by Raindrift (talk | contribs)   00:37, 16 November 2011

There's a lot of commented-out code in here. Marking FIXME for that. Looks reasonable otherwise.

#Comment by Robmoen (talk | contribs)   07:59, 16 November 2011

removed comments in r103218

Status & tagging log