Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -277,11 +277,11 @@ |
278 | 278 | 'ep-course-edit-token' => 'Enrollment token', |
279 | 279 | 'ep-course-edit-description' => 'Description', |
280 | 280 | 'ep-course-edit-name-format' => '$1 ($2)', |
281 | | - 'ep-course-edit-name' => 'Name', |
| 281 | + 'ep-course-edit-name' => 'Page title', |
282 | 282 | 'ep-course-edit-field' => 'Field of study', |
283 | 283 | 'ep-course-edit-level' => 'Course level', |
284 | 284 | 'ep-course-edit-term' => 'Academic term', |
285 | | - 'ep-course-edit-mc' => 'Master course', |
| 285 | + 'ep-course-edit-mc' => 'Course name', |
286 | 286 | 'ep-course-edit-lang' => 'Course language', |
287 | 287 | 'ep-addcourse' => 'There is no course with this name yet, but you can add it.', |
288 | 288 | 'ep-editcourse' => 'You are editing an existing course.', |
Index: trunk/extensions/EducationProgram/resources/ep.js |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | |
12 | 12 | var compatMode = undefined; |
13 | 13 | |
14 | | - var ep = { |
| 14 | + var ep = { |
15 | 15 | msg: function () { |
16 | 16 | // Yeah, doing it here, since "mw.loader.using( 'mediawiki.language'," |
17 | 17 | // does not have mediaWiki.language loaded. |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | msge: function () { |
58 | 58 | return mw.html.escape( this.msg.apply( this, arguments ) ); |
59 | 59 | } |
60 | | - } |
| 60 | + }; |
61 | 61 | |
62 | 62 | mw.educationProgram = ep; |
63 | 63 | |
Index: trunk/extensions/EducationProgram/resources/ep.api.js |
— | — | @@ -45,26 +45,31 @@ |
46 | 46 | return this.enlist( args ); |
47 | 47 | }, |
48 | 48 | |
49 | | - remove: function( data, callback ) { |
50 | | - var requestArgs = { |
| 49 | + remove: function( data, args ) { |
| 50 | + var requestArgs = $.extend( { |
51 | 51 | 'action': 'deleteeducation', |
52 | 52 | 'format': 'json', |
53 | 53 | 'token': window.mw.user.tokens.get( 'editToken' ), |
54 | 54 | 'ids': data.ids.join( '|' ), |
55 | 55 | 'type': data.type |
56 | | - }; |
| 56 | + }, args ); |
| 57 | + |
| 58 | + var deferred = $.Deferred(); |
57 | 59 | |
58 | 60 | $.post( |
59 | 61 | wgScriptPath + '/api.php', |
60 | 62 | requestArgs, |
61 | 63 | function( data ) { |
62 | | - var success = data.hasOwnProperty( 'success' ) && data.success; |
63 | | - |
64 | | - callback( { |
65 | | - 'success': success |
66 | | - } ); |
| 64 | + if ( data.hasOwnProperty( 'success' ) && data.success ) { |
| 65 | + deferred.resolve(); |
| 66 | + } |
| 67 | + else { |
| 68 | + deferred.reject(); |
| 69 | + } |
67 | 70 | } |
68 | 71 | ); |
| 72 | + |
| 73 | + return deferred.promise(); |
69 | 74 | } |
70 | 75 | |
71 | 76 | }; |
Index: trunk/extensions/EducationProgram/resources/ep.pager.js |
— | — | @@ -23,32 +23,26 @@ |
24 | 24 | if ( confirm( mw.msg( 'ep-pager-confirm-delete' ) ) ) { |
25 | 25 | var $this = $( this ); |
26 | 26 | |
27 | | - ep.api.remove( |
28 | | - { |
29 | | - 'type': $this.attr( 'data-type' ), |
30 | | - 'ids': [ $this.attr( 'data-id' ) ] |
31 | | - }, |
32 | | - function ( result ) { |
33 | | - if ( result.success ) { |
34 | | - var $tr = $this.closest( 'tr' ); |
35 | | - var $table = $tr.closest( 'table' ); |
| 27 | + ep.api.remove( { |
| 28 | + 'type': $this.attr( 'data-type' ), |
| 29 | + 'ids': [ $this.attr( 'data-id' ) ] |
| 30 | + } ).done( function() { |
| 31 | + var $tr = $this.closest( 'tr' ); |
| 32 | + var $table = $tr.closest( 'table' ); |
36 | 33 | |
37 | | - if ( $table.find( 'tr' ).length > 2 ) { |
38 | | - $tr.slideUp( 'slow', function () { |
39 | | - $tr.remove(); |
40 | | - } ); |
41 | | - } |
42 | | - else { |
43 | | - $table.slideUp( 'slow', function () { |
44 | | - $table.remove(); |
45 | | - } ); |
46 | | - } |
47 | | - } |
48 | | - else { |
49 | | - alert( mw.msg( 'ep-pager-delete-fail' ) ); |
50 | | - } |
| 34 | + if ( $table.find( 'tr' ).length > 2 ) { |
| 35 | + $tr.slideUp( 'slow', function () { |
| 36 | + $tr.remove(); |
| 37 | + } ); |
51 | 38 | } |
52 | | - ); |
| 39 | + else { |
| 40 | + $table.slideUp( 'slow', function () { |
| 41 | + $table.remove(); |
| 42 | + } ); |
| 43 | + } |
| 44 | + } ).fail( function() { |
| 45 | + alert( mw.msg( 'ep-pager-delete-fail' ) ); |
| 46 | + } ); |
53 | 47 | } |
54 | 48 | } ); |
55 | 49 | |
— | — | @@ -73,32 +67,26 @@ |
74 | 68 | |
75 | 69 | var pagerId = $( this ).attr( 'data-pager-id' ); |
76 | 70 | |
77 | | - ep.api.remove( |
78 | | - { |
79 | | - 'type': $( this ).attr( 'data-type' ), |
80 | | - 'ids': ids |
81 | | - }, |
82 | | - function ( result ) { |
83 | | - if ( result.success ) { |
84 | | - if ( ids.length > 0 && ( $table.find( 'tr' ).length - ids.length > 1 ) ) { |
85 | | - for ( i in ids ) { |
86 | | - if ( ids.hasOwnProperty( i ) ) { |
87 | | - $( '#select-' + pagerId + '-' + ids[i] ).closest( 'tr' ).remove(); |
88 | | - } |
89 | | - } |
| 71 | + ep.api.remove( { |
| 72 | + 'type': $( this ).attr( 'data-type' ), |
| 73 | + 'ids': ids |
| 74 | + } ).done( function() { |
| 75 | + if ( ids.length > 0 && ( $table.find( 'tr' ).length - ids.length > 1 ) ) { |
| 76 | + for ( i in ids ) { |
| 77 | + if ( ids.hasOwnProperty( i ) ) { |
| 78 | + $( '#select-' + pagerId + '-' + ids[i] ).closest( 'tr' ).remove(); |
90 | 79 | } |
91 | | - else { |
92 | | - $table.slideUp( 'slow', function () { |
93 | | - $table.remove(); |
94 | | - $deleteButton.closest( 'fieldset' ).remove(); |
95 | | - } ); |
96 | | - } |
97 | 80 | } |
98 | | - else { |
99 | | - alert( window.gM( 'ep-pager-delete-selected-fail', ids.length ) ); |
100 | | - } |
101 | 81 | } |
102 | | - ); |
| 82 | + else { |
| 83 | + $table.slideUp( 'slow', function () { |
| 84 | + $table.remove(); |
| 85 | + $deleteButton.closest( 'fieldset' ).remove(); |
| 86 | + } ); |
| 87 | + } |
| 88 | + } ).fail( function() { |
| 89 | + alert( window.gM( 'ep-pager-delete-selected-fail', ids.length ) ); |
| 90 | + } ); |
103 | 91 | } ); |
104 | 92 | |
105 | 93 | } ); |