r105571 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105570‎ | r105571 | r105572 >
Date:18:59, 8 December 2011
Author:jeroendedauw
Status:reverted
Tags:
Comment:
adding deletion link to main ui
Modified paths:
  • /trunk/extensions/Reviews/Reviews.i18n.php (modified) (history)
  • /trunk/extensions/Reviews/Reviews.php (modified) (history)
  • /trunk/extensions/Reviews/includes/Review.php (modified) (history)
  • /trunk/extensions/Reviews/resources/reviews.display.css (added) (history)
  • /trunk/extensions/Reviews/resources/reviews.display.js (added) (history)
  • /trunk/extensions/Reviews/resources/reviews.list.css (deleted) (history)
  • /trunk/extensions/Reviews/resources/reviews.list.js (deleted) (history)

Diff [purge]

Index: trunk/extensions/Reviews/includes/Review.php
@@ -375,6 +375,18 @@
376376 );
377377 }
378378
 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+
379391 $stateControl = $this->getStateControl( $user, false );
380392
381393 $html = '<table class="review-table">';
Index: trunk/extensions/Reviews/Reviews.i18n.php
@@ -117,6 +117,7 @@
118118 'reviews-review-details' => 'View details',
119119 'reviews-review-edit' => 'Edit',
120120 'reviews-review-delete' => 'Delete',
 121+ 'reviews-display-delete-confirm' => 'Are you sure you want to delete this review?',
121122 );
122123
123124 /** Message documentation (Message documentation)
Index: trunk/extensions/Reviews/Reviews.php
@@ -201,16 +201,19 @@
202202 ),
203203 );
204204
205 -$wgResourceModules['ext.reviews.list'] = $moduleTemplate + array(
 205+$wgResourceModules['ext.reviews.display'] = $moduleTemplate + array(
206206 'scripts' => array(
207 - 'reviews.list.js',
 207+ 'reviews.display.js',
208208 ),
209209 'styles' => array(
210 - 'reviews.list.css',
 210+ 'reviews.display.css',
211211 ),
212212 'dependencies' => array(
213 - 'jquery.reviewState', 'jquery.reviewRating',
 213+ 'ext.reviews', 'jquery.reviewState', 'jquery.reviewRating',
214214 ),
 215+ 'messages' => array(
 216+ 'reviews-display-delete-confirm',
 217+ ),
215218 );
216219
217220 $wgResourceModules['ext.reviews.pager'] = $moduleTemplate + array(
@@ -221,7 +224,7 @@
222225 'reviews.pager.css',
223226 ),
224227 'dependencies' => array(
225 - 'jquery.reviewState', 'jquery.reviewRating', 'ext.reviews.list',
 228+ 'jquery.reviewState', 'jquery.reviewRating', 'ext.reviews.display',
226229 ),
227230 );
228231
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
136 + 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
142 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r105573Follow up to r105571;jeroendedauw19:10, 8 December 2011

Status & tagging log