r74714 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74713‎ | r74714 | r74715 >
Date:04:59, 13 October 2010
Author:dale
Status:deferred
Tags:
Comment:
improved subtitle editor flow with basic error reporting
Modified paths:
  • /branches/MwEmbedStandAlone/modules/MiroSubs/MiroSubs.i18n.php (modified) (history)
  • /branches/MwEmbedStandAlone/modules/MiroSubs/mw.MiroSubsConfig.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/MiroSubs/mw.MiroSubsConfig.js
@@ -88,7 +88,7 @@
8989
9090 // Convert the miroSubs to srt
9191 var srtText = _this.miroSubs2Srt( miroSubs );
92 - _this.getSaveSummary( function( summary ){
 92+ $saveDialog = _this.getSaveDialogSummary( function( summary ){
9393 if( summary === false ){
9494 // Return to current page without saving the text
9595 location.reload(true);
@@ -96,15 +96,23 @@
9797 }
9898 _this.saveSrtText( srtText, summary, function(status){
9999 // No real error handling right now
100 - // refresh page regardless of save or cancel
101 - location.reload(true);
102 -
103 - /* @@todo error handling
 100+ // refresh page regardless of save or cancel
 101+
104102 if( status ){
105 - doneSaveCallback();
 103+ $saveDialog
 104+ .dialog("option", 'title', gM('mwe-mirosubs-subs-saved') )
 105+ .html( gM('mwe-mirosubs-thankyou-contribution') );
106106 } else {
107 - cancelCallback();
108 - }*/
 107+ $saveDialog
 108+ .dialog("option", 'title', gM('mwe-mirosubs-subs-saved-error') )
 109+ .html( gM('mwe-mirosubs-subs-saved-error') );
 110+ }
 111+ // Either way the only button is OK and it refreshes the page:
 112+ var button = {};
 113+ button[ gM('mwe-ok') ] = function(){
 114+ location.reload(true);
 115+ };
 116+ $saveDialog.dialog("option", "buttons", button );
109117 });
110118 });
111119 },
@@ -116,7 +124,7 @@
117125 'embedCode' : 'some code to embed'
118126 };
119127 },
120 - getSaveSummary: function( callback ){
 128+ getSaveDialogSummary: function( callback ){
121129 // Add a dialog to get save summary
122130 var buttons ={};
123131 buttons[ gM('mwe-mirosubs-save-subs') ] = function(){
@@ -130,7 +138,9 @@
131139 $j('<div />')
132140 .loadingSpinner()
133141 )
134 - );
 142+ )
 143+ .dialog( "option", "buttons", false )
 144+ .dialog( "option", "title", gM('mwe-mirosubs-saving-subs') );
135145 };
136146 buttons[ gM('mwe-cancel') ] = function(){
137147 callback( false );
@@ -138,7 +148,7 @@
139149 };
140150 // Reduce the z-index so we can put the model ontop:
141151 //$j('.mirosubs-modal-widget-bg,.mirosubs-modal-widget').css( 'z-index', 10 );
142 - mw.addDialog( {
 152+ var $dialog = mw.addDialog( {
143153 'title' : gM("mwe-mirosubs-save-summary"),
144154 'width' : 450,
145155 'content' : $j('<div />').append(
@@ -149,7 +159,8 @@
150160 }).val( gM('mwe-mirosubs-save-default') )
151161 ),
152162 'buttons' : buttons
153 - });
 163+ });
 164+ return $dialog;
154165 },
155166 saveSrtText: function( srtText, summary, callback ){
156167 var _this = this;
Index: branches/MwEmbedStandAlone/modules/MiroSubs/MiroSubs.i18n.php
@@ -15,5 +15,8 @@
1616 'mwe-mirosubs-save-summary' => 'Summary of subtitle edits',
1717 'mwe-mirosubs-save-default' => 'Edited subtitles',
1818 'mwe-mirosubs-save-subs' => 'Save subtitles',
19 - 'mwe-mirosubs-saving-subs' => 'Saving subtitles ...'
 19+ 'mwe-mirosubs-saving-subs' => 'Saving subtitles ...',
 20+ 'mwe-mirosubs-subs-saved' => 'Subtitles saved',
 21+ 'mwe-mirosubs-thankyou-contribution' => 'Thank you for your subtitle contribution',
 22+ 'mwe-mirosubs-subs-saved-error' => 'Error in saving subtitles',
2023 );
\ No newline at end of file

Status & tagging log