r87894 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87893‎ | r87894 | r87895 >
Date:22:42, 11 May 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
some changes of 2 days back that I apparently did not commit correctly
Modified paths:
  • /trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/SemanticWatchlist.php (modified) (history)
  • /trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticWatchlist/specials/jquery.watchlistcondition.js
@@ -8,29 +8,58 @@
99
1010 (function( $ ){ $.fn.watchlistcondition = function( group, options ) {
1111
12 - this.html( $( '<legend />' ).text( group.name ) );
 12+ var self = this;
1313
14 - var table = $( '<table />' ).attr( { 'class': 'swltable' } );
15 -
16 - var nameInput = $( '<input />' ).attr( { 'type': 'text', 'value': group.name } );
17 -
18 - table.html( $( '<tr />' ).html( $( '<td />' ).attr( 'colspan', 2 ).html(
19 - $( '<p />' ).text( mediaWiki.msg( 'swl-group-name' ) ).append( nameInput )
20 - ) ) );
21 -
22 - var propTd = $( '<td />' );
23 -
24 - propTd.html( mediaWiki.msg( 'swl-group-properties' ) );
25 -
26 - for ( i in group.properties ) {
27 - propTd.append( getPropertyDiv( group.properties[i] ) );
 14+ this.buildHtml = function() {
 15+ this.html( $( '<legend />' ).text( group.name ) );
 16+
 17+ var table = $( '<table />' ).attr( { 'class': 'swltable' } );
 18+
 19+ var propTd = $( '<td />' ).attr( {
 20+ //'bgcolor': 'gray',
 21+ 'rowspan': 2
 22+ } );
 23+
 24+ propTd.html( mediaWiki.msg( 'swl-group-properties' ) );
 25+
 26+ for ( i in group.properties ) {
 27+ propTd.append( this.getPropertyDiv( group.properties[i] ) );
 28+ }
 29+
 30+ table.append( $( '<tr />' ).html( $( '<td />' ) ).append( propTd ) );
 31+
 32+ var nameInput = $( '<input />' ).attr( {
 33+ 'type': 'text',
 34+ 'value': group.name,
 35+ 'size': 30
 36+ } );
 37+ var nameTd = $( '<td />' ).html( $( '<p />' ).text( mediaWiki.msg( 'swl-group-name' ) ).append( nameInput ) );
 38+ table.append( $( '<tr />' ).html( nameTd ) );
 39+
 40+ var conditionNameInput = $( '<input />' ).attr( {
 41+ 'type': 'text',
 42+ 'value': group.name,
 43+ 'size': 30
 44+ } );
 45+ var conditionTd = $( '<td />' ).html( $( '<p />' ).text( mediaWiki.msg( 'swl-group-page-selection' ) ).append( conditionNameInput ) );
 46+ table.append( $( '<tr />' ).html( conditionTd ) );
 47+
 48+ this.append( table );
 49+
 50+ this.append(
 51+ $( '<input />' ).attr( {
 52+ 'type': 'button',
 53+ 'value': mediaWiki.msg( 'save' )
 54+ } ).click( function() {
 55+ this.disabled = true;
 56+ self.doSave( function() { this.disabled = false; } );
 57+ } )
 58+ );
2859 }
2960
30 - table.append( $( '<tr />' ).attr( 'colspan', 2 ).append( propTd ) );
31 -
32 - this.append( table );
33 -
34 - function getPropertyDiv( property ) {
 61+ this.getPropertyDiv = function( property ) {
 62+ var propDiv = $( '<div />' ).attr( 'class', 'propid' );
 63+
3564 var propInput = $( '<input />' ).attr( {
3665 'type': 'text',
3766 'value': property,
@@ -42,9 +71,19 @@
4372 value: mediaWiki.msg( 'swl-group-remove-property' )
4473 } );
4574
46 - return $( '<div />' ).attr( 'class', 'propid' ).html( propInput ).append( removeButton );
 75+ removeButton.click( function() {
 76+ propDiv.remove();
 77+ } );
 78+
 79+ return propDiv.html( propInput ).append( removeButton );
4780 }
4881
 82+ this.doSave = function( callback ) {
 83+
 84+ }
 85+
 86+ this.buildHtml();
 87+
4988 return this;
5089
5190 }; })( jQuery );
\ No newline at end of file
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.i18n.php
@@ -30,6 +30,7 @@
3131 'swl-group-name' => 'Group name: ',
3232 'swl-group-properties' => 'Properties covered by this group:',
3333 'swl-group-remove-property' => 'Remove property',
 34+ 'swl-group-page-selection' => 'Pages in ',
3435 );
3536
3637 /** German (Deutsch)
Index: trunk/extensions/SemanticWatchlist/SemanticWatchlist.php
@@ -97,7 +97,9 @@
9898 'messages' => array(
9999 'swl-group-name',
100100 'swl-group-properties',
101 - 'swl-group-remove-property',
 101+ 'swl-group-remove-property',
 102+ 'swl-group-page-selection',
 103+ 'save',
102104 )
103105 );
104106

Follow-up revisions

RevisionCommit summaryAuthorDate
r88371follow up to r87894jeroendedauw17:01, 18 May 2011

Comments

#Comment by Siebrand (talk | contribs)   22:47, 11 May 2011

Eew... 'swl-group-page-selection' => 'Pages in '

That needs a parameter, and at least removal of the trailing space in the message content.

#Comment by Jeroen De Dauw (talk | contribs)   12:02, 12 May 2011

s/and/or?

The "parameter" will be an HTML element, so I'll just stick with removing the tailing space. Same goes for 'swl-group-name' => 'Group name: '.

Status & tagging log