Index: branches/MwEmbedStandAlone/modules/MiroSubs/mw.MiroSubsConfig.js |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | |
90 | 90 | // Convert the miroSubs to srt |
91 | 91 | var srtText = _this.miroSubs2Srt( miroSubs ); |
92 | | - _this.getSaveSummary( function( summary ){ |
| 92 | + $saveDialog = _this.getSaveDialogSummary( function( summary ){ |
93 | 93 | if( summary === false ){ |
94 | 94 | // Return to current page without saving the text |
95 | 95 | location.reload(true); |
— | — | @@ -96,15 +96,23 @@ |
97 | 97 | } |
98 | 98 | _this.saveSrtText( srtText, summary, function(status){ |
99 | 99 | // 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 | + |
104 | 102 | if( status ){ |
105 | | - doneSaveCallback(); |
| 103 | + $saveDialog |
| 104 | + .dialog("option", 'title', gM('mwe-mirosubs-subs-saved') ) |
| 105 | + .html( gM('mwe-mirosubs-thankyou-contribution') ); |
106 | 106 | } 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 ); |
109 | 117 | }); |
110 | 118 | }); |
111 | 119 | }, |
— | — | @@ -116,7 +124,7 @@ |
117 | 125 | 'embedCode' : 'some code to embed' |
118 | 126 | }; |
119 | 127 | }, |
120 | | - getSaveSummary: function( callback ){ |
| 128 | + getSaveDialogSummary: function( callback ){ |
121 | 129 | // Add a dialog to get save summary |
122 | 130 | var buttons ={}; |
123 | 131 | buttons[ gM('mwe-mirosubs-save-subs') ] = function(){ |
— | — | @@ -130,7 +138,9 @@ |
131 | 139 | $j('<div />') |
132 | 140 | .loadingSpinner() |
133 | 141 | ) |
134 | | - ); |
| 142 | + ) |
| 143 | + .dialog( "option", "buttons", false ) |
| 144 | + .dialog( "option", "title", gM('mwe-mirosubs-saving-subs') ); |
135 | 145 | }; |
136 | 146 | buttons[ gM('mwe-cancel') ] = function(){ |
137 | 147 | callback( false ); |
— | — | @@ -138,7 +148,7 @@ |
139 | 149 | }; |
140 | 150 | // Reduce the z-index so we can put the model ontop: |
141 | 151 | //$j('.mirosubs-modal-widget-bg,.mirosubs-modal-widget').css( 'z-index', 10 ); |
142 | | - mw.addDialog( { |
| 152 | + var $dialog = mw.addDialog( { |
143 | 153 | 'title' : gM("mwe-mirosubs-save-summary"), |
144 | 154 | 'width' : 450, |
145 | 155 | 'content' : $j('<div />').append( |
— | — | @@ -149,7 +159,8 @@ |
150 | 160 | }).val( gM('mwe-mirosubs-save-default') ) |
151 | 161 | ), |
152 | 162 | 'buttons' : buttons |
153 | | - }); |
| 163 | + }); |
| 164 | + return $dialog; |
154 | 165 | }, |
155 | 166 | saveSrtText: function( srtText, summary, callback ){ |
156 | 167 | var _this = this; |
Index: branches/MwEmbedStandAlone/modules/MiroSubs/MiroSubs.i18n.php |
— | — | @@ -15,5 +15,8 @@ |
16 | 16 | 'mwe-mirosubs-save-summary' => 'Summary of subtitle edits', |
17 | 17 | 'mwe-mirosubs-save-default' => 'Edited subtitles', |
18 | 18 | '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', |
20 | 23 | ); |
\ No newline at end of file |