Index: trunk/extensions/Reviews/Reviews.i18n.php |
— | — | @@ -57,6 +57,10 @@ |
58 | 58 | // Review control |
59 | 59 | 'reviews-submission-submit' => 'Submit', |
60 | 60 | 'reviews-submission-saving' => 'Saving', |
| 61 | + 'reviews-submission-title' => 'A title for your review:', |
| 62 | + 'reviews-submission-text' => 'The review text:', |
| 63 | + 'reviews-submission-rating' => 'Overall rating:', |
| 64 | + 'reviews-submission-ratings' => 'Specific ratings:', |
61 | 65 | |
62 | 66 | // Special:MyReviews |
63 | 67 | 'reviews-myreviews-header' => 'This page lists all reviews you posted.', |
Index: trunk/extensions/Reviews/Reviews.php |
— | — | @@ -130,6 +130,10 @@ |
131 | 131 | 'messages' => array( |
132 | 132 | 'reviews-submission-submit', |
133 | 133 | 'reviews-submission-saving', |
| 134 | + 'reviews-submission-title', |
| 135 | + 'reviews-submission-text', |
| 136 | + 'reviews-submission-rating', |
| 137 | + 'reviews-submission-ratings', |
134 | 138 | ), |
135 | 139 | 'dependencies' => array( |
136 | 140 | 'ext.reviews', 'jquery.ui.button', 'jquery.ui.stars', |
Index: trunk/extensions/Reviews/resources/jquery.reviewControl.css |
— | — | @@ -4,4 +4,26 @@ |
5 | 5 | * |
6 | 6 | * @licence GNU GPL v3 or later |
7 | 7 | * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
8 | | - */ |
\ No newline at end of file |
| 8 | + */ |
| 9 | + |
| 10 | +.review-control { |
| 11 | + /* border: 1px solid gray; */ |
| 12 | +} |
| 13 | + |
| 14 | +.review-textinput { |
| 15 | + width: 80%; |
| 16 | +} |
| 17 | + |
| 18 | +/* .review-ratings-div */ |
| 19 | +#review-1-ratingdiv > * { |
| 20 | + float: left; |
| 21 | + line-height: 1.4em; |
| 22 | +} |
| 23 | + |
| 24 | +.review-rating-label { |
| 25 | + padding-right: 0.5em; |
| 26 | +} |
| 27 | + |
| 28 | +.review-ratings-table-div { |
| 29 | + clear: both; |
| 30 | +} |
\ No newline at end of file |
Index: trunk/extensions/Reviews/resources/jquery.reviewControl.js |
— | — | @@ -22,52 +22,94 @@ |
23 | 23 | return 'review-' + ( typeof this.review.fields.id === 'undefined' ? 'new' : this.review.fields.id ) + '-' + name; |
24 | 24 | }; |
25 | 25 | |
| 26 | + this.buildRatingsControl = function() { |
| 27 | + var ratings = this.review.fields.ratings; |
| 28 | + var $tr = $( '<tr />' ).html( '' ); |
| 29 | + |
| 30 | + for ( rating in ratings ) { |
| 31 | + if ( ratings.hasOwnProperty( rating ) ) { |
| 32 | + $tr.append( $( '<td />' ).append( |
| 33 | + $( '<div class="review-ratings-div" />' ) |
| 34 | + .attr( 'id', this.fieldName( 'ratingdiv' + rating ) ) |
| 35 | + .attr( 'data-type', rating ) |
| 36 | + .html( reviews.htmlSelect( |
| 37 | + { 1: 1, 2: 2, 3: 3, 4: 4, 5: 5 }, // TODO |
| 38 | + ratings[rating], |
| 39 | + { |
| 40 | + 'name': this.fieldName( 'rating' + rating ), |
| 41 | + 'id': this.fieldName( 'rating' + rating ), |
| 42 | + 'class': 'review-specificratinginput' |
| 43 | + } |
| 44 | + ) ).prepend( $( '<label />' ).attr( { |
| 45 | + 'for': this.fieldName( 'ratingdiv' + rating ), |
| 46 | + 'class': 'review-ratings-label' |
| 47 | + } ).text( rating ) ) |
| 48 | + ) |
| 49 | + ); |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + this.ratingsInput = $( '<div />' ).attr( { 'class': 'review-ratings-table-div' } ).html( $( '<table />' ).html( $tr ) ); |
| 54 | + }; |
| 55 | + |
26 | 56 | this.buildInterface = function() { |
27 | 57 | this.titleInput = $( '<input />' ).attr( { |
28 | 58 | 'type': 'text', |
29 | 59 | 'size': 45, |
30 | | - 'name': this.fieldName( 'title' ) |
| 60 | + 'name': this.fieldName( 'title' ), |
| 61 | + 'class': 'review-titleinput' |
31 | 62 | } ).val( this.review.fields.title ); |
32 | 63 | |
33 | 64 | this.textInput = $( '<textarea />' ).attr( { |
34 | | - 'name': this.fieldName( 'text' ) |
| 65 | + 'name': this.fieldName( 'text' ), |
| 66 | + 'class': 'review-textinput' |
35 | 67 | } ).text( this.review.fields.text ); |
36 | 68 | |
37 | 69 | this.ratingInput = reviews.htmlSelect( |
38 | 70 | { 1: 1, 2: 2, 3: 3, 4: 4, 5: 5 }, // TODO |
39 | 71 | this.review.fields.rating, |
40 | | - { 'name': this.fieldName( 'rating' ), 'id': this.fieldName( 'rating' ) } |
| 72 | + { |
| 73 | + 'name': this.fieldName( 'rating' ), |
| 74 | + 'id': this.fieldName( 'rating' ), |
| 75 | + 'class': 'review-ratinginput' |
| 76 | + } |
41 | 77 | ); |
42 | 78 | |
43 | | - this.ratingInput = $( '<div />' ).attr( 'id', this.fieldName( 'ratingdiv' ) ).html( this.ratingInput ); |
44 | | - |
45 | | - this.ratingsInput = $( '<div />' ).html( '' ); |
| 79 | + this.ratingInput = $( '<div />' ).attr( { |
| 80 | + 'id': this.fieldName( 'ratingdiv' ), |
| 81 | + 'class': 'review-ratingdiv' |
| 82 | + } ).html( this.ratingInput ); |
46 | 83 | |
47 | | - var ratings = this.review.fields.ratings; |
48 | | - for ( rating in ratings ) { |
49 | | - if ( ratings.hasOwnProperty( rating ) ) { |
50 | | - this.ratingsInput.append( |
51 | | - $( '<div class="review-ratings-div" />' ) |
52 | | - .attr( 'id', this.fieldName( 'ratingdiv' + rating ) ) |
53 | | - .attr( 'data-type', rating ) |
54 | | - .html( reviews.htmlSelect( |
55 | | - { 1: 1, 2: 2, 3: 3, 4: 4, 5: 5 }, // TODO |
56 | | - ratings[rating], |
57 | | - { 'name': this.fieldName( 'rating' + rating ), 'id': this.fieldName( 'rating' + rating ) } |
58 | | - ) ) |
59 | | - ); |
60 | | - } |
61 | | - } |
| 84 | + this.buildRatingsControl(); |
62 | 85 | |
63 | | - this.button = $( '<button />' ) |
| 86 | + this.button = $( '<button class="review-save" />' ) |
64 | 87 | .button( { 'label': mw.msg( 'reviews-submission-submit' ) } ) |
65 | 88 | .click( function() { |
66 | 89 | _this.save(); |
67 | 90 | } ); |
68 | 91 | |
69 | 92 | $this.html( '' ); |
70 | | - $this.append( this.titleInput, this.textInput, this.ratingInput, this.ratingsInput, this.button ); |
71 | 93 | |
| 94 | + $this.append( |
| 95 | + $( '<label />' ).attr( { 'for': this.fieldName( 'title' ) } ).text( mw.msg( 'reviews-submission-title' ) + ' ' ), |
| 96 | + this.titleInput |
| 97 | + ).append( '<br />' ); |
| 98 | + |
| 99 | + $this.append( |
| 100 | + $( '<label />' ).attr( { 'for': this.fieldName( 'text' ) } ).text( mw.msg( 'reviews-submission-text' ) ).append( '<br />' ), |
| 101 | + this.textInput |
| 102 | + ).append( '<br />' ); |
| 103 | + |
| 104 | + $this.append( |
| 105 | + this.ratingInput.prepend( $( '<label />' ).attr( { |
| 106 | + 'for': this.fieldName( 'rating' ), |
| 107 | + 'class': 'review-rating-label' |
| 108 | + } ).text( mw.msg( 'reviews-submission-rating' ) ) ) |
| 109 | + ); |
| 110 | + |
| 111 | + $this.append( this.ratingsInput ); |
| 112 | + $this.append( this.button ); |
| 113 | + |
72 | 114 | this.ratingInput.stars( { |
73 | 115 | inputType: 'select', |
74 | 116 | cancelShow: false, |