Index: trunk/extensions/Reviews/includes/Review.php |
— | — | @@ -375,6 +375,18 @@ |
376 | 376 | ); |
377 | 377 | } |
378 | 378 | |
| 379 | + if ( $user->isAllowed( 'reviewsadmin' ) ) { |
| 380 | + $controlLinks[] = Html::element( |
| 381 | + 'a', |
| 382 | + array( |
| 383 | + 'href' => '#', |
| 384 | + 'class' => 'review-link-delete', |
| 385 | + 'data-review-id' => $this->getId() |
| 386 | + ), |
| 387 | + wfMsg( 'reviews-review-delete' ) |
| 388 | + ); |
| 389 | + } |
| 390 | + |
379 | 391 | $stateControl = $this->getStateControl( $user, false ); |
380 | 392 | |
381 | 393 | $html = '<table class="review-table">'; |
Index: trunk/extensions/Reviews/Reviews.i18n.php |
— | — | @@ -117,6 +117,7 @@ |
118 | 118 | 'reviews-review-details' => 'View details', |
119 | 119 | 'reviews-review-edit' => 'Edit', |
120 | 120 | 'reviews-review-delete' => 'Delete', |
| 121 | + 'reviews-display-delete-confirm' => 'Are you sure you want to delete this review?', |
121 | 122 | ); |
122 | 123 | |
123 | 124 | /** Message documentation (Message documentation) |
Index: trunk/extensions/Reviews/Reviews.php |
— | — | @@ -201,16 +201,19 @@ |
202 | 202 | ), |
203 | 203 | ); |
204 | 204 | |
205 | | -$wgResourceModules['ext.reviews.list'] = $moduleTemplate + array( |
| 205 | +$wgResourceModules['ext.reviews.display'] = $moduleTemplate + array( |
206 | 206 | 'scripts' => array( |
207 | | - 'reviews.list.js', |
| 207 | + 'reviews.display.js', |
208 | 208 | ), |
209 | 209 | 'styles' => array( |
210 | | - 'reviews.list.css', |
| 210 | + 'reviews.display.css', |
211 | 211 | ), |
212 | 212 | 'dependencies' => array( |
213 | | - 'jquery.reviewState', 'jquery.reviewRating', |
| 213 | + 'ext.reviews', 'jquery.reviewState', 'jquery.reviewRating', |
214 | 214 | ), |
| 215 | + 'messages' => array( |
| 216 | + 'reviews-display-delete-confirm', |
| 217 | + ), |
215 | 218 | ); |
216 | 219 | |
217 | 220 | $wgResourceModules['ext.reviews.pager'] = $moduleTemplate + array( |
— | — | @@ -221,7 +224,7 @@ |
222 | 225 | 'reviews.pager.css', |
223 | 226 | ), |
224 | 227 | 'dependencies' => array( |
225 | | - 'jquery.reviewState', 'jquery.reviewRating', 'ext.reviews.list', |
| 228 | + 'jquery.reviewState', 'jquery.reviewRating', 'ext.reviews.display', |
226 | 229 | ), |
227 | 230 | ); |
228 | 231 | |
Index: trunk/extensions/Reviews/resources/reviews.list.js |
— | — | @@ -1,20 +0,0 @@ |
2 | | -/** |
3 | | - * JavasSript for the Reviews MediaWiki extension. |
4 | | - * @see https://www.mediawiki.org/wiki/Extension:Reviews |
5 | | - * |
6 | | - * @licence GNU GPL v3 or later |
7 | | - * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
8 | | - */ |
9 | | - |
10 | | -(function( $, mw ) { |
11 | | - |
12 | | - var _this = this; |
13 | | - |
14 | | - $( document ).ready( function() { |
15 | | - |
16 | | - $( '.review-rating-display' ).reviewRating(); |
17 | | - $( '.reviews-state-controls' ).reviewState(); |
18 | | - |
19 | | - } ); |
20 | | - |
21 | | -})( window.jQuery, window.mediaWiki ); |
Index: trunk/extensions/Reviews/resources/reviews.list.css |
— | — | @@ -1,34 +0,0 @@ |
2 | | -/** |
3 | | - * CSS for the Reviews MediaWiki extension. |
4 | | - * @see https://www.mediawiki.org/wiki/Extension:Reviews |
5 | | - * |
6 | | - * @licence GNU GPL v3 or later |
7 | | - * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
8 | | - */ |
9 | | - |
10 | | -.review-table { |
11 | | - width: 100%; |
12 | | -} |
13 | | - |
14 | | -table.review-table, table.review-table td, table.review-table th { |
15 | | - border: 1px solid gray; |
16 | | -} |
17 | | - |
18 | | -.review-table-title { |
19 | | - text-align: left; |
20 | | - padding-left: 5px; |
21 | | -} |
22 | | - |
23 | | -.review-author-box{ |
24 | | - width: 150px; |
25 | | -} |
26 | | - |
27 | | -.reviews-posted-by { |
28 | | - clear: both; |
29 | | -} |
30 | | - |
31 | | -.reviews-posted-on { |
32 | | - clear: both; |
33 | | - color: darkgray; |
34 | | - font-size: 80%; |
35 | | -} |
\ No newline at end of file |
Index: trunk/extensions/Reviews/resources/reviews.display.css |
— | — | @@ -0,0 +1,34 @@ |
| 2 | +/** |
| 3 | + * CSS for the Reviews MediaWiki extension. |
| 4 | + * @see https://www.mediawiki.org/wiki/Extension:Reviews |
| 5 | + * |
| 6 | + * @licence GNU GPL v3 or later |
| 7 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 8 | + */ |
| 9 | + |
| 10 | +.review-table { |
| 11 | + width: 100%; |
| 12 | +} |
| 13 | + |
| 14 | +table.review-table, table.review-table td, table.review-table th { |
| 15 | + border: 1px solid gray; |
| 16 | +} |
| 17 | + |
| 18 | +.review-table-title { |
| 19 | + text-align: left; |
| 20 | + padding-left: 5px; |
| 21 | +} |
| 22 | + |
| 23 | +.review-author-box{ |
| 24 | + width: 150px; |
| 25 | +} |
| 26 | + |
| 27 | +.reviews-posted-by { |
| 28 | + clear: both; |
| 29 | +} |
| 30 | + |
| 31 | +.reviews-posted-on { |
| 32 | + clear: both; |
| 33 | + color: darkgray; |
| 34 | + font-size: 80%; |
| 35 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/Reviews/resources/reviews.display.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 36 | + native |
Index: trunk/extensions/Reviews/resources/reviews.display.js |
— | — | @@ -0,0 +1,40 @@ |
| 2 | +/** |
| 3 | + * JavasSript for the Reviews MediaWiki extension. |
| 4 | + * @see https://www.mediawiki.org/wiki/Extension:Reviews |
| 5 | + * |
| 6 | + * @licence GNU GPL v3 or later |
| 7 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 8 | + */ |
| 9 | + |
| 10 | +(function( $, mw ) { |
| 11 | + |
| 12 | + var _this = this; |
| 13 | + |
| 14 | + $( document ).ready( function() { |
| 15 | + |
| 16 | + $( '.review-rating-display' ).reviewRating(); |
| 17 | + $( '.reviews-state-controls' ).reviewState(); |
| 18 | + |
| 19 | + $( '.review-link-delete' ).click( function() { |
| 20 | + $this = $( this ); |
| 21 | + if ( confirm( mw.msg( 'reviews-display-delete-confirm' ) ) ) { |
| 22 | + var review = new reviews.Review( { 'id': $this.attr( 'data-review-id' ) } ); |
| 23 | + |
| 24 | + review.remove( function( success ) { |
| 25 | + if ( success ) { |
| 26 | + $this.closest( 'table' ).closest( 'tr' ).slideUp( 'slow', function() { |
| 27 | + $this.remove(); |
| 28 | + } ); |
| 29 | + } |
| 30 | + else { |
| 31 | + // TODO |
| 32 | + alert( 'The review could not be removed.' ); |
| 33 | + $this.button( 'enable' ); |
| 34 | + } |
| 35 | + } ); |
| 36 | + } |
| 37 | + } ); |
| 38 | + |
| 39 | + } ); |
| 40 | + |
| 41 | +})( window.jQuery, window.mediaWiki ); |
Property changes on: trunk/extensions/Reviews/resources/reviews.display.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 42 | + native |